Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Created April 13, 2018 22:20
Show Gist options
  • Save adrianhall/46dc9bd1d4effff96e35d53aad077f4c to your computer and use it in GitHub Desktop.
Save adrianhall/46dc9bd1d4effff96e35d53aad077f4c to your computer and use it in GitHub Desktop.
A CloudFormation template for the AppSync DynamoDB access role.
DynamoDBRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub ${APIName}-appsync-dynamodb-role
ManagedPolicyArns:
- Ref: AppSyncDynamoDBPolicy
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- sts:AssumeRole
Principal:
Service:
- appsync.amazonaws.com
DependsOn:
- AppSyncDynamoDBPolicy
AppSyncDynamoDBPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
Description: Managed policy to allow AWS AppSync to access the tables created by this template.
Path: /appsync/
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:DeleteItem
- dynamodb:UpdateItem
- dynamodb:Query
- dynamodb:Scan
- dynamodb:BatchGetItem
- dynamodb:BatchWriteItem
Resource: !Join [ "", [ !GetAtt DynamoDBNotesTable.Arn, "*" ] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment