将参数添加到 AWS CloudFormation / CodePipeline 堆栈
Add parameter to an AWS CloudFormation / CodePipeline stack
我在 Lambda 中从 AWS 控制台创建了一个应用程序:
该应用程序使用 sam、云形成、代码管道(在每次推送到 Github 时自动部署)等。它带有一个在 template.yml
中定义的参数:
Parameters:
AppId:
Type: String
但现在我又加了几个:
Parameters:
AppId:
Type: String
CognitoUserPoolName:
Type: String
CognitoUserPoolClientName:
Type: String
我应该在 AWS 的什么地方定义这些值?
注意:我没有通过 运行 sam deploy
进行部署,Code Pipeline 会自动为我部署。这就是“无服务器 API 后端”模板开箱即用的方式。
山姆
您在本地设置Parameter Overrides in the sam deploy
command or in samconfig.toml。
# 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,管道部署阶段 also accept parameter overrides, in the console or with the update-pipeline api 命令。您可以为要部署的堆栈参数值的每个组合创建额外的部署阶段。
无论您如何提供,参数值都是在部署时设置的。您可以在 CloudFormation 控制台中查看已部署堆栈的参数值。
顺便说一句,该选项称为参数 覆盖,因为您可以为每个参数设置默认模板值。
Parameters:
AppId:
Type: String
Default: MySuperApp
我在 Lambda 中从 AWS 控制台创建了一个应用程序:
该应用程序使用 sam、云形成、代码管道(在每次推送到 Github 时自动部署)等。它带有一个在 template.yml
中定义的参数:
Parameters:
AppId:
Type: String
但现在我又加了几个:
Parameters:
AppId:
Type: String
CognitoUserPoolName:
Type: String
CognitoUserPoolClientName:
Type: String
我应该在 AWS 的什么地方定义这些值?
注意:我没有通过 运行 sam deploy
进行部署,Code Pipeline 会自动为我部署。这就是“无服务器 API 后端”模板开箱即用的方式。
山姆
您在本地设置Parameter Overrides in the sam deploy
command or in samconfig.toml。
# 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,管道部署阶段 also accept parameter overrides, in the console or with the update-pipeline api 命令。您可以为要部署的堆栈参数值的每个组合创建额外的部署阶段。
无论您如何提供,参数值都是在部署时设置的。您可以在 CloudFormation 控制台中查看已部署堆栈的参数值。
顺便说一句,该选项称为参数 覆盖,因为您可以为每个参数设置默认模板值。
Parameters:
AppId:
Type: String
Default: MySuperApp