AWS Elastic Beanstalk 无法承担角色

问题描述 投票:0回答:2

我正在按照教程此处使用 Elastic Beanstalk 将 Ruby on Rails 应用程序部署到 AWS。我收到错误

Unable to assume role "arn:aws:iam::xxxxxxxxxx:role/aws-elasticbeanstalk-service-role". 
Verify that the role exists and is configured correctly.

因此,我在 IAM 中创建了一个角色,并到目前为止给出了 AWSElasticBeanstalkFullAccess 策略。我想知道我错过了什么。

此外,当我打开 eb 时,它会给出 502 Bad Gateway 错误。这和上面的错误有关系吗?

ruby-on-rails amazon-web-services amazon-s3 amazon-ec2 amazon-elastic-beanstalk
2个回答
1
投票

您需要为该角色授予正确的权限。服务角色赋予 elasticbeanstalk 代表您调用其他服务的权限。

您可以在此处了解您的角色所需的权限。 也不要混合服务角色和实例配置文件。他们是两个不同的角色,有着不同的目的。 请阅读我的回答以获得更详细的解释这里


0
投票

我遇到了同样的问题,为了解决它,我刚刚创建了一个新角色,而不是使用默认角色选项。

模板.yml:

AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation template to create a service-linked role for Elastic Beanstalk

Resources:

  ElasticBeanstalkServiceRole:
    Type: 'AWS::IAM::Role'
    Properties:
      RoleName: 'cicd-role'
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: 'Allow'
            Action: 'sts:AssumeRole'
            Principal:
              Service: 'elasticbeanstalk.amazonaws.com'
      Description: 'Allows Elastic Beanstalk to create and manage AWS resources on your behalf.'
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/AdministratorAccess-AWSElasticBeanstalk
        - arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth
        - arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkService

Outputs:
  RoleArn:
    Description: 'ARN of the Elastic Beanstalk service role'
    Value: !GetAtt [ElasticBeanstalkServiceRole, Arn]

或者在 aws 管理控制台中:

  • 角色 > 创建
  • 可信实体类型 > AWS 服务
  • 用例 > 弹性豆茎
  • (其他默认)
  • 创建
© www.soinside.com 2019 - 2024. All rights reserved.