savvamadar
savvamadar

Reputation: 294

DynamoDB Cloudformation Permission

I currently have the following cloudformation .yaml file:

Resources:
  DynamoTable:
  Type: "AWS::DynamoDB::Table"
  Properties:
    ...
    ...
    ...

How do I give other resources permission to query this table?

Upvotes: 3

Views: 3869

Answers (1)

savvamadar
savvamadar

Reputation: 294

Resources:
  Service:
    Type: "AWS::CloudFormation::Stack"
    Properties:
      Parameters:
        ...
        ...
        TaskPolicyArn: !Ref ThisServicePolicy

  DynamoTable:
    Type: "AWS::DynamoDB::Table"
    Properties:
      AttributeDefinitions:
        ...
        ...
        ...

  ThisServicePolicy:
    Type: "AWS::IAM::ManagedPolicy"
    Properties:
      ManagedPolicyName: SomePolicyName
      PolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: "Allow"
            Action: 
              - "dynamodb:GetItem"
              - "dynamodb:BatchGetItem"
              - "dynamodb:Query"
            Resource: "*"

Upvotes: 3

Related Questions