Nithyananth
Nithyananth

Reputation: 347

AWS Beanstalk environment creation issue.Failed to launch environment.Environment must have instance profile associated with it

I am trying to create environment in AWS Elastic Beanstalk Application using both CLI and Java API. After running the CLI command I am seeing the following error logs in the AWS console,

2017-07-18 10:26:22 UTC+0530    INFO    Deleting SNS topic for environment MySampleApplicationThree-env.
2017-07-18 10:26:20 UTC+0530    ERROR   Failed to launch environment.
2017-07-18 10:26:20 UTC+0530    ERROR   Environment must have instance profile associated with it.
2017-07-18 10:26:19 UTC+0530    INFO    Using elasticbeanstalk-ap-south-1-839135229895 as Amazon S3 storage bucket for environment data.
2017-07-18 10:26:18 UTC+0530    INFO    createEnvironment is starting.

I am seeing the same above error log in API too..

Below is my CLI command,

aws elasticbeanstalk create-environment --cname-prefix mysampleapplicationthree --application-name MySampleApplicationThree --version-label "Sample Application" --environment-name mysampleapplicationfour --solution-stack-name "64bit Amazon Linux 2017.03 v2.6.1 running Tomcat 8 Java 8"

Below is my API code

AWSElasticBeanstalk client = AWSElasticBeanstalkClientBuilder.defaultClient(); 
CreateEnvironmentRequest createEnvironmentRequest = new CreateEnvironmentRequest()
                .withApplicationName("MySampleApplicationThree")
                .withEnvironmentName("MySampleApplicationThree-env")
                .withCNAMEPrefix("MySampleApplicationThree")
                .withSolutionStackName("64bit Amazon Linux 2017.03 v2.5.1 running Java 8")
                .withVersionLabel("Sample Application");

        CreateEnvironmentResult envresult = client.createEnvironment(createEnvironmentRequest);

I didn't get any proper solution for this. It would be helpful if someone helps fixing this issue. Thanks..

Upvotes: 1

Views: 2648

Answers (3)

ASin
ASin

Reputation: 106

Don't know how this changing of Region resolves this issue, as far as I know AWS does not and should not have region specific errors, to resolve this issue I followed the answer below

https://stackoverflow.com/a/63010651/7745590

Upvotes: 0

Nithyananth
Nithyananth

Reputation: 347

I just changed my Region from Mumbai(AP_SOUTH_1) to Singapore(AP_SOUTHEAST_1) and it works now. But I don't know the reason behind this. If anyone has any knowledge on this please post it here.

Upvotes: 1

user5063991
user5063991

Reputation:

It seems like user doesn't have enough permission. Go to your IAM console and attach AWSElasticBeanstalkFullAccess policy to the corresponding role.

Upvotes: 1

Related Questions