Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with not existing instance profile while trying to get a django project running on AWS Beanstalk

I`m trying to deploy a django project to AWS Beanstalk following this tutorial. I executed

eb create

and after a while I get the error

The instance profile aws-elasticbeanstalk-ec2-role associated with the environment does not exist.

I`m new to the Amazon cloud and can not interprete this error. Can somebody help me?

like image 505
user1383029 Avatar asked Jun 11 '15 20:06

user1383029


2 Answers

That role is created the first time you use the elastic beanstalk console. The CLI also attempts to create it, but your IAM user doesn't have permissions to create it. You can fix this error by logging in to the console and getting to the platform selection page. You will notice that it will ask you to create a role.

Otherwise, you can give your IAM user create role permissions and the CLI will create the role for you.

like image 146
Nick Humrich Avatar answered Oct 24 '22 10:10

Nick Humrich


You can check one option that works here for AWS Beanstalk. This is using AWS Console.

  1. Create IAM Role for "EC2" as AWS Service and attach "AWSElasticBeanstalkFullAccess" policy to it.
  2. Create an AWS Beanstalk environment with tier/platform/application of choice. (I did with Web Tier choosing Docker platform using python:3-onbuild).
  3. Hit "Configure More Options" > "Modify" Security.
  4. Choose "IAM instance profile" which was created in Step 1. (Keep Service role "aws-elasticbeanstalk-service-role" as this is needed! It has some key policies!)
  5. "Save" and "Create Environment".

Similarly, it should work for AWS CLI and AWS SDK as well. Key here is the instance profile role you select for EC2 (or say instance IAM role/instance profile) during Beanstalk Environment creation.

You can create customer managed policy extending or reusing AWSElasticBeanstalkFullAccess policy based on need. Refer AWSElasticBeanstalkFullAccess to understand it better. Also, check out some more AWS Managed policies starting with AWSElasticBeanStalk*.

Somehow default aws-elasticbeanstalk-ec2-role policy is not working/taking effect as desired for me. I am getting same error message as reported above if I go with default policy.

like image 2
Chintan Mangukiya Avatar answered Oct 24 '22 12:10

Chintan Mangukiya