Route53 Alias Record Targets for the CDK Route53 LibraryΒΆ

--- ![Stability: Stable](https://img.shields.io/badge/stability-Stable-success.svg?style=for-the-badge) ---

This library contains Route53 Alias Record targets for:

  • API Gateway custom domains

    # Example automatically generated. See https://github.com/aws/jsii/issues/826
    route53.ARecord(self, "AliasRecord",
        zone=zone,
        target=route53.RecordTarget.from_alias(alias.ApiGateway(rest_api))
    )
    
  • CloudFront distributions

    # Example automatically generated. See https://github.com/aws/jsii/issues/826
    route53.ARecord(self, "AliasRecord",
        zone=zone,
        target=route53.RecordTarget.from_alias(alias.CloudFrontTarget(distribution))
    )
    
  • ELBv2 load balancers

    # Example automatically generated. See https://github.com/aws/jsii/issues/826
    route53.ARecord(self, "AliasRecord",
        zone=zone,
        target=route53.RecordTarget.from_alias(alias.LoadBalancerTarget(elbv2))
    )
    
  • Classic load balancers

    # Example automatically generated. See https://github.com/aws/jsii/issues/826
    route53.ARecord(self, "AliasRecord",
        zone=zone,
        target=route53.RecordTarget.from_alias(alias.ClassicLoadBalancerTarget(elb))
    )
    
  • S3 Bucket WebSite:

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

# Example automatically generated. See https://github.com/aws/jsii/issues/826
[recordName, domainName] = ["www", "example.com"]

bucket_website = Bucket(self, "BucketWebsite",
    bucket_name=[record_name, domain_name].join("."), # www.example.com
    public_read_access=True,
    website_index_document="index.html"
)

zone = 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(alias.BucketWebsiteTarget(bucket))
)

(Need help translating TypeScript to Python?)

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