x-dynamodb

Syntax reference
x-dynamodb:
  table-A:
    Properties: {}
    MacroParameters: {}
    Settings: {}
    Services: []

Properties

Refer to AWS CFN Dynamodb Documentation. We support all of the definition and test with the documentation examples.

Tables with GSI
---
# Blog applications

version: '3.8'

x-dynamodb:
  tableA:
    Properties:
      AttributeDefinitions:
        - AttributeName: "Album"
          AttributeType: "S"
        - AttributeName: "Artist"
          AttributeType: "S"
        - AttributeName: "Sales"
          AttributeType: "N"
        - AttributeName: "NumberOfSongs"
          AttributeType: "N"
      KeySchema:
        - AttributeName: "Album"
          KeyType: "HASH"
        - AttributeName: "Artist"
          KeyType: "RANGE"
      ProvisionedThroughput:
        ReadCapacityUnits: "5"
        WriteCapacityUnits: "5"
      GlobalSecondaryIndexes:
        - IndexName: "myGSI"
          KeySchema:
            - AttributeName: "Sales"
              KeyType: "HASH"
            - AttributeName: "Artist"
              KeyType: "RANGE"
          Projection:
            NonKeyAttributes:
              - "Album"
              - "NumberOfSongs"
            ProjectionType: "INCLUDE"
          ProvisionedThroughput:
            ReadCapacityUnits: "5"
            WriteCapacityUnits: "5"
        - IndexName: "myGSI2"
          KeySchema:
            - AttributeName: "NumberOfSongs"
              KeyType: "HASH"
            - AttributeName: "Sales"
              KeyType: "RANGE"
          Projection:
            NonKeyAttributes:
              - "Album"
              - "Artist"
            ProjectionType: "INCLUDE"
          ProvisionedThroughput:
            ReadCapacityUnits: "5"
            WriteCapacityUnits: "5"
      LocalSecondaryIndexes:
        - IndexName: "myLSI"
          KeySchema:
            - AttributeName: "Album"
              KeyType: "HASH"
            - AttributeName: "Sales"
              KeyType: "RANGE"
          Projection:
            NonKeyAttributes:
              - "Artist"
              - "NumberOfSongs"
            ProjectionType: "INCLUDE"

    Services:
      - name: app03
        access: RW
      - name: app02
        access: RW
      - name: bignicefamily
        access: RO

Settings

See the Settings for more details.

Hint

Given DynamoDB is serverless (unless using DAX), there is no Subnets override.

Lookup

For more details, see the Lookup.

Lookup DynamoDB Table example
x-dynamodb:
  table-A:
    Lookup:
      Tags:
        - table-name: table123
        - owner: myself
        - costallocation: 123
    Services:
      - name: serviceA
        access: DynamoDBCrudPolicy

ECS Compose-X defined access names:

  • RW : Allow read/write/delete on the table items

  • RO: Allow read only actions on the table items

Some of the AWS SAM access:

Services

Define services
Services:
  - name: serviceA
    access: RW
  - name: serviceB
    access: RO