A serverless solution to handle url redirects for static sites.
- ARN to a valid Amazon Certificate Mangager (ACM) certificate that covers your
FromDomain's Route53 record.
- If you previously used your
FromDomainas a CloudFront alias you must remove that before deploying this cloudformation. Domains can only be associated with 1 CloudFront distribution.
- Ensure you don't have any existing
AAAARoute53 records for the
FromDomain, these will be created for you. If you have prior records the deployment will fail.
bash run.sh deploy <FromDomain> <ToProtocol> <ToDomain> <HostedZoneId> <AcmArnForFromDomain>
- For example
bash run.sh deploy www.mcgilldevtech.com https mcgilldevtech.com ABC123 arn:aws:acm:us-east-1:123456789012:certificate/abc123to redirect
apexdomain (or visa versa).
- For example
- Be patient, deploying the
AWS::ApiGateway::DomainNamedoesn't break and speed records!
- Hit the
FromDomainfrom your browser and you should be redirected to your
ToDomain, including any path.
updateto run again.
deleteto tear it all down.
What's happening during all of this?
- When you enter
www.mcgilldevtech.comin your browser Route53 directs you to API Gateway's CloudFront.
301's you to
- That URL hits the lambda which pulls off the
FromDomain's path, if there is one, and reconstructs the url then
301's clients to that URL. ie.