Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 751
Jimmy Chen Avatar asked Dec 12 '25 02:12

Jimmy Chen


1 Answers

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.

like image 54
Marcin Avatar answered Dec 15 '25 00:12

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!