Jimmy Chen
Jimmy Chen

Reputation: 267

Running python boto3 inside a docker container requirements on AWS

So, I'm using boto3 s3 with a python script just to list the bucket.

s3_client = boto3.client('s3')

It works fine when I run it on my desktop because I setup the aws_access_key_id and aws_secret_access_key with my aws configure command.

When I run it on AWS as a container, am I going to need to run my container with environment variables for the aws_access_key_id and aws_secret_access_key when I use boto3? Or if I have my setup for my container user having access to s3, will that work and negate the need for keys?

Upvotes: 3

Views: 8255

Answers (1)

Marcin
Marcin

Reputation: 238747

would I still need to setup the aws key and secret key in boto3 or will it work off the permissions I give to my task execute user

You don't have to hard code anything. Instead you provide the permissions using IAM Roles for Tasks. So S3 permissions are granted through this role. Boto3 will automatically inherit the permissions.

Upvotes: 1

Related Questions