作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在两个 AWS 账户之间创建共享托管区域。
从账户 B 中,我使用以下内容创建了 vpc 关联授权:(Lambda-B)
response = self.route53.create_vpc_association_authorization(
HostedZoneId=<Hosted Zone Id>,
VPC={
'VPCRegion': <Region>,
'VPCId': <VPC of Account-A>
}
)
然后我尝试从帐户 A 接受它。 ( lambda -A)
response = self.route53.associate_vpc_with_hosted_zone(
HostedZoneId=<Hosted Zone Id>,
VPC={
'VPCRegion': <Region>,
'VPCId': <VPC of Account-A>
}
)
我已将具有以下策略的角色附加到 Lambda-A
AcceptHostedZoneAssociationRolePolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: AcceptHostedZoneAssociationRolePolicy
Roles:
- Ref: AcceptHostedZoneAssociationRole
PolicyDocument:
Statement:
- Sid: AssociateDisassociateVPCFromHostedZone
Action:
- lambda:*
- logs:*
- s3:*
- iam:PassRole
- ec2:DescribeVpcs
- route53:AssociateVPCWithHostedZone
- route53:DisassociateVPCFromHostedZone
Effect: Allow
Resource: "*"
通过 CF 执行 Lambda-A 时出现以下错误(通过自定义资源触发)。
[ERROR] 2019-11-15T00:21:30.691Z b1f7049a-0de7-4324-95ee-817abc12d3bc Create Vpc Hosted Zone association call Failed An error occurred (AccessDenied) when calling the AssociateVPCWithHostedZone operation: User: arn:aws:sts::XXXX:assumed-role/Default-HostedZone-Accept-AcceptHostedZoneAssociat-128KT4DUCVD0M/HostedZoneAssociationAcceptLambda is not authorized to perform: route53:AssociateVPCWithHostedZone on resource: arn:aws:route53:::hostedzone/Z0589797H460WDVIBOBD
但是,如果我使用执行失败的事件数据(附加相同的角色)测试 Lambda-A,它会毫无问题地创建关联。
谢谢
最佳答案
问题在于我的 CF 脚本接受托管区域与 VPC 的关联。它在创建角色策略之前触发 Lambda 函数。在向触发 Lambda 函数的自定义资源添加“DependsOn”属性后修复。
LambdaTriggerCustomResource:
DependsOn: AcceptHostedZoneAssociationRolePolicy
Type: 'AWS::CloudFormation::CustomResource'
Version: '1.0'
Properties:
ServiceToken: !GetAtt HostedZoneAssociationAcceptLambda.Arn
关于amazon-web-services - 使用 Lambda 和 Boto3 将 VPCWithHostedZone 关联时出现访问被拒绝错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58868778/
我正在尝试在两个 AWS 账户之间创建共享托管区域。 从账户 B 中,我使用以下内容创建了 vpc 关联授权:(Lambda-B) response = self.route53.create_vpc
我是一名优秀的程序员,十分优秀!