Reputation: 510
I use elasticbeanstalk with multicontainer version and I have docker container with boto3 inside. I would like to assume role to save files on S3 using python.
Based on this question: Fetching AWS instance metadata from within Docker container?
urlopen('http://169.254.169.254/latest/meta-data/iam/instance-id-credentials/s3access').read().decode('utf-8')
returns 404.
I don't want use hardcoded credentials in my docker image. Is there a way to somehow assume role?
Upvotes: 1
Views: 1666
Reputation: 116
I made this work by starting the container in --net host
mode. I.e. use the host's networking stack to make AWS think that you are requesting from the EC2 host.
This was the comment that provided this solution: Fetching AWS instance metadata from within Docker container?
Upvotes: 1