aws-serverless-appsync-app icon indicating copy to clipboard operation
aws-serverless-appsync-app copied to clipboard

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

Open bartonhammond opened this issue 6 years ago • 5 comments

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 avatar Oct 22 '18 20:10 bartonhammond

I went here and added policy manually:

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

bartonhammond avatar Oct 22 '18 21:10 bartonhammond

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

kr813 avatar Jan 13 '20 12:01 kr813

How can this be resolved via the aws cli?

lnryan avatar Jan 14 '20 12:01 lnryan

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.

huylv95 avatar Mar 28 '20 08:03 huylv95

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

mamonalsalihy avatar Jun 09 '20 20:06 mamonalsalihy