App construct extends
cdk.App and is used internally by SST to:
- Automatically prefix stack names with the stage and app name
- Deploy the entire app using the same AWS profile and region
It is made available as the
app in the
lib/index.js of your SST app.
Since it is initialized internally, the props that are passed to
App cannot be changed.
The properties of the app can be accessed in the
You can set some function props and have them apply to all the functions in the app.
Or if you need to access the
Stack scope, you can pass in a callback.
You can also call
setDefaultFunctionProps multiple times, and the props from each call will be merged. If a property is set more than once, the last value will be taken. Except for the
layers, and the
permissions properties, that will be merged.
So in the above example, the functions by default will have a
256MB, and both the
TABLE_NAME and the
BUCKET_NAME environment variables set.
The following properties are made available in addition to the properties of
The name of the app. This comes from the
name in your
The stage the app is being deployed to. If this is not specified as the
--stage option in the CLI, it'll default to the
stage in your
The region the app is being deployed to. If this is not specified as the
--region option in the CLI, it'll default to the
region in your
The AWS account the app is being deployed to. This comes from the IAM credentials being used to run SST.
FunctionProps | ((stack: cdk.Stack) => FunctionProps)
The default function props to be applied to all the Lambda functions in the app. These default values will be overridden if a
Function sets its own props. Except for the
layers, and the
permissions properties, which will be merged.
Use this method to prefix resource names in your stacks to make sure they don't thrash when deployed to different stages in the same AWS account. This method will prefix a given resource name with the stage and app name. Using the format