JavaDream aws Install AWS CLI on local system

Install AWS CLI on local system

In this blog we ‘ll learn about how can we install aws cli on local system. AWS cli is use to connect our local system to our aws account. As a developer most of the time we use aws cli to perform our task. Let’s see how can we download and configure aws cli step by step.

We have to follow the below steps.

  • Go to the official website of aws for installing cli. Visit this website https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
  • Or you can directly download the .msi from this URL https://awscli.amazonaws.com/AWSCLIV2.msi
  • We are using windows that is why we are installing .msi. If you are using any other operating system macOS or Linux please follow the official docs and go to particular system guide.
  • After installation just run the .msi file and follow the wizard
  • It’s time to verify that if it is successfully install or not. Run below command in your command prompt.
aws --version

You ‘ll get the output like below screenshot.

Configure AWS CLI

After installation of aws cli we have to configure it. First let’s understand what does configure means. Configure means we have to setup aws cli (command line interface) on our local machine. This step is very essential to authenticate and enabling our aws cli to interact with our aws account. Because as a developer we rarely use the AWS portal most of the work we do from aws cli.

For configuring aws cli we have to run the below command on our command prompt.

aws configure

When you run the above command some prompt ‘ll come up. We have to provide those details only and after that we are good to use aws cli. Let’s see what’s those prompt are.

AWS Access Key ID [None]
AWS Secret Access Key [None]
Default region name [None]
Default output format [None]Code language: CSS (css)

Above are some prompt that ‘ll come up after aws configure command. Now see how can we find these values. Basically these are the user details and you can find these details on below location. If you have any user created you ‘ll see that user on below location and fetch the details as per the steps provided below. But if you are a root user and haven’t created any user yet and want the Access and secret key for root user you have to follow other process that we discuss later in this blog.

Using root user access and secret key is risky you can use it for following this blog but we recommend you create a user and use the key of user. For example and knowledge purpose we ‘ll show you how to get access and secret key for root user in later section of this blog.

For getting user access and secret key follow below directions. Refer screenshot for your reference.

AWS Console → IAM → Users → Security Credentials tab
Steps
  1. In aws search bar type IAM and from drop down just select that.
  2. On IAM screen on left hand click on users.
  3. Select the user
  4. Click on Create access key and follow the wizard.
  5. You ‘ll get your access and secret key just copy them.

We have are keys now. Just run the aws configure command and put the details. See below screenshot for your reference.

Root user Access and Secret key

This is not the recommended approach to use root user access and secret key to configure local system aws cli. Generally we use access and secret key only for users not for the root user. But for this example and your knowledge purpose we are showing how to get access and secret key of root user. To get these detail of root user we have to follow the below step. You can refer the screenshot for your reference for each step.

Steps
  • On top right corner of you console click on the user.
  • Click on Security credentials
  • A window ‘ll come scroll down and look for the Access keys section. On this you get a button for Create access key just click on that button
  • You ‘ll see new window. You can see on suggestion they mention that this is not a recommended approach. Just click the checkbox and click the button for Create access key
  • You ‘ll get your access and secret key

after configure the cli. You can run the below command to see all the configure list.

aws configure listCode language: PHP (php)

When we run aws configure command it by default create a hidden folder with name .aws at below location.

C:\Users\<your-username>\.awsCode language: HTML, XML (xml)

You can open this folder. You ‘ll see two files inside this folder config and credentials. In config you can see region and output details that we set. And in credentials file our aws access and secret key present. You can open these files on notepad or any editor and can verify.

Reference

AWS CLI Installation official docs.

Other blogs you may like

Create Docker image of spring boot project detailed example.

Send SMS to client using Spring boot and Twilio

If you like this blog please share with others and give your feedback in our comment section. Please let us know if you need blog on any particular topic.
You can mention the topic in comment section we ‘ll try our best to cover that topic in our upcoming blog.

Thanks

Share with others

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post