【问题标题】:aws Download Content in Yamlaws 在 Yaml 中下载内容
【发布时间】:2019-08-02 16:30:19
【问题描述】:

尝试格式化我的 yaml 以下载 S3 存储桶中的脚本以在 SSM 中运行。

我尝试了许多不同的格式,但所有示例似乎都是 JSON 格式的

- action: aws:downloadContent
  name: downloadContent
  inputs:
    sourceType: "S3"
    sourceInfo: 
      path: https://bucket-name.s3.amazonaws.com/scripts/script.ps1
    destinationPath: "C:\\Windows\\Temp"

失败并显示以下消息:

standardError": "invalid format in plugin properties map[destinationPath:C:\\Windows\\Temp sourceInfo:map[path:https://bucket-name.s3.amazonaws.com/scripts/script.ps1] sourceType:S3]; \nerror json: cannot unmarshal object into Go struct field DownloadContentPlugin.sourceInfo of type string"

【问题讨论】:

    标签: amazon-web-services yaml ssm


    【解决方案1】:

    这就是最终对我有用的东西:

        - action: aws:downloadContent
          name: downloadContent
          inputs:
            sourceType: S3
            sourceInfo: "{\"path\":\"https://bucket-name.s3.amazonaws.com/scripts/script.ps1\"}"
          destinationPath: "C:\\Windows\\Temp"
    

    我需要在 YAML 中嵌入准确的 JSON 语法。

    【讨论】:

      【解决方案2】:

      也发布 JSON 示例,因为我们很难在 json 中找到有效的示例。希望这对将来的某人有所帮助。

      我们的错误与“sourceInfo”键有关:

      > invalid format in plugin properties map[destinationPath:C:\PATHONTARGETSYSTEM sourceInfo:map[path:https://S3BUCKETNAME.s3.amazonaws.com/SCRIPTNAME.ps1] sourceType:S3]; error json: cannot unmarshal object into Go struct field DownloadContentPlugin.sourceInfo of type string
      

      最终解决方案是错误的 S3 url 格式 + 错误的 json 格式。应该是这样的:

      "sourceInfo": "{\"path\": \"https://s3.amazonaws.com/S3BUCKETNAME/SCRIPTNAME.ps1\"}",
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-04
        • 2018-05-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多