MxRecord

class aws_cdk.aws_route53.MxRecord(scope, id, *, values, zone, comment=None, delete_existing=None, geo_location=None, multi_value_answer=None, record_name=None, region=None, set_identifier=None, ttl=None, weight=None)

Bases: RecordSet

A DNS MX record.

Resource:

AWS::Route53::RecordSet

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_route53 as route53

# geo_location: route53.GeoLocation
# hosted_zone: route53.HostedZone

mx_record = route53.MxRecord(self, "MyMxRecord",
    values=[route53.MxRecordValue(
        host_name="hostName",
        priority=123
    )],
    zone=hosted_zone,

    # the properties below are optional
    comment="comment",
    delete_existing=False,
    geo_location=geo_location,
    multi_value_answer=False,
    record_name="recordName",
    region="region",
    set_identifier="setIdentifier",
    ttl=cdk.Duration.minutes(30),
    weight=123
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • values (Sequence[Union[MxRecordValue, Dict[str, Any]]]) – The values.

  • 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

  • geo_location (Optional[GeoLocation]) – The geographical origin for this record to return DNS records based on the user’s location.

  • multi_value_answer (Optional[bool]) – Whether to return multiple values, such as IP addresses for your web servers, in response to DNS queries. Default: false

  • record_name (Optional[str]) – The subdomain name for this record. This should be relative to the zone root name. For example, if you want to create a record for acme.example.com, specify “acme”. You can also specify the fully qualified domain name which terminates with a “.”. For example, “acme.example.com.”. Default: zone root

  • region (Optional[str]) – The Amazon EC2 Region where you created the resource that this resource record set refers to. The resource typically is an AWS resource, such as an EC2 instance or an ELB load balancer, and is referred to by an IP address or a DNS domain name, depending on the record type. When Amazon Route 53 receives a DNS query for a domain name and type for which you have created latency resource record sets, Route 53 selects the latency resource record set that has the lowest latency between the end user and the associated Amazon EC2 Region. Route 53 then returns the value that is associated with the selected resource record set. Default: - Do not set latency based routing

  • set_identifier (Optional[str]) – A string used to distinguish between different records with the same combination of DNS name and type. It can only be set when either weight or geoLocation is defined. This parameter must be between 1 and 128 characters in length. Default: - Auto generated string

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

  • weight (Union[int, float, None]) – Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set. Route 53 calculates the sum of the weights for the resource record sets that have the same combination of DNS name and type. Route 53 then responds to queries based on the ratio of a resource’s weight to the total. This value can be a number between 0 and 255. Default: - Do not set weighted routing

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

domain_name

The domain name of the record.

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

node

The tree node.

stack

The stack in which this resource is defined.

Static Methods

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool