[PYTHON] [AWS] Switch access rights in boto3 Session

Advance preparation

In IAM, create default, dev, prod users. Attach the AmazonS3FullAccess policy to dev to allow access to S3. Prepare bucket1, bucket2, bucket3 in S3.

Use credentials file

Directly specify the access ID and secret key

Execution result

bucket1
bucket2
bucket3
ClientError: An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied
ProfileNotFound: The config profile (foo) could not be found

Recommended Posts

[AWS] Switch access rights in boto3 Session
Put AWS data in Google Spreadsheet with boto + gspread
AWS SDK for Python (Boto3) development in Visual Studio 2017
Access MongoDB in C