Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error when trying to setup Amazon S3 bucket policy

I'm trying to transfer an S3 bucket to another since a developer is leaving our team. I created another AWS account with S3. I'm following these steps: https://aws.amazon.com/premiumsupport/knowledge-center/account-transfer-s3/

The Bucket policy in for source AWS account works fine, but when I try the destination policy:

{
     "Version": "2012-10-17",
     "Statement": {
          "Effect": "Allow",
          "Action": "s3:*",
          "Resource": [
               "arn:aws:s3:::sourcebucket",
               "arn:aws:s3:::sourcebucket/*",
               "arn:aws:s3:::destinationbucket",
               "arn:aws:s3:::destinationbucket/*"
          ]
     }
}

And update only the sourcebucket and dest bucket items above with my account details, I get the error: Statement is missing required element - Statement "NO_ID-0" is missing "Principal" element

like image 615
syedihuda Avatar asked Oct 29 '15 21:10

syedihuda


People also ask

How do I fix an AWS S3 bucket policy and Public permissions access denied error?

If you're denied permissions, then use another IAM identity that has bucket access, and edit the bucket policy. Or, delete and recreate the bucket policy if no one has access to it. If you're trying to add a public read policy, then disable the bucket's S3 Block Public Access.

Why am I getting the error invalid principal in policy when I try to update my Amazon S3 bucket policy?

You receive the "Error: Invalid principal in policy" message when the value of a Principal in your bucket policy is not valid. To resolve this error, confirm the following: Your bucket policy uses supported values for a Principal element. The Principal value is formatted correctly.

How do I enable AWS bucket policy?

Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to create a bucket policy for or whose bucket policy you want to edit. Choose Permissions. Under Bucket policy, choose Edit.


1 Answers

The destination policy in the article you cited is not a bucket policy. It's an IAM user or group policy.

Note the comment:

#User or group policy in the destination AWS account

This policy attaches to an IAM user or group in the IAM (as opposed to S3) console.

The source policy actually is a bucket policy, which is why it works as expected.

like image 192
Michael - sqlbot Avatar answered Dec 06 '22 16:12

Michael - sqlbot