0

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..

Nithyananth
  • 329
  • 2
  • 5
  • 17
  • Earlier Elastic Beanstalk used to create a default EC2 instance profile named `aws-elasticbeanstalk-ec2-role` the first time an AWS account create an environment. This instance profile included default managed policies. However, recent AWS security guidelines don’t allow an AWS service to automatically create roles with trust policies to other AWS services, EC2 in this case. Please check the detailed answer here:- https://stackoverflow.com/a/76620598/12326605 – Arpit Jain Jul 11 '23 at 04:14

3 Answers3

1

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.

Nithyananth
  • 329
  • 2
  • 5
  • 17
0

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

0

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

ASin
  • 106
  • 1
  • 4