You are previewing Amazon EC2 Cookbook.
O'Reilly logo
Amazon EC2 Cookbook

Book Description

Over 40 hands-on recipes to develop and deploy real-world applications using Amazon EC2

About This Book

  • Design and build applications using Amazon EC2 and a range of supporting AWS tools

  • Find highly effective solutions to your AWS Cloud-based application development, deployment, and infrastructural issues

  • A comprehensive set of recipes to implement your product’s functional and non-functional requirements

  • Who This Book Is For

    This book is targeted at Cloud-based developers who have prior exposure to AWS concepts and features. Some experience in building small applications and creating some proof-of-concept applications is required.

    What You Will Learn

  • Select and configure the right EC2 instances

  • Create, configure, and secure a Virtual Private Cloud

  • Create an AWS CloudFormation template

  • Use AWS Identity and Access Management to secure access to EC2 instances

  • Configure auto-scaling groups using CloudWatch

  • Choose and use the right data service such as SimpleDB and DynamoDB for your cloud applications

  • Access key AWS services using client tools and AWS SDKs

  • Deploy AWS applications using Docker containers

  • In Detail

    Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides flexible and resizable compute capacity in the cloud. The main purpose of Amazon EC2 is to make web-scale cloud computing easier for the developers. It offers developers and companies the raw building blocks like load balancers, object stores and virtual machines running on general hardware (that is, Amazon runs a multitude of hardware components but presents them as a generic utility to its users) with accessible APIs in order to create scalable software products

    This book covers designing, developing, and deploying scalable, highly available, and secure applications on the AWS platform. By following the steps in the recipes, you will be able to effectively and systematically resolve issues related to development, deployment, and infrastructure for enterprise-grade cloud applications or products.

    This book starts with helping you choose and configure the right EC2 instances to meet your application-specific requirements. The book then moves on to creating a CloudFormation template and will teach you how to work with stacks. You will then be introduced to using IAM services to configure users, groups, roles, and multi-factor authentication. You will also learn how to connect AD to AWS IAM. Next, you will be using AWS data services and accessing other AWS services including Route 53, Amazon S3, and AWS SES (Amazon Simple Email Service). Finally, you will be deploying AWS applications using Docker containers.

    Style and approach

    This book contains a rich set of recipes that cover not only the full spectrum of real-world cloud application development using Amazon EC2, but also the services and security of the applications. The book contains easy-to-follow recipes with step-by-step instructions to leverage EC2 within your applications.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Amazon EC2 Cookbook
      1. Table of Contents
      2. Amazon EC2 Cookbook
      3. Credits
      4. About the Authors
      5. About the Reviewer
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
          3. Instant updates on new Packt books
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Selecting and Configuring Amazon EC2 Instances
        1. Introduction
        2. Choosing the right AWS EC2 instance types
          1. How to do it…
        3. Preparing AWS CLI tools
          1. How to do it…
            1. Getting access key ID and secret access key
            2. Installing AWS CLI using pip in Linux
            3. Installing AWS CLI using pip in Windows/Mac
        4. Launching EC2 instances using EC2-Classic and EC2-VPC
          1. Getting started…
          2. How to do it…
            1. Launching the EC2 instance in EC2-Classic
            2. Launching the EC2 instance in VPC
          3. See also
        5. Allocating Elastic IP addresses
          1. How to do it…
          2. See also
        6. Creating an instance with multiple NIC cards and a static private IP address
          1. How to do it…
            1. Creating a network interface
            2. Attaching the network interface to an instance
            3. Associating the EIP to the ENI
          2. See also
        7. Selecting the right storage for your EC2 instance
          1. How to do it…
            1. Creating an EBS volume
            2. Attaching the volume
        8. Creating tags for consistency
          1. How to do it…
            1. Creating tags for one or more AWS resources
        9. Configuring security groups
          1. How to do it…
            1. Creating a security group for EC2-Classic
            2. Creating a security group for EC2-VPC
            3. Adding an inbound rule
            4. Adding an outbound rule
            5. Adding the security group to an instance
        10. Creating an EC2 key pair
          1. How to do it…
            1. Creating a key pair
        11. Grouping EC2 instances using placement groups
          1. How to do it…
            1. Creating a placement group
            2. Placing instances in the placement group
        12. Configuring Elastic Load Balancing
          1. How to do it…
            1. Creating an Internet-facing ELB with listeners
            2. Configuring health checks on ELB
            3. Adding instances to the ELB
        13. Architecting for high availability
          1. How to do it…
        14. Creating instances for AWS Marketplace
          1. How to do it…
            1. Creating an AMI from EC2 instance
            2. Making the AMI public
      9. 2. Configuring and Securing a Virtual Private Cloud
        1. Introduction
        2. Creating and configuring VPC
          1. How to do it…
          2. How it works…
        3. Configuring VPC DHCP options
          1. How to do it…
          2. How it works…
        4. Configuring networking connections between two VPCs (VPC peering)
          1. How to do it…
          2. How it works…
        5. Connecting on-premise network to VPC using VPN
          1. How to do it…
          2. How it works…
      10. 3. Managing AWS Resources Using AWS CloudFormation
        1. Introduction
        2. Creating CloudFormation templates
          1. How to do it…
          2. How it works…
          3. There's more…
        3. Creating CloudFormation templates from existing AWS resources
          1. How to do it…
          2. How it works…
        4. Deploying applications on EC2 instances
          1. How to do it…
          2. How it works…
        5. Updating a stack
          1. How to do it…
          2. How it works…
      11. 4. Securing Access to Amazon EC2 Instances
        1. Introduction
        2. Creating IAM users
          1. How to do it…
          2. How it works…
        3. Creating IAM groups and assigning group-level permissions
          1. How to do it…
          2. How it works…
        4. Creating IAM roles
          1. How to do it…
          2. How it works…
          3. There's more…
        5. Connecting on-premise AD to AWS IAM
          1. How to do it…
          2. How it works…
        6. Configuring AWS multifactor authentication
          1. How to do it…
          2. How it works…
          3. There's more…
      12. 5. Monitoring Amazon EC2 Instances
        1. Introduction
        2. Collecting EC2 metrics using AWS CloudWatch
          1. How to do it…
          2. How it works…
        3. Collecting custom metrics from EC2 instances
          1. How to do it…
          2. How it works…
          3. There's more…
        4. Monitoring costs using CloudWatch
          1. How to do it…
            1. Enabling the monitoring of your estimated charges
          2. How it works…
        5. Sending an e-mail based on a CloudWatch alarm
          1. How to do it…
          2. How it works…
        6. Using CloudWatch Logs
          1. How to do it…
          2. How it works…
          3. There's more…
      13. 6. Using AWS Data Services
        1. Introduction
        2. Using Amazon SimpleDB services from a Java program
          1. How to do it…
          2. How it works…
          3. There's more…
        3. Using Amazon DynamoDB
          1. How to do it…
          2. How it works…
          3. There's more…
        4. Using Amazon ElastiCache
          1. How to do it…
            1. Working with ElasticCache
          2. How it works…
          3. There's more…
        5. Using Amazon RDS
          1. How to do it…
          2. How it works…
      14. 7. Accessing Other AWS Services
        1. Introduction
        2. Configuring Route 53
          1. How to do it…
          2. How it works…
          3. There's more…
        3. Accessing AWS S3 from applications
          1. How to do it…
          2. How it works…
          3. There's more…
        4. Accessing AWS SES from applications
          1. How to do it…
          2. How it works…
          3. There's more…
        5. Accessing AWS SNS from applications
          1. How to do it…
          2. How it works…
          3. There's more…
        6. Accessing AWS SQS from applications
          1. How to do it…
          2. How it works…
          3. There's more…
      15. 8. Deploying AWS Applications
        1. Introduction
        2. Using Docker containers for AWS deployments
          1. How to do it…
            1. Installing Docker
            2. Creating a Dockerfile
            3. Building an image from the Dockerfile
            4. Creating Docker container
            5. Checking the container status
          2. How it works…
          3. There's more…
        3. Using Chef for AWS deployments
          1. How to do it…
            1. Installing the knife-ec2 plugin
            2. Configuring Chef Provisioner node with knife-ec2 plugin
            3. Configuring Chef Provisioner node
            4. Creating cookbooks and recipes
            5. Starting Chef client from the provisioning node
          2. How it works…
          3. There's more…
        4. Using Puppet for AWS deployments
          1. How to do it…
            1. Installing Puppet AWS module in Puppet master
            2. Launching an EC2 instance with Puppet agent
          2. How it works…
          3. There's more…
      16. Index