![](/img/trans.png)
[英]json: cannot unmarshal number into Go struct field .Amount of type string
[英]SSM document execution using run command failed json: cannot unmarshal array into Go struct field RunScriptPluginInput.RunCommand of type string\"
我正在 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 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",
這段代碼很亂,無法部署。 您能否在錯誤消息下划線,並提供有關您如何執行此文檔的復雜信息?
"action": "aws:runShellScript",
你有額外的,意想不到的標志,inputs
屬性 - https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-plugins.html#aws-runShellScript#!/bin/bash
而不是#/bin/bash
無論如何,最后,我做了上述更改並且它正在工作 - 我的意思是它是可執行的(在 ec2 實例上) - 帶有aws
cli 的 shell 命令不起作用,以及返回 404 的 curl ......
我強烈建議使用yml
標准,因為它具有更高的可讀性和更多的內置功能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.