# Route53 Alias Record Targets for the CDK Route53 Library
<!--BEGIN STABILITY BANNER-->---
![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)
> AWS CDK v1 has reached End-of-Support on 2023-06-01.
> This package is no longer being updated, and users should migrate to AWS CDK v2.
>
> For more information on how to migrate, see the [*Migrating to AWS CDK v2* guide](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).
---
<!--END STABILITY BANNER-->
This library contains Route53 Alias Record targets for:
* API Gateway custom domains
```python
import aws_cdk.aws_apigateway as apigw
# zone: route53.HostedZone
# rest_api: apigw.LambdaRestApi
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.ApiGateway(rest_api))
)
```
* API Gateway V2 custom domains
```python
import aws_cdk.aws_apigatewayv2 as apigwv2
# zone: route53.HostedZone
# domain_name: apigwv2.DomainName
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.ApiGatewayv2DomainProperties(domain_name.regional_domain_name, domain_name.regional_hosted_zone_id))
)
```
* CloudFront distributions
```python
import aws_cdk.aws_cloudfront as cloudfront
# zone: route53.HostedZone
# distribution: cloudfront.CloudFrontWebDistribution
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.CloudFrontTarget(distribution))
)
```
* ELBv2 load balancers
```python
import aws_cdk.aws_elasticloadbalancingv2 as elbv2
# zone: route53.HostedZone
# lb: elbv2.ApplicationLoadBalancer
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.LoadBalancerTarget(lb))
)
```
* Classic load balancers
```python
import aws_cdk.aws_elasticloadbalancing as elb
# zone: route53.HostedZone
# lb: elb.LoadBalancer
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.ClassicLoadBalancerTarget(lb))
)
```
**Important:** Based on [AWS documentation](https://aws.amazon.com/de/premiumsupport/knowledge-center/alias-resource-record-set-route53-cli/), 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`.
* GlobalAccelerator
```python
import aws_cdk.aws_globalaccelerator as globalaccelerator
# zone: route53.HostedZone
# accelerator: globalaccelerator.Accelerator
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.GlobalAcceleratorTarget(accelerator))
)
```
**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](https://docs.aws.amazon.com/global-accelerator/latest/dg/dns-addressing-custom-domains.dns-addressing.html) with Global Accelerator for more info.
* InterfaceVpcEndpoints
**Important:** Based on the CFN docs for VPCEndpoints - [see here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#aws-resource-ec2-vpcendpoint-return-values) - 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.
```python
import aws_cdk.aws_ec2 as ec2
# zone: route53.HostedZone
# interface_vpc_endpoint: ec2.InterfaceVpcEndpoint
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.InterfaceVpcEndpointTarget(interface_vpc_endpoint))
)
```
* S3 Bucket Website:
**Important:** The Bucket name must strictly match the full DNS name.
See [the Developer Guide](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) for more info.
```python
import aws_cdk.aws_s3 as s3
record_name = "www"
domain_name = "example.com"
bucket_website = s3.Bucket(self, "BucketWebsite",
bucket_name=[record_name, domain_name].join("."), # www.example.com
public_read_access=True,
website_index_document="index.html"
)
zone = route53.HostedZone.from_lookup(self, "Zone", domain_name=domain_name) # example.com
route53.ARecord(self, "AliasRecord",
zone=zone,
record_name=record_name, # www
target=route53.RecordTarget.from_alias(targets.BucketWebsiteTarget(bucket_website))
)
```
* User pool domain
```python
import aws_cdk.aws_cognito as cognito
# zone: route53.HostedZone
# domain: cognito.UserPoolDomain
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.UserPoolDomainTarget(domain))
)
```
* Route 53 record
```python
# zone: route53.HostedZone
# record: route53.ARecord
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.Route53RecordTarget(record))
)
```
* Elastic Beanstalk environment:
**Important:** Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint.
```python
# zone: route53.HostedZone
# ebs_environment_url: str
route53.ARecord(self, "AliasRecord",
zone=zone,
target=route53.RecordTarget.from_alias(targets.ElasticBeanstalkEnvironmentEndpointTarget(ebs_environment_url))
)
```
See the documentation of `@aws-cdk/aws-route53` for more information.
Raw data
{
"_id": null,
"home_page": "https://github.com/aws/aws-cdk",
"name": "aws-cdk.aws-route53-targets",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Amazon Web Services",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/27/a0/6cfe2ea84000bfd5ca9105cec38859a4f07a55cf7a82165540e38d523bbd/aws-cdk.aws-route53-targets-1.204.0.tar.gz",
"platform": null,
"description": "# Route53 Alias Record Targets for the CDK Route53 Library\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)\n\n> AWS CDK v1 has reached End-of-Support on 2023-06-01.\n> This package is no longer being updated, and users should migrate to AWS CDK v2.\n>\n> For more information on how to migrate, see the [*Migrating to AWS CDK v2* guide](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).\n\n---\n<!--END STABILITY BANNER-->\n\nThis library contains Route53 Alias Record targets for:\n\n* API Gateway custom domains\n\n ```python\n import aws_cdk.aws_apigateway as apigw\n\n # zone: route53.HostedZone\n # rest_api: apigw.LambdaRestApi\n\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.ApiGateway(rest_api))\n )\n ```\n* API Gateway V2 custom domains\n\n ```python\n import aws_cdk.aws_apigatewayv2 as apigwv2\n\n # zone: route53.HostedZone\n # domain_name: apigwv2.DomainName\n\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.ApiGatewayv2DomainProperties(domain_name.regional_domain_name, domain_name.regional_hosted_zone_id))\n )\n ```\n* CloudFront distributions\n\n ```python\n import aws_cdk.aws_cloudfront as cloudfront\n\n # zone: route53.HostedZone\n # distribution: cloudfront.CloudFrontWebDistribution\n\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.CloudFrontTarget(distribution))\n )\n ```\n* ELBv2 load balancers\n\n ```python\n import aws_cdk.aws_elasticloadbalancingv2 as elbv2\n\n # zone: route53.HostedZone\n # lb: elbv2.ApplicationLoadBalancer\n\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.LoadBalancerTarget(lb))\n )\n ```\n* Classic load balancers\n\n ```python\n import aws_cdk.aws_elasticloadbalancing as elb\n\n # zone: route53.HostedZone\n # lb: elb.LoadBalancer\n\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.ClassicLoadBalancerTarget(lb))\n )\n ```\n\n**Important:** Based on [AWS documentation](https://aws.amazon.com/de/premiumsupport/knowledge-center/alias-resource-record-set-route53-cli/), 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).\n\nFor 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`.\n\n* GlobalAccelerator\n\n ```python\n import aws_cdk.aws_globalaccelerator as globalaccelerator\n\n # zone: route53.HostedZone\n # accelerator: globalaccelerator.Accelerator\n\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.GlobalAcceleratorTarget(accelerator))\n )\n ```\n\n**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.\nSee [the documentation on DNS addressing](https://docs.aws.amazon.com/global-accelerator/latest/dg/dns-addressing-custom-domains.dns-addressing.html) with Global Accelerator for more info.\n\n* InterfaceVpcEndpoints\n\n**Important:** Based on the CFN docs for VPCEndpoints - [see here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#aws-resource-ec2-vpcendpoint-return-values) - 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.\n\n```python\nimport aws_cdk.aws_ec2 as ec2\n\n# zone: route53.HostedZone\n# interface_vpc_endpoint: ec2.InterfaceVpcEndpoint\n\n\nroute53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.InterfaceVpcEndpointTarget(interface_vpc_endpoint))\n)\n```\n\n* S3 Bucket Website:\n\n**Important:** The Bucket name must strictly match the full DNS name.\nSee [the Developer Guide](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) for more info.\n\n```python\nimport aws_cdk.aws_s3 as s3\n\n\nrecord_name = \"www\"\ndomain_name = \"example.com\"\n\nbucket_website = s3.Bucket(self, \"BucketWebsite\",\n bucket_name=[record_name, domain_name].join(\".\"), # www.example.com\n public_read_access=True,\n website_index_document=\"index.html\"\n)\n\nzone = route53.HostedZone.from_lookup(self, \"Zone\", domain_name=domain_name) # example.com\n\nroute53.ARecord(self, \"AliasRecord\",\n zone=zone,\n record_name=record_name, # www\n target=route53.RecordTarget.from_alias(targets.BucketWebsiteTarget(bucket_website))\n)\n```\n\n* User pool domain\n\n ```python\n import aws_cdk.aws_cognito as cognito\n\n # zone: route53.HostedZone\n # domain: cognito.UserPoolDomain\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.UserPoolDomainTarget(domain))\n )\n ```\n* Route 53 record\n\n ```python\n # zone: route53.HostedZone\n # record: route53.ARecord\n\n route53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.Route53RecordTarget(record))\n )\n ```\n* Elastic Beanstalk environment:\n\n**Important:** Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint.\n\n```python\n# zone: route53.HostedZone\n# ebs_environment_url: str\n\n\nroute53.ARecord(self, \"AliasRecord\",\n zone=zone,\n target=route53.RecordTarget.from_alias(targets.ElasticBeanstalkEnvironmentEndpointTarget(ebs_environment_url))\n)\n```\n\nSee the documentation of `@aws-cdk/aws-route53` for more information.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "The CDK Construct Library for AWS Route53 Alias Targets",
"version": "1.204.0",
"project_urls": {
"Homepage": "https://github.com/aws/aws-cdk",
"Source": "https://github.com/aws/aws-cdk.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "21f8720e57afcec84564502c0de8491b0660693b9b22965ddf267bf253134729",
"md5": "ec0db94399f11f4f0e678ba5e6637d93",
"sha256": "03b80d91c0c126b9ad5bd1d7932cba67dce8a51f5b712253db832ccd37887d6d"
},
"downloads": -1,
"filename": "aws_cdk.aws_route53_targets-1.204.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ec0db94399f11f4f0e678ba5e6637d93",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.7",
"size": 50984,
"upload_time": "2023-06-19T21:00:46",
"upload_time_iso_8601": "2023-06-19T21:00:46.352769Z",
"url": "https://files.pythonhosted.org/packages/21/f8/720e57afcec84564502c0de8491b0660693b9b22965ddf267bf253134729/aws_cdk.aws_route53_targets-1.204.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "27a06cfe2ea84000bfd5ca9105cec38859a4f07a55cf7a82165540e38d523bbd",
"md5": "c5f6c29a5acc777faa6ce4061a8b7578",
"sha256": "5dff60a948cd8947fe235eacc3e0d7c49264b33f33c944f990eb8ac0140e5995"
},
"downloads": -1,
"filename": "aws-cdk.aws-route53-targets-1.204.0.tar.gz",
"has_sig": false,
"md5_digest": "c5f6c29a5acc777faa6ce4061a8b7578",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.7",
"size": 52443,
"upload_time": "2023-06-19T21:07:01",
"upload_time_iso_8601": "2023-06-19T21:07:01.413332Z",
"url": "https://files.pythonhosted.org/packages/27/a0/6cfe2ea84000bfd5ca9105cec38859a4f07a55cf7a82165540e38d523bbd/aws-cdk.aws-route53-targets-1.204.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-19 21:07:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aws",
"github_project": "aws-cdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aws-cdk.aws-route53-targets"
}