Reputation: 165
I am trying to create a "aws_configure.bat" file which will run aws commands. I need to configure "aws_configure.bat" file as windows task. I created my script with below content.
aws configure set AWS_ACCESS_KEY_ID <mykey>
aws configure set aws_secret_access_key <myskey>
aws configure set region us-west-2
aws dynamodb list-tables
When I am trying to run this script then its printing the first line in cmd window. Can someone please suggest what is the problem here. Why my script is not able to run the aws cli commands. (I have installed aws cli in my system and when i am running these commands directly in cmd window, everything is working fine).
Upvotes: 0
Views: 5450
Reputation: 13632
You should consider creating and configuring your AWS credentials outside of your batch file, then referencing the named profile from the batch file.
Run aws configure --profile myprofile
, and provide the information required.
Then from your batch file, call aws dynamodb list-tables --profile myprofile
.
To setup the prefered/default profile, set AWS_PROFILE=myprofile
in system environment. With this method, you will not need to reference the profile in the batch file.
Upvotes: 2