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
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,
});
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
)
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();
// 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
});
// 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
new CrossAccountZoneDelegationRecord(scope: Construct, id: string, props: CrossAccountZoneDelegationRecordProps)
CrossAccountZoneDelegationRecord(scope: Construct, id: str, props: CrossAccountZoneDelegationRecordProps)
new CrossAccountZoneDelegationRecord(Construct scope, String id, CrossAccountZoneDelegationRecordProps props)
new CrossAccountZoneDelegationRecord(Construct scope, string id, CrossAccountZoneDelegationRecordProps props)
NewCrossAccountZoneDelegationRecord(Scope Construct, Id *string, Props CrossAccountZoneDelegationRecordProps)
Construct Props
assumeRoleRegionoptionalstringassume_role_regionoptionalstrassumeRoleRegionoptionalStringAssumeRoleRegionoptionalstringAssumeRoleRegionoptional*string#Default: the Route53 signing region in the current partition
delegatedZoneIHostedZonedelegated_zoneIHostedZonedelegatedZoneIHostedZoneDelegatedZoneIHostedZoneDelegatedZoneIHostedZonerequired#delegationRoleIRoleRefdelegation_roleIRoleRefdelegationRoleIRoleRefDelegationRoleIRoleRefDelegationRoleIRoleRefrequired#parentHostedZoneIdoptionalstringparent_hosted_zone_idoptionalstrparentHostedZoneIdoptionalStringParentHostedZoneIdoptionalstringParentHostedZoneIdoptional*string#Default: no zone id
parentHostedZoneNameoptionalstringparent_hosted_zone_nameoptionalstrparentHostedZoneNameoptionalStringParentHostedZoneNameoptionalstringParentHostedZoneNameoptional*string#Default: no zone name
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy= RemovalPolicy.DESTROY#Properties
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#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#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#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