Quick Start
SST is a collection of npm packages that allow you to create a serverless app. You can define your apps with a combination of Infrastructure as Code (using CDK) and Lambda functions.
To use SST you'll need:
- Node.js >= 10.15.1
- An AWS account with the AWS CLI configured locally
Getting started
Create a new project using.
- npx
- npm
- yarn
npm init sst@latest my-sst-app
cd my-sst-app
npm install
npx create-sst@latest my-sst-app
cd my-sst-app
npm install
yarn create sst my-sst-app
cd my-sst-app
yarn
Starting local environment
The first time the SST command is run, you'll be prompted to enter a default stage name to use. The stage name will be stored locally in a .sst/ directory. This directory is automatically ignore from Git.
The initial deploy can around 5-10 minutes. It will deploy your app to AWS, and also setup Live Lambda dev environment.
- npx
- npm
- yarn
npm run start
npx sst start
yarn run start
This command uses your default AWS Profile and the region specified in your sst.json
. If you want to use a different AWS account or region, you can do:
- npx
- npm
- yarn
# requires an extra `--` for the options
AWS_PROFILE=my-profile npm run start -- --region eu-west-1
AWS_PROFILE=my-profile npx sst start --region eu-west-1
AWS_PROFILE=my-profile yarn run start --region eu-west-1
Using SST Console
The SST Console is a web based dashboard to manage your SST apps. Once sst start
is up and running, you should see the following printed out in the terminal.
==========================
Starting Live Lambda Dev
==========================
SST Console: https://console.serverless-stack.com/my-sst-app/frank/local
Debug session started. Listening for requests...
Open the SST Console in the browser.
Deploying an app
Once your app has been built and tested successfully, you are ready to deploy it to AWS.
- npx
- npm
- yarn
# requires an extra `--` for the options
npm run deploy -- --stage prod
npx sst deploy --stage prod
yarn run deploy --stage prod
Similarly, to deploy to a different AWS account or region, you can do:
- npx
- npm
- yarn
# requires an extra `--` for the options
AWS_PROFILE=my-profile npm run deploy -- --stage prod --region eu-west-1
AWS_PROFILE=my-profile npx sst deploy --stage prod --region eu-west-1
AWS_PROFILE=my-profile yarn run deploy --stage prod --region eu-west-1
Using SST Console
This allows you look at logs in production and manage resources in production as well.
- npx
- npm
- yarn
# requires an extra `--` for the options
npm run console -- --stage prod
npx sst console --stage prod
yarn run console --stage prod
Removing an app
Finally, you can remove all your stacks and their resources from AWS using.
- npx
- npm
- yarn
npm run remove
npx sst remove
yarn run remove
Or if you've deployed to a different stage.
- npx
- npm
- yarn
# requires an extra `--` for the options
npm run remove -- --stage prod
npx sst remove --stage prod
yarn run remove --stage prod
Note that this command permanently removes your resources from AWS. It also removes the stack that's created as a part of the debugger.