Reputation: 809
I have an EC2 with a role that gives it full control over others EC2.
This role allows calling aws ec2 ...
without doing the aws configure
step.
However, if I install docker and run a docker container inside that EC2, this container is not able to do the aws ec2 ...
without configuring the awscli.
Is there some kind of folder to share of feature to enable in order to run awscli commands inside my container without configuring it with an accesskey/password ?
Upvotes: 3
Views: 1789
Reputation: 200998
The aws
command is utilizing the IAM instance profile assigned to the EC2 instance, which it is obtaining via the EC2 metadata service. You would need to share that metadata with the Docker container somehow.
Are you using the AWS ECS service? Or are you manually installing and managing docker on an EC2 instance? ECS handles this for you.
Otherwise you might look into something like this Lyft project designed to proxy the EC2 IAM role to the Docker container.
Upvotes: 3