我在 SSM 文档中有以下步骤。调用的结果是一个 Json,所以我想将其解析为 stringMap(这似乎是它的正确类型),而不是为我想要引用的每个变量创建输出
我尝试将其引用为:
{{ GetLoadBalancerProperties.Description.Scheme }}
和
{{ GetLoadBalancerProperties.Description[\"LoadBalancerName\"] }}
在这两种情况下,我都会收到一条错误消息,指出变量从未定义
{
"name": "GetLoadBalancerProperties",
"action": "aws:executeAwsApi",
"isCritical": true,
"maxAttempts": 1,
"onFailure": "step:deleteParseCloudFormationTemplate",
"inputs": {
"Service": "elb",
"Api": "describe-load-balancers",
"LoadBalancerNames": [
"{{ ResourceId }}"
]
},
"outputs": [
{
"Name": "Description",
"Selector": "$.LoadBalancerDescriptions[0]",
"Type": "StringMap"
}
]
}
这是实际的消息:
Step fails when it is validating and resolving the step inputs. Failed to resolve input: GetLoadBalancerProperties.Description["LoadBalancerName"] to type String. GetLoadBalancerProperties.Description["LoadBalancerName"] is not defined in the Automation Document.. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.
最佳答案
我相信您正在寻找的答案就在这里: https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-plugins.html#top-level-properties-type
仅举几个例子:
Map 类型是 Python 字典,因此如果您的输出是字典,则应在 SSM 文档中使用 StringMap。
虽然List类型与Python列表相同。
因此,如果您的输出是字典列表,则您要使用的类型是 MapList。
关于amazon-web-services - 如何在SSM文档中使用StringMap参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58607754/