O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming Amazon EC2

Book Description

If you plan to use Amazon Web Services to run applications in the cloud, the end-to-end approach in this book will save you needless trial and error. You'll find practical guidelines for designing and building applications with Amazon Elastic Compute Cloud (EC2) and a host of supporting AWS tools, with a focus on critical issues such as load balancing, monitoring, and automation.

How do you move an existing application to AWS, or design your application so that it scales effectively? How much storage will you require? Programming Amazon EC2 not only helps you get started, it will also keep you going once you're successfully positioned in the cloud. This book is a must-read for application architects, developers, and administrators.

  • Determine your application's lifecycle and identify the AWS tools you need
  • Learn how to build and run your application as part of the development process
  • Migrate simple web applications to the cloud with EC2, Amazon Simple Storage Service, and CloudFront content delivery
  • Meet traffic demand with EC2's Auto Scaling and Elastic Load Balancing
  • Decouple your application using Simple Queue Service, Simple Notification Service, and other tools
  • Use the right tools to minimize downtime, improve uptime, and manage your decoupled system

"Jurg and Flavia have done a great job in this book building a practical guide on how to build real systems using AWS."
--Werner Vogels, VP & CTO at Amazon.com

Table of Contents

  1. Programming Amazon EC2
  2. Foreword
  3. Preface
    1. Audience
    2. Conventions Used in This Book
    3. Using Code Examples
    4. Safari® Books Online
    5. How to Contact Us
    6. Acknowledgments
  4. 1. Introducing AWS
    1. From 0 to AWS
      1. Biggest Problem First
      2. Infinite Storage
      3. Computing Per Hour
      4. Very Scalable Data Store
      5. Optimizing Even More
      6. Going Global
    2. Growing into Your Application
      1. Start with Realistic Expectations
      2. Simply Small
      3. Growing Up
      4. Moving Out
    3. “You Build It, You Run It”
      1. Individuals and Interactions: One Team
      2. Working Software: Shared Responsibility
      3. Customer Collaboration: Evolve Your Infrastructure
      4. Responding to Change: Saying Yes with a Smile
    4. In Short
  5. 2. Starting with EC2, RDS, and S3/CloudFront
    1. Setting Up Your Environment
      1. Your AWS Account
      2. Command-Line Tools
      3. AWS Management Console
      4. Other Tools
    2. Choosing Your Geographic Location, Regions, and Availability Zones
    3. Choosing an Architecture
    4. Creating the Rails Server on EC2
      1. Creating a Key Pair
      2. Finding a Suitable AMI
      3. Setting Up the Web/Application Server
        1. Launching an instance (Request Instances Wizard)
        2. Setting up the instance
          1. Creating and using an EBS volume
          2. Creating and associating an EIP
          3. Installing the software
        3. Creating a custom image
          1. Provisioning the instance at boot/launch
          2. User data
    5. RDS Database
      1. Creating an RDS Instance (Launching the DB Instance Wizard)
      2. Is This All?
    6. S3/CloudFront
      1. Setting Up S3 and CloudFront
      2. Static Content to S3/CloudFront
        1. Case study: Publitas—CloudFront to the rescue
    7. Making Backups of Volumes
      1. Installing the Tools
      2. Running the Script
    8. In Short
  6. 3. Growing with S3, ELB, Auto Scaling, and RDS
    1. Preparing to Scale
      1. Setting Up the Tools
    2. S3 for File Uploads
      1. User Uploads for Kulitzer (Rails)
    3. Elastic Load Balancing
      1. Creating an ELB
      2. Difficulties with ELB
    4. Auto Scaling
      1. Setting Up Auto Scaling
        1. Launch configuration
        2. Autoscaling group
        3. Autoscaling (alarms and policies)
        4. Semiautoscaling
      2. Auto Scaling in Production
        1. Pausing Auto Scaling
        2. Replacing the launch configuration
        3. Changing the alarms
        4. Changing the autoscaling group
        5. Decommissioning an autoscaling group
    5. Scaling a Relational Database
      1. Scaling Up (or Down)
        1. DB instance classes
      2. Scaling Out
        1. Storage engine
      3. Tips and Tricks
        1. Disk is slow
        2. Slow log
        3. Storage
    6. Elastic Beanstalk
    7. In Short
  7. 4. Decoupling with SQS, SimpleDB, and SNS
    1. SQS
      1. Example 1: Offloading Image Processing for Kulitzer (Ruby)
      2. Example 2: Priority PDF Processing for Marvia (PHP)
        1. Installing the tools for PHP
        2. Writing messages
        3. Reading messages
      3. Example 3: Monitoring Queues in Decaf (Java)
        1. Getting the queues
        2. Reading the queue attributes
        3. Checking a specific queue attribute
    2. SimpleDB
      1. Use Cases for SimpleDB
      2. Example 1: Storing Users for Kulitzer (Ruby)
        1. Adding a user
        2. Getting a user
      3. Example 2: Sharing Marvia Accounts and Templates (PHP)
        1. Adding an account
        2. Getting an account
        3. Incrementing the counter
      4. Example 3: SimpleDB in Decaf (Java)
        1. Listing domains
        2. Listing items in a domain: select
        3. Getting domain metadata
    3. SNS
      1. Example 1: Implementing Contest Rules for Kulitzer (Ruby)
        1. Preparing tools for SNS in Ruby
        2. Topics per contest
        3. Subscribing to registration updates
        4. Publishing messages to a topic
        5. Deleting a topic
        6. Publishing to Facebook
      2. Example 2: PDF Processing Status (Monitoring) for Marvia (PHP)
        1. Creating a topic for an account
        2. Subscription and confirmation
        3. Publishing and receiving status updates
      3. Example 3: SNS in Decaf (Java)
        1. Listing topics
        2. Subscribing to a topic via email
        3. Sending notifications on a topic
    4. In Short
  8. 5. Managing the Inevitable Downtime
    1. Measure
      1. Up/Down Alerts
      2. Monitoring on the Inside
      3. Monitoring on the Outside
        1. CloudWatch
          1. ELBs
          2. Region
    2. Understand
      1. Why Did I Lose My Instance?
      2. Spikes Are Interesting
      3. Predicting Bottlenecks
    3. Improvement Strategies
      1. Benchmarking and Tuning
      2. The Merits of Virtual Hardware
        1. Replace hardware
        2. Scaling up
        3. Auto Scaling group of one
    4. In Short
  9. 6. Improving Your Uptime
    1. Measure
      1. EC2
        1. Dimensions
        2. Metrics
      2. ELB
        1. Dimensions
        2. Metrics
      3. RDS
        1. Dimensions
        2. Metrics
      4. Using Dimensions from the Command Line
      5. Alerts
    2. Understand
      1. Setting Expectations
      2. Viewing Components
    3. Improvement Strategies
      1. Planning Nonautoscaling Components
      2. Tuning Auto Scaling
    4. In Short
  10. 7. Managing Your Decoupled System
    1. Measure
      1. S3
      2. SQS
        1. Queue size
        2. Latency
        3. Throughput
      3. SimpleDB
        1. Size
        2. Fragmentation
      4. SNS
        1. Burst factor
    2. Understand
      1. Imbalances
      2. Bursts
    3. Improvement Strategies
      1. Queues Neutralize Bursts
      2. Notifications Accelerate
    4. In Short
  11. 8. And Now…
    1. Other Approaches
    2. Private/Hybrid Clouds
    3. Thank You
  12. Index
  13. About the Authors
  14. Colophon
  15. Copyright