[英]Provide cross account delegation from Route53
我有一个持有我的 Route53 父区域 (example.com) 的 AWS 账户,我正在尝试创建一个子域 (beta.example.com) 和 (prod.example.com)。 阅读文档后,我意识到我需要在我的每个子域帐户中创建一个 CrossAcountDelegationRole。 为此,我添加了以下内容:
//CDK Package for Parent Domain:
this.crossDelegationRole= new Role(this, 'CrossAccountRole', {
// The role name must be predictable
roleName: 'MyDelegationRole',
// The other account
assumedBy: new CompositePrincipal(new AccountPrincipal('Account A#'), new AccountPrincipal('Account B#')),
});
//CDK Package for Subdomain accounts:
const delegationRoleArn = Stack.of(this).formatArn({
region: '', // IAM is global in each partition
service: 'iam',
account: 'Parent Account #',
resource: 'role',
resourceName: 'MyDelegationRole',
});
const delegationRole = Role.fromRoleArn(this, 'DelegationRole', delegationRoleArn);
// create the record
const x =new CrossAccountZoneDelegationRecord(this, 'delegate', {
delegatedZone: this.hostedZone,
parentHostedZoneName: 'example.com', // or you can use parentHostedZoneId
delegationRole,
});
将其部署到我的 cloudformation 后,我收到一条错误消息:
Received response status [FAILED] from custom resource. Message returned: AccessDenied: User: arn:aws:sts::ParentAccount#:assumed-role/MyDelegationRole/cross-account-zone-delegation-1675020358038 is not authorized to perform: route53:ListHostedZonesByName because no identity-based policy allows the route53:ListHostedZonesByName action at Request.extractError (/var/runtime/node_modules/aws-
有什么我想念的吗?
更新 1:我认为这是因为虽然我正在创建角色,但我没有给我的角色任何权限。 我需要为 crossDelegationRole 提供一些权限。 我不确定如何授予它对我的 hostedZone 的权限(它不是公共托管区域,只是一个 hostedZone,所以我不能执行parentZone.grantDelegation(crossAccountRole);
命令)
私有托管区域无法进行跨账户区域委派。 这就是为什么只有PublicHostedZone
构造具有grantDelegation
方法,这正是您所缺少的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.