BucketWebsiteTarget

class aws_cdk.aws_route53_targets.BucketWebsiteTarget(bucket)

Bases: object

Use a S3 as an alias record target.

ExampleMetadata:

infused

Example:

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))
)
Parameters:

bucket (IBucket) –

Methods

bind(_record, _zone=None)

Return hosted zone ID and DNS name, usable for Route53 alias targets.

Parameters:
Return type:

AliasRecordTargetConfig