If you’ve encountered errors such as
“botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the PutObject operation: Access Denied”
and
“Amazon S3 bucket returning 403 Forbidden”
when backing up your local static files to an AWS S3 bucket, it’s likely that these issues are related to the bucket policy.
To fix this, you can try copying and applying the following policy:
S3 Bucket Policy
{
“Version”: “2008–10–17”,
“Statement”: [
{
“Sid”: “AllowPublicRead”,
“Effect”: “Allow”,
“Principal”: {
“AWS”: “*”
},
“Action”: [
“s3:GetObject”,
“s3:PutObject”
],
“Resource”: “arn:aws:s3:::< bucket-name>/*”
}
]
}
If it still does not work, check the IAM Permission setting like this picture below.