Thursday, May 24, 2018

How to install & configure the AWS CLI on Windows system

One can easily use AWS Management Console to manage their AWS services but if one wants to access & manage their AWS services programmatically then one could install & configure AWS CLI. Today we would be discussing, how to install & configure AWS CLI in Windows systems.
Table Of Content:
1. Introductions
2. Installing the AWS CLI
3. Configuring the AWS CLI
4. Conclusion


1. Introduction


The AWS CLI is supported on Microsoft Windows XP or later and could be installed either by using a MSI installer or by using pip, a package manager for Python. We would be using MSI installer because we don't want to install Python or PIP for the moment. If one prefers to always use the latest version of the AWS CLI then it's recommended to use the pip[1] because with pip, it's just a matter of executing a single command to upgrade the AWS CLI version.

2. Installing the AWS CLI


For installing the AWS CLI, one need to download[Windows (64-bit) & Windows (32-bit) ) the appropriate MSI installer and then run the downloaded MSI installer. By default, the AWS CLI would be installed to C:\Program Files\Amazon\AWSCLI (64-bit) or C:\Program Files (x86)\Amazon\AWSCLI (32-bit) directory.

To confirm the installation, hit the aws --version command at a command prompt.
D:\anshulsblog>aws --version
aws-cli/1.15.24 Python/2.7.9 Windows/7 botocore/1.10.24

D:\anshulsblog>

Note: If Windows is unable to find the executable, one may have to re-open the command prompt or add the installation directory to the PATH environment variable manually.

3. Configuring the AWS CLI


AWS Access Key ID & Secret access key is required for programmatically accessing the AWS services using the AWS CLI. Don't have access keys then see appendix section[2]. 

To configure the AWS CLI, hit aws configure command in the command prompt. It would prompt us to enter AWS Access Key ID, AWS Secret Access Key, Default region name & Default output format. The formatting style for command output could be json, text or table. Accordingly provide the required information and we are good to go.

To verify, whether the AWS CLI is configured properly, one could hit any AWS command like aws s3 ls command to see the list of all the S3 buckets. 


Note: The AWS CLI signs requests on our behalf, and includes a date in the signature. One need to ensure that their computer's date and time are set correctly; if not, the date in the signature may not match the date of the request, and AWS could rejects the request.

4. Conclusion


For system administrators and command line interface(CLI) lovers, AWS CLI provides a great way to manage the AWS resources and services. So now as the AWS CLI is configured, start playing with it. Happy Learning!!


Appendix:

[1]:
If pip is installed in one's windows system then simple running pip install awscli command will install the AWS CLI. Then one could verify the installation using aws --version command. Also, to upgrade the AWS CLI version to its latest version, execute pip install --user --upgrade awscli command.  

[2]: One can create these access keys from the AWS Management Console using the IAM. IAM lets us securely control access to AWS services and resources in our AWS account. It's recommended that one should use IAM access keys instead of AWS account root user access keys. 
Note: The only time that we can view or download the secret access keys is when we create the keys. We cannot recover them later. However, we can create new access keys at any time. 

No comments:

Post a Comment