ClientError:
An error occurred (AllAccessDisabled) when calling the GetObject operation: All access to this object has been disabled
My code is:
s3resource = boto3.resource('s3')
my_bucket = s3.Bucket(bucket_name)
s3client = boto3.client('s3')
for s3_object in my_bucket.objects.all():
path, file1 = os.path.split(s3_object.key)
obj = s3client.get_object(Bucket='bucket_name',Key=file1)
j = json.loads(obj['Body'].read())
And the bucket policy is:
{
"Version": "2012-10-17",
"Id": "Policy1559802940321",
"Statement": [
{
"Sid": "Stmt1559802821882",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::bucketname"
}
]
}