Heading image

Prerequisites

  1. Basic familiarity with AWS CDK for TypeScript.
  2. Read the first two posts in the “Working with the TypeScript AWS CDK” series.
  1. Familiary with DynamoDB. This post will not be an overview of DynamoDB development.

Getting started

Writing a single-table construct

  1. Instantiating the table.
  2. Add a global secondary index GSI1.
  3. Add a global secondary index GSI2.
  1. tableProps to extend our table without allow the user to alter the partitionKey or sortKey.
  2. Optional GSI1Props to extend the first global secondary index without being able to alter the indexName, partitionKey or sortKey.
  3. Optional GSI2Props to extend the second global secondary index without being able to alter the indexName, partitionKey or sortKey.

Instantiating the table

Adding the first global secondary index

Adding the second global secondary index

Adding the construct to our app

Deploying to LocalStack

Teardown

Summary

Resources and further reading

  1. AWS CDK for TypeScript
  2. Final code
  3. awslocal package
  4. “Working with the TypeScript AWS CDK” series
  5. AWS CDK With TypeScript Foundations
  6. Using The AWS CDK With LocalStack And aws-cdk-local
  7. DynamoDB

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store