Skip to content
v2.275.0

CrossAccountZoneDelegationRecord ​

A Cross Account Zone Delegation record.

This construct uses custom resource lambda that calls Route53 ChangeResourceRecordSets API to upsert a NS record into the parentHostedZone.

WARNING: The default removal policy of this resource is DESTROY, therefore, if this resource's logical ID changes or if this resource is removed from the stack, the existing NS record will be removed.

Example ​

ts
const subZone = new route53.PublicHostedZone(this, 'SubZone', {
  zoneName: 'sub.someexample.com',
});

// import the delegation role by constructing the roleArn
const delegationRoleArn = Stack.of(this).formatArn({
  region: '', // IAM is global in each partition
  service: 'iam',
  account: 'parent-account-id',
  resource: 'role',
  resourceName: 'MyDelegationRole',
});
const delegationRole = iam.Role.fromRoleArn(this, 'DelegationRole', delegationRoleArn);

// create the record
new route53.CrossAccountZoneDelegationRecord(this, 'delegate', {
  delegatedZone: subZone,
  parentHostedZoneName: 'someexample.com', // or you can use parentHostedZoneId
  delegationRole,
});
python
sub_zone = route53.PublicHostedZone(self, "SubZone",
    zone_name="sub.someexample.com"
)

# import the delegation role by constructing the roleArn
delegation_role_arn = Stack.of(self).format_arn(
    region="",  # IAM is global in each partition
    service="iam",
    account="parent-account-id",
    resource="role",
    resource_name="MyDelegationRole"
)
delegation_role = iam.Role.from_role_arn(self, "DelegationRole", delegation_role_arn)

# create the record
route53.CrossAccountZoneDelegationRecord(self, "delegate",
    delegated_zone=sub_zone,
    parent_hosted_zone_name="someexample.com",  # or you can use parentHostedZoneId
    delegation_role=delegation_role
)
java
PublicHostedZone subZone = PublicHostedZone.Builder.create(this, "SubZone")
        .zoneName("sub.someexample.com")
        .build();

// import the delegation role by constructing the roleArn
String delegationRoleArn = Stack.of(this).formatArn(ArnComponents.builder()
        .region("") // IAM is global in each partition
        .service("iam")
        .account("parent-account-id")
        .resource("role")
        .resourceName("MyDelegationRole")
        .build());
IRole delegationRole = Role.fromRoleArn(this, "DelegationRole", delegationRoleArn);

// create the record
// create the record
CrossAccountZoneDelegationRecord.Builder.create(this, "delegate")
        .delegatedZone(subZone)
        .parentHostedZoneName("someexample.com") // or you can use parentHostedZoneId
        .delegationRole(delegationRole)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var subZone = new PublicHostedZone(this, "SubZone", new PublicHostedZoneProps {
    ZoneName = "sub.someexample.com"
});

// import the delegation role by constructing the roleArn
var delegationRoleArn = Stack.Of(this).FormatArn(new ArnComponents {
    Region = "",  // IAM is global in each partition
    Service = "iam",
    Account = "parent-account-id",
    Resource = "role",
    ResourceName = "MyDelegationRole"
});
var delegationRole = Role.FromRoleArn(this, "DelegationRole", delegationRoleArn);

// create the record
// create the record
new CrossAccountZoneDelegationRecord(this, "delegate", new CrossAccountZoneDelegationRecordProps {
    DelegatedZone = subZone,
    ParentHostedZoneName = "someexample.com",  // or you can use parentHostedZoneId
    DelegationRole = delegationRole
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
subZone := route53.NewPublicHostedZone(this, jsii.String("SubZone"), &PublicHostedZoneProps{
	ZoneName: jsii.String("sub.someexample.com"),
})

// import the delegation role by constructing the roleArn
delegationRoleArn := awscdk.stack_Of(this).FormatArn(&ArnComponents{
	Region: jsii.String(""),
	 // IAM is global in each partition
	Service: jsii.String("iam"),
	Account: jsii.String("parent-account-id"),
	Resource: jsii.String("role"),
	ResourceName: jsii.String("MyDelegationRole"),
})
delegationRole := iam.Role_FromRoleArn(this, jsii.String("DelegationRole"), delegationRoleArn)

// create the record
// create the record
route53.NewCrossAccountZoneDelegationRecord(this, jsii.String("delegate"), &CrossAccountZoneDelegationRecordProps{
	DelegatedZone: subZone,
	ParentHostedZoneName: jsii.String("someexample.com"),
	 // or you can use parentHostedZoneId
	DelegationRole: DelegationRole,
})

Initializer ​

ts
new CrossAccountZoneDelegationRecord(scope: Construct, id: string, props: CrossAccountZoneDelegationRecordProps)
python
CrossAccountZoneDelegationRecord(scope: Construct, id: str, props: CrossAccountZoneDelegationRecordProps)
java
new CrossAccountZoneDelegationRecord(Construct scope, String id, CrossAccountZoneDelegationRecordProps props)
csharp
new CrossAccountZoneDelegationRecord(Construct scope, string id, CrossAccountZoneDelegationRecordProps props)
go
NewCrossAccountZoneDelegationRecord(Scope Construct, Id *string, Props CrossAccountZoneDelegationRecordProps)

Construct Props ​

assumeRoleRegionoptionalstringassume_role_regionoptionalstrassumeRoleRegionoptionalStringAssumeRoleRegionoptionalstringAssumeRoleRegionoptional*string#
Region from which to obtain temporary credentials.

Default: the Route53 signing region in the current partition

delegatedZoneIHostedZonedelegated_zoneIHostedZonedelegatedZoneIHostedZoneDelegatedZoneIHostedZoneDelegatedZoneIHostedZonerequired#
The zone to be delegated.
delegationRoleIRoleRefdelegation_roleIRoleRefdelegationRoleIRoleRefDelegationRoleIRoleRefDelegationRoleIRoleRefrequired#
The delegation role in the parent account.
parentHostedZoneIdoptionalstringparent_hosted_zone_idoptionalstrparentHostedZoneIdoptionalStringParentHostedZoneIdoptionalstringParentHostedZoneIdoptional*string#
The hosted zone id in the parent account.

Default: no zone id

parentHostedZoneNameoptionalstringparent_hosted_zone_nameoptionalstrparentHostedZoneNameoptionalStringParentHostedZoneNameoptionalstringParentHostedZoneNameoptional*string#
The hosted zone name in the parent account.

Default: no zone name

removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy= RemovalPolicy.DESTROY#
The removal policy to apply to the record set.
ttloptionalDurationttloptionalDurationttloptionalDurationTtloptionalDurationTtloptionalDuration= Duration.days(2)#
The resource record cache time to live (TTL).

Properties ​

nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.

Methods ​

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

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

  • xxxxX — Any object.

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

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining