Registry / aws / aws-cdk-aws-route53-targets

aws-cdk-aws-route53-targets

JSON →
library1.204.0pypypiunverified

The `aws-cdk-aws-route53-targets` library provides AWS CDK constructs for creating Route53 Alias records that point to various AWS resources like S3 static websites, CloudFront distributions, API Gateway custom domains, and Elastic Load Balancers. It extends `aws-cdk.aws-route53` by offering convenient alias targets. This specific package (version 1.x.x) is designed for AWS CDK v1 applications. AWS CDK follows a monthly release cadence, aligning with new AWS service features and updates.

pip install aws-cdk-aws-route53-targets
INSTALL
IMPORT
SIG · AWS-CDK-AWS-ROUTE5
A
aws-cdk-aws-route53-targets
awspythonv1.204.0
Install
8.9s avg
Import
Disk
78MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 74.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 8.9s · import 0.000s · 75MB
78MB installed
● package 78MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

S3BucketWebsiteTarget
from aws_cdk.aws_route53_targets import S3BucketWebsiteTarget
from aws_cdk.aws_route53_targets import S3BucketWebsiteTarget

This example demonstrates how to create an AWS CDK application (for CDK v1) that provisions an S3 static website and then creates an AWS Route53 A-alias record pointing to that S3 bucket. It utilizes the `S3BucketWebsiteTarget` from the `aws-cdk-aws-route53-targets` library to simplify the alias configuration. Remember to replace `myexampledomain.com` with your own registered domain name for actual deployment.

import os from aws_cdk import App, Stack, Duration from aws_cdk import aws_s3 as s3 from aws_cdk import aws_route53 as route53 from aws_cdk.aws_route53_targets import S3BucketWebsiteTarget # This is the key import for this library class MyRoute53Stack(Stack): def __init__(self, scope, id, **kwargs): super().__init__(scope, id, **kwargs) # In a real scenario, you'd import an existing Hosted Zone: # hosted_zone = route53.HostedZone.from_lookup(self, "MyZone", domain_name="example.com") # For a runnable example, we'll create a dummy one (will create a Route 53 zone). # Replace 'myexampledomain.com' with your actual domain name. hosted_zone = route53.HostedZone(self, "MyZone", zone_name="myexampledomain.com" ) # Create an S3 bucket configured for static website hosting website_bucket = s3.Bucket(self, "WebsiteBucket", bucket_name="www.myexampledomain.com", # Must match the domain for S3 website hosting website_index_document="index.html", public_read_access=True # Required for public website hosting ) # Create an A record pointing to the S3 bucket website using S3BucketWebsiteTarget route53.ARecord(self, "WebsiteAliasRecord", zone=hosted_zone, target=route53.RecordTarget.from_alias(S3BucketWebsiteTarget(website_bucket)), record_name="www" # This will create 'www.myexampledomain.com' ) app = App() MyRoute53Stack(app, "MyRoute53Stack") app.synth()
Debug
Known issues
breakingThis `aws-cdk-aws-route53-targets` package is for AWS CDK v1 ONLY. For AWS CDK v2, all alias targets are integrated directly into the `aws-cdk-lib.aws_route53` module. Do NOT install this package if you are using CDK v2 (`aws-cdk-lib`).
fix
Migrate to CDK v2 and use `from aws_cdk.aws_route53 import S3BucketWebsiteTarget` (or similar) directly, without installing `aws-cdk-aws-route53-targets`.
affects: CDK v2 (2.x.x) users
gotchaThe target resource (e.g., S3 bucket) must be configured correctly for the alias target to work. For `S3BucketWebsiteTarget`, the S3 bucket must have static website hosting enabled and be publicly accessible. For `CloudFrontTarget`, the distribution must be deployed.
fix
Ensure the underlying AWS resource referenced by the target is properly configured and provisioned according to its service's requirements (e.g., `website_index_document`, `public_read_access` for S3).
affects: All v1 versions
gotchaWhen creating records, always use `route53.RecordTarget.from_alias()` with a target from this library. Directly assigning a raw construct will likely result in an error or an incorrect record type.
fix
Wrap your target object: `target=route53.RecordTarget.from_alias(MySpecificTarget(resource))`.
affects: All v1 versions
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk.corerequiredCore AWS CDK constructs and application lifecycle.
aws-cdk.aws-route53requiredBase constructs for AWS Route53 resources.
aws-cdk.aws-s3optionalRequired for S3BucketWebsiteTarget examples.
aws-cdk.aws-cloudfrontoptionalRequired for CloudFrontTarget examples.
Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
aws-cdk-aws-route53-targets — pip install aws-cdk-aws-route53-targets · libregistry