diff --git a/.gitignore b/.gitignore index 0433bbc..289bd63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .idea package-lock.json +.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 739bab4..057c38a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - +- Add documentation for how to automatically configure Route53 Aliases using provided CloudFormation Template ## [0.8.0] - 2021-1-28 Thanks @pecirep, @miguel-a-calles-mba, @superandrew213 diff --git a/README.md b/README.md index 9f61b80..bf2ecbf 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,9 @@ npm install --save-dev fullstack-serverless * All fullstack-serverless configuration parameters are optional - e.g. don't provide ACM Certificate ARN to use default CloudFront certificate (which works only for default cloudfront.net domain). -* This plugin **does not** set-up automatically Route53 for newly created CloudFront distribution. - After creating CloudFront distribution, manually add Route53 ALIAS record pointing to your - CloudFront domain name. +* This plugin **does not create Route53 aliases** for the newly created CloudFront distribution automatically; + however, this is easily configured with the addition of `AWS::Route53::RecordSetGroup` CloudFormation templating (provided below). + Alternatively, you may manually add Route53 ALIAS record pointing to your CloudFront domain name in the AWS console. * First deployment may be quite long (e.g. 10 min) as Serverless is waiting for CloudFormation to deploy CloudFront distribution. @@ -78,6 +78,22 @@ custom: minimumProtocolVersion: TLSv1.2_2018 priceClass: PriceClass_100 noConfirm: false # Alternative to --no-confirm flag. Use this parameter if you do not want a confirmation prompt to interrupt automated builds. + + +# Optionally add for automatic Route53 domain alias creation (all fields required) +resources: + Resources: + WebsiteDNSName: + Type: AWS::Route53::RecordSetGroup + Properties: + HostedZoneId: Z0123456ABCDEFG # The hosted zone ID for your domain found within Route53 + RecordSets: + - Name: my-custom-domain.com + Type: A # (Alias) + AliasTarget: + HostedZoneId: Z2FDTNDATAQYW2 # The static CloudFront Hosted Zone ID (do not change) + DNSName: !GetAtt [ApiDistribution, DomainName] # References the URL the fullstack plugin creates (do not change) + EvaluateTargetHealth: false # Advanced setting. See: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html ``` @@ -255,6 +271,31 @@ custom: ... ``` +To automatically create and configure Route53 aliases for multiple domains, the following can be added to `serverless.yml` at the root level: + +```yaml +resources: + Resources: + WebsiteDNSName: + Type: AWS::Route53::RecordSetGroup + Properties: + HostedZoneId: Z0123456ABCDEFG + RecordSets: + - Name: my-custom-domain.com + Type: A + AliasTarget: + HostedZoneId: Z2FDTNDATAQYW2 + DNSName: !GetAtt [ApiDistribution, DomainName] + EvaluateTargetHealth: false + - Name: secondary-custom-domain.com + Type: A + AliasTarget: + HostedZoneId: Z2FDTNDATAQYW2 + DNSName: !GetAtt [ApiDistribution, DomainName] + EvaluateTargetHealth: false + # Additions can be made to this list for all custom.fullstack.domain entries... +``` + The custom domain for your fullstack serverless app. ---