SSM文档无法引用ssm安全参数。我能够从github来源使用ssm运行命令,但无法为其创建文档。
aws ssm send-command --document-name "AWS-RunRemoteScript" --document-version "1" --targets "Key=instanceids,Values=i-11111111111111111" --parameters '{"sourceType":["GitHub"],"sourceInfo":["{\"owner\":\"abc\",\"repository\":\"defgh\",\"path\":\"new_python.py\",\"getOptions\":\"branch:development\",\"tokenInfo\":\"{{ssm-secure:github_read}}\"}"],"commandLine":["cd /home/ubuntu/production_code && sudo chmod 777 * && sudo -u ubuntu /usr/bin/python3 new_python.py"],"workingDirectory":["/home/ubuntu/production_code"],"executionTimeout":["3600"]}' --timeout-seconds 600 --max-concurrency "50" --max-errors "0" --output-s3-bucket-name "aws-glue-notebooks-dfsdfdsfds-us-east-1" --region us-east-1
上面的命令工作得很好,但是当我尝试为其创建文档时,出现以下错误。
我的自动化文档如下
description: "Automation Document Example JSON Template"
schemaVersion: "0.3"
assumeRole: "arn:aws:iam::11111111111111:role/AutomationServiceRole"
mainSteps:
- name: "runcommand"
action: "aws:runCommand"
maxAttempts: "3"
inputs:
DocumentName: "AWS-RunRemoteScript"
InstanceIds:
- "i-11111111111111111"
Parameters:
commandLine: "cd /home/ubuntu/production_code && sudo chmod 777 * && sudo -u ubuntu /usr/bin/python3 new_python.py"
executionTimeout : "18000"
sourceInfo : '{"owner":"abc","repository":"defgh","path":"new_python.py","getOptions":"branch:development","tokenInfo":"{{ssm-secure:github_read}}"}'
sourceType: "GitHub"
workingDirectory : "/home/ubuntu/production_code"
我相信是因为令牌信息中提到了ssm sercure。我们需要以不同的方式访问ssm。如果有人做过,请分享您的想法。