CnameRecordProps

class aws_cdk.aws_route53.CnameRecordProps(*, zone, comment=None, record_name=None, ttl=None, domain_name)

Bases: RecordSetOptions

Construction properties for a CnameRecord.

Parameters:
  • zone (IHostedZone) – The hosted zone in which to define the new record.

  • comment (Optional[str]) – A comment to add on the record. Default: no comment

  • record_name (Optional[str]) – The domain name for this record. Default: zone root

  • ttl (Optional[Duration]) – The resource record cache time to live (TTL). Default: Duration.minutes(30)

  • domain_name (str) – The domain name.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_certificatemanager as acm
import aws_cdk.aws_route53 as route53

# hosted zone and route53 features
# hosted_zone_id: str
zone_name = "example.com"


my_domain_name = "api.example.com"
certificate = acm.Certificate(self, "cert", domain_name=my_domain_name)
api = appsync.GraphqlApi(self, "api",
    name="myApi",
    domain_name=appsync.DomainOptions(
        certificate=certificate,
        domain_name=my_domain_name
    )
)

# hosted zone for adding appsync domain
zone = route53.HostedZone.from_hosted_zone_attributes(self, "HostedZone",
    hosted_zone_id=hosted_zone_id,
    zone_name=zone_name
)

# create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
route53.CnameRecord(self, "CnameApiRecord",
    record_name="api",
    zone=zone,
    domain_name=my_domain_name
)

Attributes

comment

A comment to add on the record.

Default:

no comment

domain_name

The domain name.

record_name

The domain name for this record.

Default:

zone root

ttl

The resource record cache time to live (TTL).

Default:

Duration.minutes(30)

zone

The hosted zone in which to define the new record.