我正在按照教程此处使用 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 错误。这和上面的错误有关系吗?
我遇到了同样的问题,为了解决它,我刚刚创建了一个新角色,而不是使用默认角色选项。
模板.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 管理控制台中: