In this step, we will create a new DynamoDB table using a SAM template.
Open template.yaml in the source code you downloaded before.
Add the following scripts below to create FcjOrdersTable table.
orderTable:
Type: String
Default: OrdersTable
FcjOrdersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Ref orderTable
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: book_id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
- AttributeName: book_id
KeyType: RANGE
Run the below commands.
sam build
sam validate
sam deploy
Open AWS DynamoDB console to check.