gpt4 book ai didi

amazon-elastic-beanstalk - 使用 CloudFormation 创建 BeanStalk 应用程序时如何修复 "Insufficient privileges for IAM PassRole Action"?

转载 作者:行者123 更新时间:2023-12-03 07:41:22 27 4
gpt4 key购买 nike

当我尝试使用 CloudFormation 创建弹性 beanstalk 应用程序时,资源创建失败:

IAM PassRole 操作的权限不足。 (服务:AWSElasticBeanstalk;状态代码:403;错误代码:InsufficientPrivilegesException;请求 ID:[...];代理:null)

我该如何解决这个问题?

CloudFormation 模板:

  BeanStalkServiceRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: elasticbeanstalk.amazonaws.com
Condition:
StringEquals:
'sts:ExternalId': elasticbeanstalk
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy
- arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth

BeanStalkApplication:
Type: AWS::ElasticBeanstalk::Application
Properties:
Description: Java Backend
ResourceLifecycleConfig:
ServiceRole: !Ref BeanStalkServiceRole
VersionLifecycleConfig:
MaxAgeRule:
DeleteSourceFromS3: true
Enabled: true
MaxAgeInDays: 30

最佳答案

ServiceRole 属性必须指向角色 ARN,即 !GetAtt BeanStalkServiceRole.Arn 而不是 !Ref BeanStalkServiceRole:

  BeanStalkApplication:
Type: AWS::ElasticBeanstalk::Application
Properties:
Description: Java Backend
ResourceLifecycleConfig:
ServiceRole: !GetAtt BeanStalkServiceRole.Arn
VersionLifecycleConfig:
MaxAgeRule:
DeleteSourceFromS3: true
Enabled: true
MaxAgeInDays: 30

感谢https://github.com/hashicorp/terraform-provider-aws/issues/17576

关于amazon-elastic-beanstalk - 使用 CloudFormation 创建 BeanStalk 应用程序时如何修复 "Insufficient privileges for IAM PassRole Action"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66748539/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com