Populate DynamoDB table

Run the following commands (simply copy-paste) to populate the DynamoDB table. The below three commands will identify the name of the DynamoDB table from the CloudFormation stack and populate the name in the populate-shops-dynamodb-table.json file.

dynamoDBTableName=$(aws cloudformation list-stack-resources \
    --stack-name myServerless-Stack | \
    jq '.StackResourceSummaries[]|select(.ResourceType == "AWS::DynamoDB::Table").PhysicalResourceId' | tr -d '"')
sudo sed -i s/"<YOUR-DYNAMODB-TABLE-NAME>"/$dynamoDBTableName/g \
    populate-shops-dynamodb-table.json
aws dynamodb batch-write-item \
    --request-items file://populate-shops-dynamodb-table.json

The last command gives the following output:

{
    "UnprocessedItems": {}
}

This populates the DynamoDB table with a few sample records, which you can verify by accessing the ListRestApiEndpointMonitorOper API URL published on the Outputs tab of the CloudFormation stack. The following screenshot shows the output:

Screenshot showing the API output

You can use the CLI to visualize the API URL: aws cloudformation describe-stacks --stack-name myServerless-Stack --query Stacks[0].Outputs