Install Amazon CLI Tools

Install Amazon CLI Tools

Introduction

Amazon comes with Command Line Interface (CLI) and AMI Tools to manage the instances. CLI tools can be used to create and manage resources for EC2, EBS, and VPC. Whereas, AMI tools can be used to create and manage instance-store backed Linux AMIs. The AWS CLI is a unified tool to manage AWS services. Amazon documentation has very detailed instructions on how to set up these but the main aim of this post is to quickly set up with CLI tools and start using them. This post shows how to install, configure, and verify Amazon CLI tools as this is the basic set up which will be a pre-requisite for many upcoming blog posts.

Use Case

This use case shows how to install and configure Java, and AWS CLI tools on Ubuntu, and perform some verification on the set up to ensure the proper working of the CLI tools.
What we need to do:

  • Download & Install Java 1.7
  • Download & Install AWS CLI Tools
  • Set up Environment Variables
  • Verify Setup

Solution

Install Java 1.7:

  • Download Java 1.7:
  • Configure Java 1.7: 
  • Verify:

Download & Install AWS CLI Tools:

  • Download AWS CLI Tools:
  • Configure AWS CLI Tools:

Set up Environment Variables:

  • JAVA_HOME Environment Variable:
  • CLI Tools Environment Variable: 
  • Refresh Profile File:

The  screenshot given below shows how it looks like:

profile file

Verify Setup:

  • Describe Regions:

$ ec2-describe-regions

Describe regions

  • Describe Instances in a Region:

$ ec2-describe-instances –region us-west-2

instance in a region

  • Describe Instance Status:

$ ec2-describe-instance-status –region us-west-2 i-16845d1d

instance status

Conclusion

  • Amazon web-based Console has lot of functionalities with respect to launching instances, assigning security groups, creating EBS volumes, and others. However, Amazon CLI tools can be scripted for easy management and certain functionalities like Auto-Scaling and others are only possible with CLI tools.
  • With just one CLI tool, it’s possible to control multiple AWS services from the command line and automate them through scripts.

References

  • CLI Commands:

http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/command-reference.html

2956 Views 5 Views Today