Install Amazon EC2 api tools on Ubuntu Linux

Amazon EC2 api tools have fairly handy utilities to get information and perform various AWS tasks on your instance. Here are quick steps to install ec2-api-tools package on Amazon EC2 Ubuntu Linux. Note that there are many others tools also listed at Amazon web services developers tools. We’ll stick to Amazon EC2 api tools (ec2-api-tools) for the purpose of this tutorial.

  1. First add AWS tools repository.
    $ sudo apt-add-repository ppa:awstools-dev/awstools

    To see what got added

    $ cat /etc/apt/sources.list.d/awstools-dev-awstools-trusty.list 
    deb trusty main
    # deb-src trusty main

    In case you need to remove it later:

    $ sudo apt-add-repository -r ppa:awstools-dev/awstools
  2. Update apt packages index and install ec2-api-tools
    $ sudo apt-get update
    $ sudo apt-get install ec2-api-tools
  3. Check if api cli tools are working. You will need aws access id , secret key and region for it. You can obtain keys from AWS IAM console. US west coast, region may look like us-west-1. To find the instance type, you can first find instance id using ec2metadata on EC2 instance itself.

    $ ec2metadata | grep instance-id | awk -F": " '{print $2}'

    Then run ec2dinatt (or ec2-describe-instance-attribute) on above instance_id.

    $ ec2dinatt -O AWSAccessKeyId -W AWSSecretKey --region region i-i-4020bd80

    Sample outcome from above command

    instanceType	i-4020bd80	t2.micro
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments