Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The instance profile associated with the environment does not exist

I used CodePipeline to integrate my GitHub Repo and encountered an error when I tried to deploy my Flask application using AWS Elastic Beanstalk.

I tried to find the error and I got to know that my environment didn't even launch. enter image description here

like image 413
Farid Avatar asked Feb 01 '26 21:02

Farid


2 Answers

The issue arises due to the security policies of AWS, which prevents Elastic Beanstalk from creating it's own instance profile. Now, an instance profile is required for an environment because it provides the necessary permissions and access rights to the EC2 instances that run your application.

Steps to manually create an instance profile:

  1. search for "IAM"
  2. Users>Add users>username>set permissions
  3. select Attach policies directly and add these 4 permissions (AdministratorAccess, AWSElasticBeanstalkMulticontainerDocker, AWSElasticBeanstalkWebTier, AWSElasticBeanstalkWorkerTier)

[create a Role]

  1. Roles>create role>{entity type: AWS service, use case: EC2>permissions:same as above}

[link Role to the User using the user ARN we just created]

  1. Select Role>Trust relationships>Edit trust policy>Add a principal - {principal type: IAM Roles, ARN: user arn}>Update Policy

[Create a new environment]

  1. Service access - (use an existing service role - {existing service role: Role_created, EC2 instance profile: Role_created})

[We have successfully launched an environment]

like image 177
Farid Avatar answered Feb 04 '26 15:02

Farid


The answer given by farid with the 6 steps outlined worked perfect for me. I wanted to add detail to anyone confused by step 5 (I can't comment on the answer). The exact ARN:user information to use once you click "add a principal" can be found if you click on the role you created, and then under Summary copy the string listed under "ARN".

https://i.sstatic.net/0W0M1.png

like image 31
Chris Wood Avatar answered Feb 04 '26 15:02

Chris Wood



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!