Thursday, October 25, 2018

Install AWS Command Line Interface (CLI) on Ubuntu 18.04 LTS

AWS CLI or Amazon Web Service Command Line Interface is a command line tool for managing and administering your Amazon Web Services. AWS CLI provides direct access to the public API (Application Programming Interface) of Amazon Web Services. Since it’s a command line tool, you can also use it to create scripts for automating your Amazon Web Services.

Prerequisites: 
  • Ubuntu 18.04 box 
  • A User with sudo access
Step 1- Update packages repository:
In order to start the installation of AWS CLI, First, update repositories' metadata followed by the commands below.
$ sudo apt update

Step 2- Install AWS CLI:

AWS CLI available in Ubuntu official repository, Run the following command to start AWS CLI installation.
$ sudo apt install awscli
Press Y during the installation when it prompt.
Once the installation is done, run the following command to check the installed version.
$ aws --version
AWS CLI Version 1.14.44 has been installed with Python-3.6 version.

Step 3- Configure AWS CLI:
After successful installation of AWS CLI, Let's configure our credentials to execute and manage our AWS resources using CLI.

$ aws configure

AWS Access Key ID [None]: AKIAJHC7EEWFSSuYUYUU
AWS Secret Access Key [None]:
1JKjii879jkjkfkslfie99r9lksfjlkKJVLL
Default region name [None]:
us-east-1
Default output format [None]:
table

After running the command "aws configure" enter AWS Access Key, Secret Key, Default region and default output.

Step 4- Test AWS CLI & Access:
Let's test our AWS CLI configuration by running the following commands.

List S3 buckets:
$ aws s3 ls s3://bucketname
All subfolders are listing from my bucket.

AWS CLI working as expected. Now you can configure the commands as per your requirement. 

Stop EC2 Instance:

$ aws ec2 stop-instances --instance-ids i-3489eegh
In the above command change your Instance ID and run the command. I will stop your instance.

Start EC2 Instance:

$ aws ec2 start-instances --instance-ids i-3489eegh
Using the above command you can easily start your instance.

Thank you for reading my blog, Please leave your comments to make it better!!

2 comments:

  1. Thanks for posting such a Useful information .You done a great job.
    AWS Devops Online Training

    ReplyDelete
  2. Thanks for your informative blog!!! Keep on updating your with such awesome information.
    AWS Online Training

    ReplyDelete

Note: Only a member of this blog may post a comment.

How to Setup Chef Workstation, Hosted Chef Server and Configure Node using Chef cookbook

Chef:   Chef is a powerful tool for automation that transforms infrastructure into code. Whether you're operating in the cloud or on-pre...