Schema to create a resource of DynamoDB table using SAM

An example of how to declare DynamoDB table in template.yaml of your SAM configuration

  YourDynamoDBTable:
    Type: AWS::DynamoDB::Table
    Properties: 
      TableName: 'your-table-name'
      AttributeDefinitions: 
        - AttributeName: yourAttribute1
          AttributeType: S
        - AttributeName: yourAttribute2
          AttributeType: S
      KeySchema: 
        - AttributeName: yourAttribute1
          KeyType: HASH
        - AttributeName: yourAttribute2
          KeyType: RANGE
      ProvisionedThroughput: 
        ReadCapacityUnits: 1
        WriteCapacityUnits: 1

More info on the available properties is in the next resource. I use CDK documentation, as I have not found related to SAM resources.

Last updated