I met that issue during compliting AWS tutorial
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/docker.html
But there were few more issues. Put them all here for future generations.
1)
~/eb-docker-flask$ eb init -p docker application-name
~/eb-docker-flask$ eb local run --port 5000
if you have issues with docker during local run you can try to use this instruction instead
~/eb-docker-flask$eb init -p "Docker running on 64bit Amazon Linux 2" application-name
this is for original question:
~/eb-docker-flask$ eb create environment-name
to make this work you should create a group, a user, a role, an instance profile.
Me personally created user, group and role via AWS web GUI.
To create a user you should been registred in AWS, connect to your root user, then go to IAM Managment platform, there you will find all three categories. As far as I understand it is recommended to give permissions to a group and just add a user you need to that group. But I just wanted to get it work so I added permissions to the user and to the group.
- AdministratorAccess-AWSElasticBeanstalk
- AWSElasticBeanstalkMulticontainerDocker
- AWSElasticBeanstalkRoleWorkerTier
Group permissions
Same for the user plus one that I've created by myself (Add permissions => create inline policy)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:AddRoleToInstanceProfile",
"iam:CreateInstanceProfile",
"iam:ListInstanceProfilesForRole"
],
"Resource": "*"
}
]
}
Same three for the role (without handmade one)
Add the user to the group.
Now you can create an instance profile and add your role to that instance
https://repost.aws/knowledge-center/attach-replace-ec2-instance-profile
AWS Command Line Interface (AWS CLI)
Add the role to an instance profile before attaching the instance profile to the EC2 instance.
- If you haven't already created an instance profile, then run the following AWS CLI command:
aws iam create-instance-profile --instance-profile-name EXAMPLEPROFILENAME
- Run the following AWS CLI command to add the role to the instance profile:
$ aws iam add-role-to-instance-profile --instance-profile-name EXAMPLEPROFILENAME --role-name EXAMPLEROLENAME
Now this one should work
~/eb-docker-flask$ eb create environment-name