Converting IAM policy into Serverless framework syntax

Viewed 36

I have the following AWS IAM policy:

{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Effect":"Deny",
         "Action":[
            "dynamodb:PartiQLSelect"
         ],
         "Resource":[
            "arn:aws:dynamodb:<region>:<account id>:table/MyDynamoDBTable"
         ],
         "Condition":{
            "Bool":{
               "dynamodb:FullTableScan":[
                  "true"
               ]
            }
         }
      }
   ]
}

How should this be represented in Serverless syntax? I'm not sure how to represent the condition and can't find any examples upon the Serverless website.

I'm guessing it's something like this:

  - Effect: Deny
    Action:
      - dynamodb:PartiQLSelect
    Resource: "arn:aws:dynamodb:<region>:<account id>:table/MyDynamoDBTable"
    Condition:
      - Not sure what to put here

Grateful thanks for any assistance!

1 Answers

It is just a regular JSON to YAML conversion. Plenty of such tools online. But it should be:

- Effect: Deny
  Action:
    - dynamodb:PartiQLSelect
  Resource:
    - arn:aws:dynamodb:<region>:<account id>:table/MyDynamoDBTable
  Condition:
    Bool:
      dynamodb:FullTableScan: ['true']
Related