如何给cloudformation.createStack提供参数?
How to supply parameters to the cloudformation.createStack?
正如 here 所述,有一种方法可以使用 cloudformation 模板创建和部署堆栈。我不明白的是如何提供自定义参数,例如 userPoolName
、autoVerifiedAttributes
或 mfaConfiguration
.
非常感谢你的帮助?
您将用于创建和部署堆栈的工具将公开此功能。
例如。如果您使用的是 AWS CLI,您可以通过以下方式进行操作:
aws cloudformation create-stack --stack-name startmyinstance
--template-body file://home/ec2-user/templates/startmyinstance.json
--parameters ParameterKey=KeyPairName,ParameterValue=MyKey ParameterKey=InstanceType,ParameterValue=t1.micro
在 blog post or the official CLI docs 中阅读更多相关信息。
要了解有关参数本身的更多信息,您可以参考 AWS Cloudformation docs。
如果您使用的是 AWS Python SDK、Boto3,您会发现它可以作为参数访问,如下所示:
response = client.update_stack(
StackName='string',
Parameters=[
{
'ParameterKey': 'string',
'ParameterValue': 'string',
'UsePreviousValue': True|False,
'ResolvedValue': 'string'
},
],
)
在官方文档中阅读更多相关信息 here。任何其他语言的 SDK 也是如此。
编辑 1:为 Python 添加示例 - Boto3
正如 here 所述,有一种方法可以使用 cloudformation 模板创建和部署堆栈。我不明白的是如何提供自定义参数,例如 userPoolName
、autoVerifiedAttributes
或 mfaConfiguration
.
非常感谢你的帮助?
您将用于创建和部署堆栈的工具将公开此功能。
例如。如果您使用的是 AWS CLI,您可以通过以下方式进行操作:
aws cloudformation create-stack --stack-name startmyinstance
--template-body file://home/ec2-user/templates/startmyinstance.json
--parameters ParameterKey=KeyPairName,ParameterValue=MyKey ParameterKey=InstanceType,ParameterValue=t1.micro
在 blog post or the official CLI docs 中阅读更多相关信息。
要了解有关参数本身的更多信息,您可以参考 AWS Cloudformation docs。
如果您使用的是 AWS Python SDK、Boto3,您会发现它可以作为参数访问,如下所示:
response = client.update_stack(
StackName='string',
Parameters=[
{
'ParameterKey': 'string',
'ParameterValue': 'string',
'UsePreviousValue': True|False,
'ResolvedValue': 'string'
},
],
)
在官方文档中阅读更多相关信息 here。任何其他语言的 SDK 也是如此。
编辑 1:为 Python 添加示例 - Boto3