Home > Enterprise >  Add parameter to an AWS CloudFormation / CodePipeline stack
Add parameter to an AWS CloudFormation / CodePipeline stack

Time:12-18

I created an application from the AWS Console, in Lambda:

enter image description here

That app uses sam, cloud formation, code pipeline (deploying automatically on each push to Github), etc. It comes with a parameter defined in template.yml:

Parameters:
  AppId:
    Type: String

but now I added a few more:

Parameters:
  AppId:
    Type: String
  CognitoUserPoolName:
    Type: String
  CognitoUserPoolClientName:
    Type: String

Where in AWS should I define the values for those?

Note: I don't deploy by running sam deploy, Code Pipeline deploys automatically for me. That's how that "Serverless API backend" template works out of the box.

CodePudding user response:

SAM

You set Parameter Overrides in the sam deploy command or in samconfig.toml locally.

# The `--parameter-overrides` option is a string of key-value pairs corresponding to the parameters in your SAM template.
sam deploy --parameter-overrides 'AppId=MyReallySuperApp,CognitoUserPoolName=AppPool' ...etc

CodePipeline

CodePipeline,pipeline deploy stages also accept parameter overrides, in the console or with the update-pipeline api command. You can create additional deploy stages for each combination of a stack's parameter values you wish to deploy.

However you provide them, parameter values are set at deploy-time. You can view a deployed stack's parameter values in the CloudFormation console.

BTW, the option is called Parameter Overrides because you can set a default template value for each Parameter.

Parameters:
  AppId:
    Type: String
    Default: MySuperApp
  • Related