我正在用json代码为其中一个应用程序安装和配置创建aws文档。使用run命令执行SSM文档失败的json:无法将数组解封为string类型的结构字段RunScriptPluginInput.RunCommand“。请注意,我只添加了部分bash脚本,这是一个冗长的脚本。这个问题似乎与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",发布于 2022-08-10 02:08:10
这段代码很混乱,不可能部署。请在错误消息下划线,并提供有关如何执行此文档的复杂信息?
inputs属性-- #/bin/bash应该是#!/bin/bash。
无论如何,最后,我做了上面的更改,并且它正在工作-我的意思是它的可执行的(在ec2实例上)-外壳命令与aws cli不工作,以及curl,它返回404.
我强烈建议使用yml标准,因为它具有更多的可读性和更多的内置特性。
https://stackoverflow.com/questions/73275682
复制相似问题