class TxtRecord (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Route53.TxtRecord |
Java | software.amazon.awscdk.services.route53.TxtRecord |
Python | aws_cdk.aws_route53.TxtRecord |
TypeScript (source) | @aws-cdk/aws-route53 » TxtRecord |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IRecord
A DNS TXT record.
Example
import * as route53 from '@aws-cdk/aws-route53';
const verifyDomainIdentity = new cr.AwsCustomResource(this, 'VerifyDomainIdentity', {
onCreate: {
service: 'SES',
action: 'verifyDomainIdentity',
parameters: {
Domain: 'example.com',
},
physicalResourceId: cr.PhysicalResourceId.fromResponse('VerificationToken'), // Use the token returned by the call as physical id
},
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
}),
});
declare const zone: route53.HostedZone;
new route53.TxtRecord(this, 'SESVerificationRecord', {
zone,
recordName: `_amazonses.example.com`,
values: [verifyDomainIdentity.getResponseField('VerificationToken')],
});
Initializer
new TxtRecord(scope: Construct, id: string, props: TxtRecordProps)
Parameters
- scope
Construct
- id
string
- props
Txt
Record Props
Construct Props
Name | Type | Description |
---|---|---|
values | string[] | The text values. |
zone | IHosted | The hosted zone in which to define the new record. |
comment? | string | A comment to add on the record. |
record | string | The domain name for this record. |
ttl? | Duration | The resource record cache time to live (TTL). |
values
Type:
string[]
The text values.
zone
Type:
IHosted
The hosted zone in which to define the new record.
comment?
Type:
string
(optional, default: no comment)
A comment to add on the record.
recordName?
Type:
string
(optional, default: zone root)
The domain name for this record.
ttl?
Type:
Duration
(optional, default: Duration.minutes(30))
The resource record cache time to live (TTL).
Properties
Name | Type | Description |
---|---|---|
domain | string | The domain name of the record. |
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
stack | Stack | The stack in which this resource is defined. |
domainName
Type:
string
The domain name of the record.
env
Type:
Resource
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
Type:
Construct
The construct tree node associated with this construct.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
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
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.