How to choose an AWS profile when using boto3 to connect to CloudFront

后端 未结 4 879
醉话见心
醉话见心 2020-11-30 19:19

I am using the Boto 3 python library, and want to connect to AWS CloudFront. I need to specify the correct AWS Profile (AWS Credentials), but looking at the official documen

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 19:42

    Do this to use a profile with name 'dev':

    session = boto3.session.Session(profile_name='dev')
    s3 = session.resource('s3')
    for bucket in s3.buckets.all():
        print(bucket.name)
    

提交回复
热议问题