15 types
This library contains Route53 Alias Record targets for:
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
rest_api = nil # AWSCDK::APIGateway::LambdaRestAPI
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(AWSCDK::Route53Targets::APIGateway.new(rest_api)),
})
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
domain_name = nil # AWSCDK::APIGatewayv2::DomainName
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(AWSCDK::Route53Targets::APIGatewayv2DomainProperties.new(domain_name.regional_domain_name, domain_name.regional_hosted_zone_id)),
})
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
graphql_api = nil # AWSCDK::AppSync::GraphqlAPI
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(AWSCDK::Route53Targets::AppSyncTarget.new(graphql_api)),
})
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
distribution = nil # AWSCDK::CloudFront::CloudFrontWebDistribution
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(AWSCDK::Route53Targets::CloudFrontTarget.new(distribution)),
})
By providing optional properties, you can specify whether to evaluate target health.
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
lb = nil # AWSCDK::ElasticLoadBalancingv2::ApplicationLoadBalancer
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(
AWSCDK::Route53Targets::LoadBalancerTarget.new(lb, {
evaluate_target_health: true,
})),
})
By providing optional properties, you can specify whether to evaluate target health.
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
lb = nil # AWSCDK::ElasticLoadBalancing::LoadBalancer
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(
AWSCDK::Route53Targets::ClassicLoadBalancerTarget.new(lb, {
evaluate_target_health: true,
})),
})
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.
By providing optional properties, you can specify whether to evaluate target health.
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
accelerator = nil # AWSCDK::GlobalAccelerator::Accelerator
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(
AWSCDK::Route53Targets::GlobalAcceleratorTarget.new(accelerator, {
evaluate_target_health: true,
})),
})
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.
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
interface_vpc_endpoint = nil # AWSCDK::EC2::InterfaceVPCEndpoint
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(AWSCDK::Route53Targets::InterfaceVPCEndpointTarget.new(interface_vpc_endpoint)),
})
Important: The Bucket name must strictly match the full DNS name. See the Developer Guide for more info.
By providing optional properties, you can specify whether to evaluate target health.
require 'aws-cdk-lib'
record_name = "www"
domain_name = "example.com"
bucket_website = AWSCDK::S3::Bucket.new(self, "BucketWebsite", {
bucket_name: [record_name, domain_name].join("."),
# www.example.com
public_read_access: true,
website_index_document: "index.html",
})
zone = AWSCDK::Route53::HostedZone.from_lookup(self, "Zone", {domain_name: domain_name}) # example.com
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
record_name: record_name,
# www
target: AWSCDK::Route53::RecordTarget.from_alias(
AWSCDK::Route53Targets::BucketWebsiteTarget.new(bucket_website, {
evaluate_target_health: true,
})),
})
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
domain = nil # AWSCDK::Cognito::UserPoolDomain
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(AWSCDK::Route53Targets::UserPoolDomainTarget.new(domain)),
})
zone = nil # AWSCDK::Route53::HostedZone
record = nil # AWSCDK::Route53::ARecord
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(AWSCDK::Route53Targets::Route53RecordTarget.new(record)),
})
Important: Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint.
By providing optional properties, you can specify whether to evaluate target health.
zone = nil # AWSCDK::Route53::HostedZone
ebs_environment_url = nil
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(
AWSCDK::Route53Targets::ElasticBeanstalkEnvironmentEndpointTarget.new(ebs_environment_url, {
evaluate_target_health: true,
})),
})
If Elastic Beanstalk environment URL is not available at synth time, you can specify Hosted Zone ID of the target
require 'aws-cdk-lib'
zone = nil # AWSCDK::Route53::HostedZone
ebs_environment_url = nil
AWSCDK::Route53::ARecord.new(self, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(
AWSCDK::Route53Targets::ElasticBeanstalkEnvironmentEndpointTarget.new(ebs_environment_url, {
hosted_zone_id: AWSCDK::RegionInfo::RegionInfo.get("us-east-1").ebs_env_endpoint_hosted_zone_id,
})),
})
Or you can specify Stack region for CDK to generate the correct Hosted Zone ID.
require 'aws-cdk-lib'
app = nil # AWSCDK::App
zone = nil # AWSCDK::Route53::HostedZone
ebs_environment_url = nil
stack = AWSCDK::Stack.new(app, "my-stack", {
env: {
region: "us-east-1",
},
})
AWSCDK::Route53::ARecord.new(stack, "AliasRecord", {
zone: zone,
target: AWSCDK::Route53::RecordTarget.from_alias(
AWSCDK::Route53Targets::ElasticBeanstalkEnvironmentEndpointTarget.new(ebs_environment_url)),
})
See the documentation of aws-cdk-lib/aws-route53 for more information.