Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Step 5: An error occurred (MalformedPolicy) when calling the PutBucketPolicy operation: Policy has invalid resource #4

Open
bartonhammond opened this issue Oct 22, 2018 · 5 comments

Comments

@bartonhammond
Copy link

screen shot 2018-10-22 at 3 06 54 pm

bucketpolicy.json:

{
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"AddPerm",
      "Effect":"Allow",
      "Principal": "*",
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::barton-travel-site/*"]
    }
  ]
}

Command:
aws s3api put-bucket-policy --bucket barton-travel-site --policy file://bucketpolicy.json

Output:

An error occurred (MalformedPolicy) when calling the PutBucketPolicy operation: Policy has invalid resource
@bartonhammond
Copy link
Author

I went here and added policy manually:

screen shot 2018-10-22 at 4 06 09 pm

@kr813
Copy link

kr813 commented Jan 13, 2020

Did you resolve?
I'm sorry because I have same problem,too.
I want to know the solution.

@lnryan
Copy link

lnryan commented Jan 14, 2020

How can this be resolved via the aws cli?

@huylv95
Copy link

huylv95 commented Mar 28, 2020

root@ip-10-0-32-211:~# aws s3api put-bucket-policy --bucket test-update-policy --policy file://policy.json

An error occurred (MalformedPolicy) when calling the PutBucketPolicy operation: Policy has invalid resource
root@ip-10-0-32-211:# aws s3 ls
2020-03-17 13:44:40 cf-templates-15gc0eytikz3y-us-east-1
2019-11-25 02:29:37 elasticbeanstalk-us-east-1-785086296852
2020-03-27 09:31:32 test-update-policy
root@ip-10-0-32-211:
# vi policy.json
root@ip-10-0-32-211:~# aws s3api put-bucket-policy --bucket test-update-policy --policy file://policy.json


Just mapping S3 bucket name in json file and S3 bucket name in console will be resolve this problem.

@mamonalsalihy
Copy link

I fixed this error by saving the website-bucket-policy.json file
unsaved
saved

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants