I am writing a bash script that will automatically install and configure AWS CLI tools. I am able to install AWS CLI tools but unable to configure it.
My script is something like this:
#!/bin/bash
wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
./awscli-bundle/install -b ~/bin/aws
./awscli-bundle/install -h
aws configure
AWS Access Key ID [None]: ABCDEFGHIJKLMNOP ## unable to provide this data
AWS Secret Access Key [None]: xbdwsdADDS/ssfsfa/afzfASADQASAd ## unable to provide this data
Default region name [None]: us-west-2 ## unable to provide this data
Default output format [None]: json ## unable to provide this data
I wish to do the configuration using this script too. I wish that I can provide these credentials via script so that it prevents manual entry. How can this be done?
the best practice is to install the awscli utility by BASH and copy the file from your own specified location of 2 files
without hitting
command these files will not get created, you can copy and paste the files using bash script and get all the execution done
where credentials contains
and config file contains
This will help you to keep the keys at one place and you can also push the same for your execution for any CMT tool as well like Ansible.
you additionally configure this from the command line which will create the configuration file
Use a configuration file rather than the
aws configure
command. Create a file called~/.aws/config
that looks like this:More info in the docs.