Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 CLI:An error occurred (AllAccessDisabled) when calling the PutObject operation: All access to this object has been disabled

I'm using aws-cli/1.15.25 Python/2.7.15 Darwin/17.7.0 botocore/1.10.25 to try and upload a file to S3 using the following command:

aws s3 cp <file> s3://bucket.s3.amazonaws.com/<bucket name>

But I get the following returned:

u

pload failed: ./<file> to s3://bucket.s3.amazonaws.com/<bucket name> An error occurred (AllAccessDisabled) when calling the PutObject operation: All access to this object has been disabled

I have, as a test, set my bucket to accessible by all with the following policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Principal": "*",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:PutObjectAcl",
                "s3:GetObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::<bucket name>/*"
            ]
        }
    ]
}

My IAM user has the correct permissions set

I don't know what else to look at. I've Googled and tried most suggestions

like image 210
Ste Avatar asked Jul 18 '18 15:07

Ste


People also ask

Why am I getting an access denied error from the Amazon S3 console when I try to modify a bucket policy?

Short description. The "403 Access Denied" error can occur due to the following reasons: Your AWS Identity and Access Management (IAM) user or role doesn't have permissions for both s3:GetBucketPolicy and s3:PutBucketPolicy.

Why is my S3 Access Denied?

If you're getting Access Denied errors on public read requests that are allowed, check the bucket's Amazon S3 Block Public Access settings. Review the S3 Block Public Access settings at both the account and bucket level. These settings can override permissions that allow public read access.

What permissions does S3 sync need?

To run the command aws s3 sync, then you need permission to s3:GetObject, s3:PutObject, and s3:ListBucket. Note: If you're using the AssumeRole API operation to access Amazon S3, you must also verify that the trust relationship is configured correctly.


2 Answers

Note: AllAccessDisabled error will be displayed when non existing folder path is specified (misspelling) .

like image 186
ddrypczewski Avatar answered Nov 15 '22 10:11

ddrypczewski


You are specifying the bucket name twice in the URL or you are actually using the string "bucket".

Your can use the virtual hosted style as:

http://bucketname.s3.amazonaws.com/path/to/file

http://bucketname.s3-aws-region.amazonaws.com/path/to/file

or the path style URL:

http://s3.amazonaws.com/bucketnamepath/to/file

http://s3-aws-region.amazonaws.com/bucketname/path/to/file

Replace "aws-region" with the region. Use the "s3-aws-region" style for regions that are not us-east-1. Examples for a bucket in South America:

http://bucketname.s3-sa-east-1.amazonaws.com/path/to/file

http://s3-sa-east-1.amazonaws.com/bucketname/path/to/file

like image 31
John Hanley Avatar answered Nov 15 '22 11:11

John Hanley