当前,我正在尝试使用Systems Manager在EC2实例上执行AWS CLI命令。我希望系统管理员运行以下命令:
aws s3 cp <origin directory> s3://<destination directory>
但是当我通过AWS-RunPowerShellScript文档运行它时,这是我收到的输出:
aws : The term 'aws' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\ProgramData\Amazon\SSM\InstanceData\i-
06a4de60a263996a1\document\orchestration\11f5777e-08c8-4385-9ab4-cdc85c846f
24\awsrunPowerShellScript\0.awsrunPowerShellScript\_script.ps1:1 char:1
+ aws s3 cp C:\private s3://private
+ ~~~
+ CategoryInfo : ObjectNotFound: (aws:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
当我RDP进入Windows实例并执行相同的命令时,该文件将被放到AWS的S3存储桶中而没有任何问题。
我在这里错过了什么吗,还是有更好的方法呢?我正在尝试使此过程尽可能可脚本化,而不需要SSH连接。感谢所有输入,谢谢!
答案 0 :(得分:1)
我相信AmazonSSMAgent需要重新启动以获取对Path变量的更改。
答案 1 :(得分:0)
如以上评论所述,AWS Systems Manager使用的用户未将AWS CLI添加为PATH变量。