This project uses SST to create the resources in the Serverless Stack guide.
It uses CDK instead of CloudFormation YAML in our note taking app โ https://github.com/AnomalyInnovations/serverless-stack-demo-api
For example, this what creating the DynamoDB table looks like in the two versions.
- Resources:
- NotesTable:
- Type: AWS::DynamoDB::Table
- Properties:
- TableName: ${self:custom.tableName}
- AttributeDefinitions:
- - AttributeName: userId
- AttributeType: S
- - AttributeName: noteId
- AttributeType: S
- KeySchema:
- - AttributeName: userId
- KeyType: HASH
- - AttributeName: noteId
- KeyType: RANGE
- # Set the capacity to auto-scale
- BillingMode: PAY_PER_REQUEST
+ const table = new dynamodb.Table(this, "notes", {
+ partitionKey: { name: 'userId', type: dynamodb.AttributeType.STRING },
+ sortKey: { name: 'noteId', type: dynamodb.AttributeType.STRING },
+ billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
+ });
Start by forking or cloning this repo.
Then install the dependencies.
$ npm install
Build your app and synthesize your stacks.
Generates a build/
directory with the compiled files and a build/cdk.out/
directory with the synthesized CloudFormation stacks.
Deploy all your stacks to AWS. Or optionally deploy, a specific stack.
Remove all your stacks and all of their resources from AWS. Or optionally removes, a specific stack.
Runs your tests using Jest. Takes all the Jest CLI options.
Learn more about the Serverless Stack Toolkit.
Follow us on Twitter, join our chatroom, or post on our forums.