Namespace Amazon.CDK.AWS.Route53.Targets
Route53 Alias Record Targets for the CDK Route53 Library
This library contains Route53 Alias Record targets for:
Important: Based on AWS documentation, all alias record in Route 53 that points to a Elastic Load Balancer will always include dualstack for the DNSName to resolve IPv4/IPv6 addresses (without dualstack IPv6 will not resolve).
For example, if the Amazon-provided DNS for the load balancer is ALB-xxxxxxx.us-west-2.elb.amazonaws.com
, CDK will create alias target in Route 53 will be dualstack.ALB-xxxxxxx.us-west-2.elb.amazonaws.com
.
Important: If you use GlobalAcceleratorDomainTarget, passing a string rather than an instance of IAccelerator, ensure that the string is a valid domain name of an existing Global Accelerator instance. See the documentation on DNS addressing with Global Accelerator for more info.
Important: Based on the CFN docs for VPCEndpoints - see here - the attributes returned for DnsEntries in CloudFormation is a combination of the hosted zone ID and the DNS name. The entries are ordered as follows: regional public DNS, zonal public DNS, private DNS, and wildcard DNS. This order is not enforced for AWS Marketplace services, and therefore this CDK construct is ONLY guaranteed to work with non-marketplace services.
using Amazon.CDK.AWS.EC2;
HostedZone zone;
InterfaceVpcEndpoint interfaceVpcEndpoint;
new ARecord(this, "AliasRecord", new ARecordProps {
Zone = zone,
Target = RecordTarget.FromAlias(new InterfaceVpcEndpointTarget(interfaceVpcEndpoint))
});
Important: The Bucket name must strictly match the full DNS name. See the Developer Guide for more info.
using Amazon.CDK.AWS.S3;
var recordName = "www";
var domainName = "example.com";
var bucketWebsite = new Bucket(this, "BucketWebsite", new BucketProps {
BucketName = new [] { recordName, domainName }.Join("."), // www.example.com
PublicReadAccess = true,
WebsiteIndexDocument = "index.html"
});
var zone = HostedZone.FromLookup(this, "Zone", new HostedZoneProviderProps { DomainName = domainName }); // example.com
// example.com
new ARecord(this, "AliasRecord", new ARecordProps {
Zone = zone,
RecordName = recordName, // www
Target = RecordTarget.FromAlias(new BucketWebsiteTarget(bucketWebsite))
});
Important: Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint.
HostedZone zone;
string ebsEnvironmentUrl;
new ARecord(this, "AliasRecord", new ARecordProps {
Zone = zone,
Target = RecordTarget.FromAlias(new ElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl))
});
See the documentation of aws-cdk-lib/aws-route53
for more information.
Classes
ApiGateway | Defines an API Gateway REST API as the alias target. Requires that the domain name will be defined through |
ApiGatewayDomain | Defines an API Gateway domain name as the alias target. |
ApiGatewayv2DomainProperties | Defines an API Gateway V2 domain name as the alias target. |
BucketWebsiteTarget | Use a S3 as an alias record target. |
ClassicLoadBalancerTarget | Use a classic ELB as an alias record target. |
CloudFrontTarget | Use a CloudFront Distribution as an alias record target. |
ElasticBeanstalkEnvironmentEndpointTarget | Use an Elastic Beanstalk environment URL as an alias record target. E.g. mysampleenvironment.xyz.us-east-1.elasticbeanstalk.com or mycustomcnameprefix.us-east-1.elasticbeanstalk.com. |
GlobalAcceleratorDomainTarget | Use a Global Accelerator domain name as an alias record target. |
GlobalAcceleratorTarget | Use a Global Accelerator instance domain name as an alias record target. |
InterfaceVpcEndpointTarget | Set an InterfaceVpcEndpoint as a target for an ARecord. |
LoadBalancerTarget | Use an ELBv2 as an alias record target. |
Route53RecordTarget | Use another Route 53 record as an alias record target. |
UserPoolDomainTarget | Use a user pool domain as an alias record target. |