在AWS Service Catalog中,可以在生成产品Stack(ProductStack)时将参数传递给Stack,在Stack启动时使用这些值。以下是一些步骤,以及如何在模板中使用它们。
"Parameters": {
"InstanceType": {
"Type": "String",
"Description": "The instance type for the EC2 instance"
},
"KeyName": {
"Type": "AWS::EC2::KeyPair::KeyName",
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"MinLength": "1",
"MaxLength": "64",
"AllowedPattern": "[\\x20-\\x7E]*",
"ConstraintDescription": "can contain only ASCII characters."
}
}
aws servicecatalog create-provisioning-artifact \
--accept-language en \
--product-id prod-abcdefghi \
--parameters file://params.json \
--path-id path-1a2b3c4d5e
[
{
"Key": "InstanceType",
"Value": "m1.small",
"UsePreviousValue": false
},
{
"Key": "KeyName",
"Value": "my-keypair",
"UsePreviousValue": false
}
]
"Properties": {