Book Image

Amazon EC2 Cookbook

Book Image

Amazon EC2 Cookbook

Overview of this book

Discover how to perform a complete forensic investigation of large-scale Hadoop clusters using the same tools and techniques employed by forensic experts. This book begins by taking you through the process of forensic investigation and the pitfalls to avoid. It will walk you through Hadoop’s internals and architecture, and you will discover what types of information Hadoop stores and how to access that data. You will learn to identify Big Data evidence using techniques to survey a live system and interview witnesses. After setting up your own Hadoop system, you will collect evidence using techniques such as forensic imaging and application-based extractions. You will analyze Hadoop evidence using advanced tools and techniques to uncover events and statistical information. Finally, data visualization and evidence presentation techniques are covered to help you properly communicate your findings to any audience.
Table of Contents (15 chapters)
Amazon EC2 Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Preparing AWS CLI tools


AWS CLI is a set of unified command-line tools to work with multiple AWS services. Using AWS CLI tools you can manage EC2 resources (such as instances, security groups, and volumes) and your VPC resources (such as VPCs, subnets, route tables, and Internet gateways).

How to do it…

In the following two sections, we list the set of instructions required to accomplish this on Linux and Windows/Mac platforms.

Getting access key ID and secret access key

You need AWS access key ID and AWS secret access key to access AWS services. Instead of generating these credentials from the root account, it's always best practice to use IAM users. You should save these credentials in a secure location. If you lose these keys, you must delete the access key and then create a new key.

You can get the AWS credentials from AWS management portal by following these steps:

  1. Log in to the AWS management portal using your AWS username and password.

  2. Select account name from top menu at the right corner in the console.

  3. Select security credentials.

  4. Click on access keys (access key ID and secret access key).

  5. Click on the Create New Access Key button.

  6. Click on Download Key File, which will download the file. If you do not download the key file now, you will not be able to retrieve your secret access key again.

  7. Copy this key file to a secure location.

    Note

    Don't upload your code base with AWS security credentials to public code repositories such as GitHub. Attackers are scraping GitHub for AWS credentials. If anyone gets access to these credentials, they can misuse your AWS account.

Installing AWS CLI using pip in Linux

We can use the pip tool to install the Python packages.

  1. Before installing Python, please check whether Python is already installed on your machine or not using the following command. If Python is already installed on your machine, then skip to the pip installation step.

    $ python --help
    
  2. Start by installing Python. Download the compressed TAR archive file from the Python site, and then install it using the commands listed below. The following steps target the apt-based Linux distributions:

    $ sudo apt-get install gcc
    $ wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
    $ tar -zxvf Python-2.7.8.tgz
    $ cd Python-2.7.8
    $ ./configure
    $ make
    $ sudo make install
    
  3. Next, check the Python installation:

    $ python –help
    
  4. Before installing pip, please check whether pip is already installed on your machine or not by using the following command. If pip is already installed on your machine, then skip to the awscli installation step:

    $ pip –help
    
  5. Move on to installing pip:

    $ sudo apt-get install pip
    
  6. Then install AWS CLI. If you have already installed awscli, you can upgrade the installation using the –upgrade option.

    $ sudo pip install awscli
    
  7. Next, configure AWS CLI.

    On the command prompt, type the following command, which will prompt for the AWSAccessKey ID, AWSSecretKey, default AWS region, and default output format.

    $ sudo aws configure
    
  8. Finally, check the installation by getting regions list:

    $ sudo aws ec2 describe-regions
    

Installing AWS CLI using pip in Windows/Mac

We can use the pip tool to install the Python packages.

  1. Before installing Python, please check whether Python is already installed on your machine or not by using the following command. If Python is already installed on your machine, then skip to the pip installation step.

    $ python –help
    
  2. Start by installing Python. Download the installer from the following URL and install Python by using that installer: https://www.python.org/downloads/.

  3. Check your Python installation:

    $ python –help
    
  4. Before installing pip, check whether pip is already installed on your machine or not by using the following command. If pip is already installed on your machine, skip to the awscli installation step.

    $ pip –help
    
  5. In the next step, we install pip. Download and run the installation script from https://bootstrap.pypa.io/get-pip.py. After that, run the following command:

    $ python get-pip.py
    
  6. Install AWS CLI. If you have already installed awscli, you can upgrade the installation using the –upgrade option.

    $ pip install awscli
    
  7. Next, we configure AWS CLI. Execute the following command from the command prompt.

    $ aws configure
    

    This command will then prompt you for the AWSAccessKey ID, AWSSecretKey, default AWS region, and default output format.

  8. Check the installation by getting the regions list:

    $ aws ec2 describe-regions