[英]AWS Cloudformation Template Parameters for SAM Local
In SAM Local's template.yaml
, is it possible to define a set of parameters such that they become Cloudformation parameters? 在SAM Local的template.yaml
,是否可以定义一组参数以使它们成为Cloudformation参数?
The reason I want this is I'd like to create a Launch Stack Url that allows the user to provide Cloudformation parameter values. 我想要这样做的原因是我想创建一个启动堆栈网址 ,允许用户提供Cloudformation参数值。
After fiddling around a bit this looks possible. 经过一番摆弄之后,这看起来是可能的。 You need to define a root level Parameters
as you would for a normal cloudformation template. 您需要像对常规cloudformation模板一样定义根级别Parameters
。 Hence here is what mine looks like: 因此,这是我的样子:
AWSTemplateFormatVersion: '2010-09-09'
Globals:
Function:
Timeout: 300
...
Parameters:
MyUserParameter:
Type: String
Resources:
HelloWorldFunction:
Properties:
CodeUri: s3://blah/blah
Environment:
Variables:
FOO: bar
Events:
CatchAll:
Properties:
Method: GET
Path: /hello
Type: Api
Handler: hello-world
Runtime: go1.x
Tracing: Active
Type: AWS::Serverless::Function
Transform: AWS::Serverless-2016-10-31
As n00b said 如n00b所说
You need to define a root level Parameters 您需要定义一个根级别参数
But those parameters become sorted alphabetically in the configuration. 但是这些参数在配置中按字母顺序排序。 If you want to organize them as it is in your link, you have to use Metadata: 如果要按链接中的方式组织它们,则必须使用元数据:
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: Name of your parameter group
Parameters:
- Parameter
ParameterLabels:
ParameterName:
default: Complete name of your parameter with spaces if you want
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-interface.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-interface.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.