IAM Policy Parsing Issue

0

Hi AWS, I am creating an IAM policy using CloudFormation. This is one of the sample block in the policy code.

- Effect: Deny
  Sid: S3Deny
  Action:
    - s3:Get*
    - s3:List*
  NotResource: !Split
    - ","
    - !Ref S3NotResource

The syntax and indentation looks good as I am using CloudFormation Linter to find any syntax issues, warnings, errors etc. and it has not detected anything but while deploying it through CloudFormation I am getting this error:

resource handler returned message: "the policy failed legacy parsing (service: iam, status code: 400, request id: 3c569005-7172-4f1x-836x-b493d8825947)" (requesttoken: cb6xxxx-32a7-7e08-761x-542162288xx1, handlererrorcode: invalidrequest)

Please help me in spotting the issue as it is very annoying.

3 Answers
1

Hello.

It looks like there is "Effect" in "Effect", but I think it is actually "Action".

- Effect: Deny
  Sid: S3Deny
  Action:
    - s3:Get*
    - s3:List*
  NotResource: !Split
    - ","
    - !Ref S3NotResource
profile picture
EXPERT
answered 4 months ago
profile pictureAWS
EXPERT
reviewed 4 months ago
  • Sorry it was having Action only, that was a typo but still I am experiencing the same error I posted above. Please suggest why it is still throwing an error.

  • I suspect that the following part is the cause of the error. I haven't seen the full text of CloudFormation, so I'm not sure, but what value does "S3NotResource" contain?

      NotResource: !Split
        - ","
        - !Ref S3NotResource
    
  • Riku_Kobayashi, S3NotResource is a parameter of Type String.

  • Could you please tell me the specific value? I would like to reproduce the error before troubleshooting.

1

It seems you have 2 “Effects”? Try to change the second one with Actions

profile picture
EXPERT
answered 4 months ago
0

The error was spotted. One of the ARNs in the parameter list was wrong.

Thanks for the help.

profile picture
answered 4 months 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