I want help in creating DynamoDB table using CloudFormation template

Viewed 523

I need a help in creating DynamoDB table using CloudFormation template.

Table name: oeautomator-team-config Table Schema:

active - Boolean
devResolverGroups - List
excludeAgingList - Boolean
excludeNoncontrollableList - Boolean excludeReroutedList - Boolean
fleetId - String managerLogin - String metricsDashboardLinks - Map orgName - String
simFolderId - String supportResolverGroups - List teamName - String

Primary Partition key - teamName (String)

I formed a template

AWSTemplateFormatVersion: 2010-09-09
Resources:
  oeautomatorteamconfigTable:
    Type: AWS::DynamoDB::Table
    Properties:
      TableName: oeautomator-team-config
      AttributeDefinitions:
        - AttributeName: "teamName"
          AttributeType: "S"
      KeySchema:
        - AttributeName: "teamName"
          KeyType: "HASH"
      TimeToLiveSpecification:
        AttributeName: "ExpirationTime"
        Enabled: true
      ProvisionedThroughput:
        ReadCapacityUnits: "5"
        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: "oeautomatorteamconfigTableQueryRole"

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

But not sure how to define the rest of all columns.

Thanks in advance

1 Answers

You do not need to specify the rest of the attributes. Dynamo is by definition schemaless, apart from hash and range key.

Related