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
npm run build
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.
npm run deploy [stack]
Deploy all your stacks to AWS. Or optionally deploy, a specific stack.
npm run remove [stack]
Remove all your stacks and all of their resources from AWS. Or optionally removes, a specific stack.
npm test
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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。