首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用run命令执行SSM文档失败的json:无法将数组解封送回Go结构字段RunScriptPluginInput.RunCommand类型为string\“

使用run命令执行SSM文档失败的json:无法将数组解封送回Go结构字段RunScriptPluginInput.RunCommand类型为string\“
EN

Stack Overflow用户
提问于 2022-08-08 09:31:07
回答 1查看 110关注 0票数 -1

我正在用json代码为其中一个应用程序安装和配置创建aws文档。使用run命令执行SSM文档失败的json:无法将数组解封为string类型的结构字段RunScriptPluginInput.RunCommand“。请注意,我只添加了部分bash脚本,这是一个冗长的脚本。这个问题似乎与json代码语法有关。如果有人在这方面提供帮助,很好吗?

代码语言:javascript
复制
{
  "schemaVersion": "2.2",
   "description": "SSM Document to install and configure xyz application",
     "parameters": {
  "TimeoutSeconds": {
  "type": "String",
  "description": "(Optional) The time in seconds for a command to be completed before it is considered to have failed.",
   "default": "3600"
  }
  },
  "mainSteps": [
    {
    "action": "aws:runShellScript",`
    "name": "runShellScript",     
        "timeoutSeconds": "{{ TimeoutSeconds }}",
        "runCommand": [
          "#/bin/bash",
           "aws configure set aws_access_key_id ${sts[0]} --profile $PROFILE",
          "aws configure set aws_secret_access_key ${sts[1]} --profile $PROFILE",
          "aws configure set aws_session_token ${sts[2]} --profile $PROFILE",
          "echo \"credentials stored in the profile named $PROFILE\"",
          "wget -c https://downloads.apache.org/tomcat/tomcat-9/v9.0.34/bin/apache-tomcat-9.0.34.tar.gz",
          "tar xf apache-tomcat-9.0.34.tar.gz -C /opt/tomcat",
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-08-10 02:08:10

这段代码很混乱,不可能部署。请在错误消息下划线,并提供有关如何执行此文档的复杂信息?

  1. 内容不可读,请修改.请关闭这些部分--然后任何人都可以轻松地测试您的代码。在https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-plugins.html#aws-runShellScript
  2. there末尾的
  3. 有额外的、意想不到的标记,
  4. ,您忘记了inputs属性-- #/bin/bash

应该是#!/bin/bash

无论如何,最后,我做了上面的更改,并且它正在工作-我的意思是它的可执行的(在ec2实例上)-外壳命令与aws cli不工作,以及curl,它返回404.

我强烈建议使用yml标准,因为它具有更多的可读性和更多的内置特性。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73275682

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档