I am trying to get an encryption status for all of my buckets for a security report. However, since encryption is on a key level basis, I want to iterate t
Just generalizing the great answer provided from Ben.
import boto3
knownBucket = 'some.topLevel.BucketPath.withPeriods'
s3 = boto3.resource('s3')
#get region
region = s3.meta.client.get_bucket_location(Bucket=knownBucket)['LocationConstraint']
#set region in resource
s3 = boto3.resource('s3',region_name=region)
There are a couple of github issues on this. It's related to the region of the bucket. Make sure that your S3 resource is in the same region as the bucket you've created.
FWIW you can determine the region programmatically like this:
s3.meta.client.get_bucket_location(Bucket='boto3.region')