How to create an alias record on Route 53 using TypeScript and AWS CDK.
Using AWS CDK instead of CloudFormation.
Maybe you have two or more domains registered and to change DNS is more difficult or not an option. Alias records will map a DNS name to a particular AWS resource, such as an Elastic Load Balancer, an S3 bucket or a Cloudfront distribution. Using an alias record to route traffic to an AWS resource, Route 53 will automatically recognize changes in the resource
Alias record is an Amazon Route 53-specific virtual record.
Amazon Route 53 alias records provide a Route 53–specific extension to DNS functionality. Alias records let you route traffic to selected AWS resources, such as CloudFront distributions and Amazon S3 buckets. They also let you route traffic from one record in a hosted zone to another record.
Let’s do it.
Step 1: Set up your development environment
Install Node.js and npm on your machine if you haven’t already.
Install the AWS CLI by running npm install -g aws-cli.
Set up your AWS credentials by running aws configure and following the prompts.