Hello I have a SQL Server Job with a CmdExec
step that goes like this:
powershell.exe -file D:\Script\test.ps1
currently the PowerShell script is simply this:
aws s3 ls s3://backup-sql-day/
and curiously the job runs sucessesfully, and there's this message.
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 D:\Script\teste.ps1:1 char:1 + aws s3 ls s3://backup-sql-day/ + ~~~ + CategoryInfo : ObjectNotFound: (aws:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException.Process Exit Code 0. The step succeeded.
So the script doesn't run, doesn't report me the error, the thing is I cannot seem to run any AWS script on the SQL Server Job, however I can run it normally with any user, does anybody have a clue on how to fix this?
If the aws command cannot be found after first installing or updating the AWS CLI, you might need to restart your terminal for it to recognize any PATH updates. If the aws command cannot be found after first installing or updating the AWS CLI, it might not have been fully installed.
To validate a user's credentials with the AWS CLI, run the sts get-caller-identity command. The command returns details about the user's credentials if they are valid, otherwise it throws an error. Copied!
Use the describe-configuration-recorder-status command to check that the AWS Config has started recording the configurations of the supported AWS resources existing in your account. The recorded configurations are delivered to the specified delivery channel.
An "Unable to locate credentials" error indicates that Amazon S3 can't find the credentials to authenticate AWS API calls. To resolve this issue, make sure that your AWS credentials are correctly configured in the AWS CLI.
The (unmangled) error message is actually rather self-explanatory. The script does run, but cannot find the aws
commandline tool. Either the path to the AWS CLI installation isn't included in the PATH
environment variable, or the SQL Server job ignores the system environment.
You can work around the issue by adding the path inside your script:
$env:Path += ';C:\Program Files\Amazon\AWSCLI'
aws s3 ls s3://backup-sql-day/
Replace C:\Program Files\Amazon\AWSCLI
with whichever folder the tool was installed to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With