Skip to content

Instantly share code, notes, and snippets.

@awssimplified
Created December 9, 2020 01:56
Show Gist options
  • Select an option

  • Save awssimplified/f96437a5a3beed65bf4782eb7b69afa4 to your computer and use it in GitHub Desktop.

Select an option

Save awssimplified/f96437a5a3beed65bf4782eb7b69afa4 to your computer and use it in GitHub Desktop.

Revisions

  1. awssimplified created this gist Dec 9, 2020.
    53 changes: 53 additions & 0 deletions dynamodbDemo.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    AWSTemplateFormatVersion: 2010-09-09
    Resources:
    OrdersTable:
    Type: AWS::DynamoDB::Table
    Properties:
    TableName: AuthorsTable_prod
    AttributeDefinitions:
    - AttributeName: "AuthorName"
    AttributeType: "S"
    - AttributeName: "BookTitle"
    AttributeType: "S"
    KeySchema:
    - AttributeName: "AuthorName"
    KeyType: "HASH"
    - AttributeName: "BookTitle"
    KeyType: "RANGE"
    TimeToLiveSpecification:
    AttributeName: "ExpirationTime"
    Enabled: true
    ProvisionedThroughput:
    ReadCapacityUnits: "10"
    WriteCapacityUnits: "5"
    DependsOn:
    - DynamoDBQueryPolicy

    DynamoDBQueryPolicy:
    Type: "AWS::IAM::Policy"
    Properties:
    PolicyName: DynamoDBQueryPolicy
    PolicyDocument:
    Version: "2012-10-17"
    Statement:
    - Effect: "Allow"
    Action: "dynamodb:Query"
    Resource: "*"
    Roles:
    - Ref: "OrdersTableQueryRole"

    OrdersTableQueryRole:
    Type: "AWS::IAM::Role"
    Properties:
    AssumeRolePolicyDocument:
    Version: "2012-10-17"
    Statement:
    - Effect: "Allow"
    Principal:
    Service:
    - "dynamodb.amazonaws.com"
    Action:
    - "sts:AssumeRole"
    Path: "/"