Cloudformation Combine two attribute to make up partition key in dynamoDB

0

Hello please how do i make Cloudformation Combine two attribute to make up partition key in dynamoDB

Please can you share a sample code, Thanks

1 Answer
1
Accepted Answer

Hi,

Here is such an example:

AWSTemplateFormatVersion: "2010-09-09"
Resources: 
  usersTable: 
    Type: "AWS::DynamoDB::Table"
    Properties: 
      AttributeDefinitions: 
        - 
          AttributeName: "userId"
          AttributeType: "S"
        - 
          AttributeName: "noteId"
          AttributeType: "S"
      KeySchema: 
        - 
          AttributeName: "userId"
          KeyType: "HASH"
        - 
          AttributeName: "noteId"
          KeyType: "RANGE"
      ProvisionedThroughput: 
        ReadCapacityUnits: "5"
        WriteCapacityUnits: "5"
      TableName: "notes_serverless"

You can have a look at https://dynobase.dev/dynamodb-cloudformation/ to get more details about CFN & DDB.

Best,

Didier

profile pictureAWS
EXPERT
answered 8 months ago
profile picture
EXPERT
reviewed 8 months ago
profile picture
EXPERT
reviewed 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions