Variables are the values that can be passed to the configuration values within the serverless.yml while running the Serverless Framework command. They need to pass reference values enclosed in ${} brackets, but you can use variables in property values rather than in the property keys. The following code shows how this is added in the serverless.yml file:
provider: name: aws stage: ${opt:stage, 'dev'}
In the following statement, we pass the parameter to the CLI and the stage value is populated in the serverless.yml file:
$ serverless deploy --stage qa
The variables can be used recursively as reference properties—that is, we can combine multiple values and variable sources, as shown in the following environment variable: ...