Skip navigation links

Package software.amazon.awscdk.services.route53.targets

Route53 Alias Record Targets for the CDK Route53 Library

See: Description

Package software.amazon.awscdk.services.route53.targets Description

Route53 Alias Record Targets for the CDK Route53 Library

---

cdk-constructs: Stable


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.

 import software.amazon.awscdk.services.ec2.*;
 
 HostedZone zone;
 InterfaceVpcEndpoint interfaceVpcEndpoint;
 
 
 ARecord.Builder.create(this, "AliasRecord")
         .zone(zone)
         .target(RecordTarget.fromAlias(new InterfaceVpcEndpointTarget(interfaceVpcEndpoint)))
         .build();
 

Important: The Bucket name must strictly match the full DNS name. See the Developer Guide for more info.

 import software.amazon.awscdk.services.s3.*;
 
 
 String recordName = "www";
 String domainName = "example.com";
 
 Bucket bucketWebsite = Bucket.Builder.create(this, "BucketWebsite")
         .bucketName(List.of(recordName, domainName).join(".")) // www.example.com
         .publicReadAccess(true)
         .websiteIndexDocument("index.html")
         .build();
 
 IHostedZone zone = HostedZone.fromLookup(this, "Zone", HostedZoneProviderProps.builder().domainName(domainName).build()); // example.com
 
  // example.com
 ARecord.Builder.create(this, "AliasRecord")
         .zone(zone)
         .recordName(recordName) // www
         .target(RecordTarget.fromAlias(new BucketWebsiteTarget(bucketWebsite)))
         .build();
 

Important: Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint.

 HostedZone zone;
 String ebsEnvironmentUrl;
 
 
 ARecord.Builder.create(this, "AliasRecord")
         .zone(zone)
         .target(RecordTarget.fromAlias(new ElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl)))
         .build();
 

See the documentation of @aws-cdk/aws-route53 for more information.

Skip navigation links