AWS EC2 RunCommand解析问题

时间:2016-12-22 13:08:28

标签: powershell amazon-web-services amazon-ec2 escaping aws-cli

当我尝试使用此简写时,它失败并出现以下错误。我显然没有正确逃避,但我似乎无法解决如何做到这一点。它发生在PowerShell和命令提示符中。

  

未知选项:)aws s3 cp s3://sourcebucket/file1.csv   /opt/local/file1.csv;docker exec $(docker ps | grep" solr" | cut -f1   -d" ")aws s3 cp s3://sourcebucket/file2.csv /opt/local/file2.csv;curl http://localhostreloadfiles' --timeout-seconds 600 - 区域eu-west-10

速记无效:

  

aws ssm send-command --document-name" AWS-RunShellScript" --targets   Key = tag:Name,Values = instancename --parameters commands =' docker exec   $(docker ps grep" solr" | cut -f1 -d"")aws s3 cp   s3://sourcebucket/file1.csv /opt/local/file1.csv;docker exec $(docker   ps | grep" solr" | cut -f1 -d" ")aws s3 cp   s3://sourcebucket/file2.csv /opt/local/file2.csv;curl   http://localhostreloadfiles' --timeout-seconds 600 - 区域eu-west-10

JSON输入有效:

  

aws ssm send-command --document-name" AWS-RunShellScript" --targets   Key = tag:Name,Values = instancename --parameters' {\" commands \":[\" docker   exec $(docker ps | grep \\" containername \\" | cut -f1 -d \\" \\")   bash -c'' aws s3 cp s3://sourcebucket/file1.csv   /opt/local/file1.csv'' \",\\ ## 34; drocker exec $(docker ps | grep \\" solr \\"   | cut -f1 -d \\" \\")bash -c'' aws s3 cp s3://sourcebucket/file2.csv   /opt/local/file2.csv''\",&" curl http://localhost/reloadfiles \"]}'   --timeout-seconds 600 --region eu-west-1

指南和演练都表明它是可能的,我想让我的团队更具可读性和可理解性。

http://docs.aws.amazon.com/cli/latest/reference/ssm/send-command.html http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/walkthrough-cli.html

0 个答案:

没有答案