import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
print(bucket.name)
document
import boto3
from boto3.session import Session
session = Session(aws_access_key_id='<YOUR ACCESS KEY ID>',
aws_secret_access_key='<YOUR SECRET KEY>',
region_name='<REGION NAME>')
s3 = session.resource('s3')
Pass profile_name to Session.
Documentation I can't understand it by looking at it, [github issue](https://github.com/boto/boto3/pull/ Found in 69)
import boto3
from boto3.session import Session
profile = '<YOUR_PROFILE_NAME>'
session = Session(profile_name=profile)
s3 = session.resource('s3')
Recommended Posts