Once your app has been built and tested successfully, you are ready to deploy it to AWS.
This command uses your default AWS Profile and the region and stage specified in your
By default, the stacks in a CDK app can be deployed to multiple AWS accounts and regions. This doesn't work well when trying to support a separate development environment. Like the one
sst start creates.
To fix this, SST has the notion of stages. An SST app can be deployed separately to multiple environments (or stages). A stage is simply a string to distinguish one environment from another.
Behind the scenes, SST uses the name of the app and stage to prefix the resources in the app. This ensures that if an app is deployed to two different stages in the same AWS account, the resource names will not clash. You can also prefix resource names in your stacks by calling the
logicalPrefixedName method in
So if you want to deploy to a stage called prod:
And if your prod environment is in a different AWS account or region, you can do:
If you are using
npm run deploy, you'll need to add an extra
-- for the options.
For example, to set the stage and region:
Finally, you can remove all your stacks and their resources from AWS using.
Or if you've deployed to a different stage.
Note that this command permanently removes your resources from AWS. It also removes the stack that's created as a part of the debugger.