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