top of page
Search

Access s3 boto3 client with profile - or other service with python

Sometimes you need to access your aws services with specific profile (or not default)

The easiest way to do so :


import boto3

new_session = boto3.session.Session(profile_name='your_aws_profile')

s3 = new_session.client('s3')

response = s3.list_buckets()


# Output the bucket names

print('Existing buckets:')

for bucket in response['Buckets']:

print(f' {bucket["Name"]}')


ree

 
 
 

Comments


Subscribe Form

©2019 by Big Data. Proudly created with Wix.com

bottom of page