简体   繁体   中英

Find aws-elasticbeanstalk-ec2-role in Terraform?

According to this , the role aws-elasticbeanstalk-ec2-role should be used for Elastic Beanstalk instances.

I would like to find this role so that I can refer to it in other places in my scripts.

data aws_iam_role "elasticbeanstalk_ec2_role" {
  name = "aws-elasticbeanstalk-ec2-role"
}

This isn't right though:

NoSuchEntity: The role with name aws-elasticbeanstalk-ec2-role cannot be found.

How can I find this role?

According to the documentation here :

When you launch an environment using the Elastic Beanstalk console or the EB CLI, Elastic Beanstalk creates a default instance profile, called aws-elasticbeanstalk-ec2-role, and assigns managed policies with default permissions to it.

Since you appear to be deploying your application through Terraform, instead of using the AWS EB CLI or Console, that role doesn't exist. You will need to create a role for your EB instances yourself.

I confirm that you need to create role by yourself if deploying with Terraform. See official documentation for informations: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM