Using AWS CLI within a powershell script

Hi there,

I have been attempting to use the AWS CLI within a poweshell script as one of my deployment steps. I have installed the CLI on my Octopus server and have tested the command that I need to run by opening up a powershell window and running it manually. It runs fine doing this, however when I add the script to the step and run I get the following error:

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.

  • CategoryInfo : ObjectNotFound: (aws:String) [], ParentContainsErrorRecordException
  • FullyQualifiedErrorId : CommandNotFoundException

I’m not sure how the powershell script is run by Octopus Deploy and wanted to see if you could help point me in the right direction.
Thanks

I have solved my issue. I was attemting to run the regular AWS CLI commands in the powershell script which why it was failing. I found the equivallent powershell aws cli version and it now works. This is a bit odd as you can use these regular CLI commands in a powershell window which is what through me off.

I had the same issue. Restarting the octopus service allowed the normal aws cli commands to work like:

aws s3 cp <etc etc etc