CnameRecordProps

class aws_cdk.aws_route53.CnameRecordProps(*, zone, comment=None, delete_existing=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

  • delete_existing (Optional[bool]) – Whether to delete the same record set in the hosted zone if it already exists (dangerous!). This allows to deploy a new record set while minimizing the downtime because the new record set will be created immediately after the existing one is deleted. It also avoids “manual” actions to delete existing record sets. .. epigraph:: N.B.: this feature is dangerous, use with caution! It can only be used safely when deleteExisting is set to true as soon as the resource is added to the stack. Changing an existing Record Set’s deleteExisting property from false -> true after deployment will delete the record! Default: false

  • 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)
schema = appsync.SchemaFile(file_path="mySchemaFile")
api = appsync.GraphqlApi(self, "api",
    name="myApi",
    schema=schema,
    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=api.app_sync_domain_name
)

Attributes

comment

A comment to add on the record.

Default:

no comment

delete_existing

Whether to delete the same record set in the hosted zone if it already exists (dangerous!).

This allows to deploy a new record set while minimizing the downtime because the new record set will be created immediately after the existing one is deleted. It also avoids “manual” actions to delete existing record sets. .. epigraph:

**N.B.:** this feature is dangerous, use with caution! It can only be used safely when
``deleteExisting`` is set to ``true`` as soon as the resource is added to the stack. Changing
an existing Record Set's ``deleteExisting`` property from ``false -> true`` after deployment
will delete the record!
Default:

false

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.