amazon-web-services - 如何在SSM文档中使用StringMap参数?

标签 amazon-web-services aws-ssm amazon-systems-manager

我在 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/

相关文章:

amazon-web-services - 云形成模板中Json格式错误

kubernetes - 如何从存储在 AWS 系统管理器中的参数获取 Kubernetes Secret

amazon-web-services - 在维护时段任务中配置 SNS 主题通知 IAM 角色

python - "KeyError: ' 在 AWS S3 中记录 '"- Lambda 触发器

amazon-web-services - Lambda 函数在代码管道中永远不会成功

java - 不支持 AWS SAM CLI java8 运行时

php - 如何判断 Elastic Beanstalk 是否正在运行我的配置文件?

reactjs - 在 aws amplify React js 应用程序中访问 SSM 参数存储值

amazon-web-services - 在 Systems Manager 中激活后更改/添加托管实例的名称

amazon-web-services - 从 VPC/Lambda 访问 Parameter Store