Version v0.24.0 of the @kensio/yulin npm package adds a simulated Route53 service for local
development and isolated testing.
The simulator supports creating Hosted Zones and record sets through Route53 SDK commands, and also
supports AWS::Route53::HostedZone and AWS::Route53::RecordSet resources when deploying
CloudFormation or CDK templates into the simulated AWS.
One feature that’s particularly useful for local development and testing is simulated CNAME resolution. When Yulin is running on localhost, sim Route53 records can route your own application hostnames to other simulated AWS services.
For example, you can create a simulated CloudFront distribution, point a Route53 record at it, and then access it locally using a URL like:
http://www.example.test.sim-aws.localhost:3000/
That makes it possible to exercise applications using realistic hostnames while everything still runs locally in a single Node.js process.
Creating a Hosted Zone looks much the same as it does against the real AWS SDK:
const simAws = new SimAws();
const route53 = simAws.route53();
await route53.createHostedZone(
new CreateHostedZoneCommand({
Name: "example.test",
CallerReference: "example-zone",
}),
);
You can also deploy sim Route53 infrastructure directly from CloudFormation or CDK templates. For example with an output JSON template like:
{
"Resources": {
"SiteZone": {
"Type": "AWS::Route53::HostedZone",
"Properties": {
"Name": "example.test"
}
},
"SiteRecord": {
"Type": "AWS::Route53::RecordSet",
"Properties": {
"HostedZoneId": {
"Ref": "SiteZone"
},
"Name": "www.example.test",
"Type": "CNAME",
"TTL": "300",
"ResourceRecords": [
"d111111abcdef8.cloudfront.net"
]
}
}
}
}
You can deploy that into simulated AWS:
import { SimAws } from "@kensio/yulin";
const simAws = new SimAws();
await simAws.cloudFormation().deployTemplateFile("path/to/template.json");
You can then interact with the simulated AWS including sim Route53 on localhost and in automated tests.
The Route53 simulator integrates with the rest of Yulin, so CloudFormation, CDK, S3 and CloudFront can all participate in the same simulated environment for local development and system tests.
Documentation: https://yulinsim.dev/services/route53/