[英]SSM document execution using run command failed json: cannot unmarshal array into Go struct field RunScriptPluginInput.RunCommand of type string\"
I'm creating aws ssm document in json code for one of the application installation and configuration.我正在 json 代码中为应用程序安装和配置之一创建 aws ssm 文档。 SSM document execution using run command failed json: cannot unmarshal array into Go struct field RunScriptPluginInput.RunCommand of type string". Please note, i have added only some portion of the bash scripts, this is a lengthy script. The issue seems like something with the json code syntax. Great if anyone help on this? SSM document execution using run command failed json: cannot unmarshal array into Go struct field RunScriptPluginInput.RunCommand of type string". Please note, i have added only some portion of the bash scripts, this is a lengthy script. The issue seems like something with json 代码语法。如果有人能帮上忙吗?
{
"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",
This code is messy and impossible to deploy.这段代码很乱,无法部署。 Could you please underline the error message, and provide complex information about how you execute this document?您能否在错误消息下划线,并提供有关您如何执行此文档的复杂信息?
"action": "aws:runShellScript",
you have additional, unexpected sign,在"action": "aws:runShellScript",
你有额外的,意想不到的标志,inputs
property - https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-plugins.html#aws-runShellScript您忘记了inputs
属性 - https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-plugins.html#aws-runShellScript#!/bin/bash
instead #/bin/bash
应该有#!/bin/bash
而不是#/bin/bash
Anyway, finally, I did the above changes and it is working - I mean it's executable (on ec2 instance) - shell commands with aws
cli don't work, as well as curl, which returns 404...无论如何,最后,我做了上述更改并且它正在工作 - 我的意思是它是可执行的(在 ec2 实例上) - 带有aws
cli 的 shell 命令不起作用,以及返回 404 的 curl ......
I strongly recommend using yml
standard, due to more readability and more build-in features.我强烈建议使用yml
标准,因为它具有更高的可读性和更多的内置功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.