HostedZoneProviderProps

class aws_cdk.aws_route53.HostedZoneProviderProps(*, domain_name, private_zone=None, vpc_id=None)

Bases: object

Zone properties for looking up the Hosted Zone.

Parameters:
  • domain_name (str) – The zone domain e.g. example.com.

  • private_zone (Optional[bool]) – Whether the zone that is being looked up is a private hosted zone. Default: false

  • vpc_id (Optional[str]) – Specifies the ID of the VPC associated with a private hosted zone. If a VPC ID is provided and privateZone is false, no results will be returned and an error will be raised Default: - No VPC ID

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

Attributes

domain_name

The zone domain e.g. example.com.

private_zone

Whether the zone that is being looked up is a private hosted zone.

Default:

false

vpc_id

Specifies the ID of the VPC associated with a private hosted zone.

If a VPC ID is provided and privateZone is false, no results will be returned and an error will be raised

Default:
  • No VPC ID