Bucket Policy Error - invalid Json

0

Hello I am trying to find out what's wrong with this JSON Unknown Error An unexpected error occurred. This policy contains invalid Json

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowS3ReadAccess", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::091896477544:role/S3DynamoDBFullAccessRole" }, "Action": "s3:", "Resource": [ "arn:aws:s3:::employee-photo-bucket-al1", "arn:aws:s3:::employee-photo-bucket-al1/" ] } ] }

3 Answers
0

I do not agree with @jschwar313 and @skinsman. The policy looks OK. (apart from the '*' being removed from your question in 2 places)

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowS3ReadAccess", 
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::091896477544:role/S3DynamoDBFullAccessRole"
      }, 
      "Action": "s3:*", 
      "Resource": [
        "arn:aws:s3:::employee-photo-bucket-al1", 
        "arn:aws:s3:::employee-photo-bucket-al1/*"
      ]
    }
  ]
}

In the example above I have put back the '*' characters in the right spots.

Now two other thing need to be in order for the BucketPolicy to work.

BucketName

The name of the bucket you are applying the policy to must be employee-photo-bucket-al1.

Role reference

Applying the BucketPolicy will only succeed if the role actually exists.

S3DynamoDBFullAccessRole seems to be a role that you created. You can lookup the role in the IAM Console and use the copy button near the arn.

There can be several reasons for the url not being correct but most likely there is a path included in the arn like in this:

arn:aws:iam::123456789012:role/service-role/S3DynamoDBFullAccessRole

Regards Jacco

profile picture
JaccoPK
answered a year ago
0

What I did to find those documents was to use the visual editor to create the policy using the JSON provided. AWS responded with an error and the documents I posted. Maybe you can do the same.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions