Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Example for Automatic Route53 Alias Creation #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.idea
package-lock.json
.DS_Store
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
```


Expand Down Expand Up @@ -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.

---
Expand Down