Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Preface

Preface

In the spring of 2002, I logged in to my Amazon Associates account one day and saw a little box on the landing page with the magic words: “Amazon Now Has XML!” Amazon had exposed many aspects of its product catalog in XML form. Coupled with the Amazon Associates program, enterprising developers could download the data, use it to create a marketing site, and then earn commissions by sending traffic to the main Amazon.com site.

I thought this was fairly interesting and dived right in. I downloaded the documentation, wrote some code, and was impressed. I saw plenty of promise, but also plenty of room for improvement, so I wrote it all up and sent it to a feedback email address that they’d provided for this purpose.

One situation led to another and by early summer I was Amazon’s guest at a very exclusive conference held at their headquarters. They had invited five or six outside developers to Seattle in order to gain some direct customer feedback on their service and talk about their plans for the future. As I sat there and listened, I was definitely impressed. It was clear they were thinking big. They hinted at their plans to open up the Amazon technology platform and invite developers to participate.

Having worked at Microsoft for three years, I had a real appreciation for a platform’s power and my mind raced forward. They were going to need a developer program, sample code, more documentation, and all sorts of material in order to make this happen. I thought I could make a contribution, and stepped out to chat with the person who’d extended the invitation to me; I told her I wanted to interview for a role at Amazon to work on this new web services effort!

In order to demonstrate my interest in Amazon, I wrote a set of PHP wrappers for that very first version of AWS and called it PIA, the PHP Interface to Amazon. Amusingly enough, my now quaint announcement can still be found on the AWS Discussion Forums.

I went through the interview process, and before the end of the summer I was hired as a senior member of the Amazon Associates team. My official duty was to write business analytical tools using Perl; however, my manager also indicated that I should devote 10-20% of my time to helping out on the web services effort in whatever way seemed appropriate.

Just a few weeks after I started, the manager of the Amazon Associates team asked me if I would mind speaking at a conference. She explained that they had intended to hire a “real” speaker when she accepted the invitation, but it was taking longer than expected to find the right person. I did a lot of public speaking earlier in my career and was happy to take care of this for them. That first event went really well, and before too long they tossed another one my way, and then another. The 10-20% of time allocated to the web services effort quickly grew to 40-50%; I kept busy writing sample code, answering questions on the AWS forums, and doing whatever I could to help the first members of our developer community succeed.

A few months passed and management approached me. “We’ve been planning to hire an evangelist to take on these speaking gigs, but it appears that you’re already doing most of the job. Do you want it?” After some consultation with my family, I decided that I did, and in April of 2003 it was made official. I was the world’s first (as far as I know) Web Services Evangelist!

In this role I travel the world and speak at a range of forums: conferences, user groups, college classes, and corporate technology teams. I arrange one-on-one meetings with developers in each city, and use these meetings to learn about what the developers are doing and how we can better serve them.

Over the last couple of years we’ve released a number of infrastructure services, including the Elastic Compute Cloud (EC2), the Simple Storage Service (S3), the Simple Queue Service (SQS), and the Simple Database (SimpleDB). It has been a real privilege to watch firsthand as the AWS team has designed, implemented, delivered, and operated service after service and to see our developer community grow to include hundreds of thousands of developers.

When I was asked to consider writing a book about AWS earlier this year, I thought it would be the perfect opportunity to share some of what I’ve learned in the last seven years.

Thanks for Reading

I hope that you enjoy reading this book as much as I’ve enjoyed writing it. Please feel free to look me up and let me know what you think.

P.1. Who Should Read This Book?

This book is aimed at web developers who have built a web application or two, and are ready to leap into the world of cloud computing using Amazon Web Services. This book makes use of the PHP language, but if you have experience in any server-side scripting language, you’ll find the examples clear and easy to understand. It’s also assumed that you know the fundamentals of HTML and CSS, and that you’re comfortable with the Linux command line. Knowledge of basic system administration tasks, such as creating and mounting file systems, will also be helpful.

By the end of this book, you can expect to have a firm grasp of the concept of cloud computing and its role in enabling a whole new class of scalable and reliable web applications. You’ll also have gained a clear understanding of the range of Amazon Web Services, such as the Simple Storage Service, the Elastic Compute Cloud, the Simple Queue Service, and SimpleDB. You’ll be able to make use of all these services in your web applications as you write commands, tools, and processes in PHP.

P.2. What’s Covered in This Book?

The book comprises 11 chapters. Chapters 3 through to 10 detail specific Amazon Web Services, and the final chapter explores building a sample application. I would recommend that you read the book from start to finish on your first go, but keep it by your side to dip in and out of the chapters if you need a refresher on a particular web service.


Chapter 1: Welcome to Cloud Computing

In this chapter, you’ll learn the basics of cloud computing, and how it both builds on but differs from earlier hosting technologies. You will also see how organizations and individuals are putting it to use.


Chapter 2: Amazon Web Services Overview

This chapter moves from concept to reality, where you’ll learn more about the fundamentals of each of the Amazon Web Services. Each web service is explained in detail and key terminology is introduced.


Chapter 3: Tooling Up

By now you’re probably anxious to start. But before you jump in and start programming, you’ll need to make sure your tools are in order. In Chapter 3, you’ll install and configure visual and command line tools, and the CloudFusion PHP library.


Chapter 4: Storing Data with Amazon S3

In Chapter 4, you will write your first PHP scripts. You will dive head-first into Amazon S3 and Amazon CloudFront, and learn how to store, retrieve, and distribute data on a world scale.


Chapter 5: Web Hosting with Amazon EC2

Chapter 5 is all about the Elastic Compute Cloud infrastructure and web service. You’ll see how to use the AWS Management Console to launch an EC2 instance, create and attach disk storage space, and allocate IP addresses. For the climax, you’ll develop a PHP script to do it all in code. To finish off, you’ll create your very own Amazon Machine Image.


Chapter 6: Building a Scalable Architecture with Amazon SQS

In this chapter, you will learn how to build applications that scale to handle high or variable workloads, using message-passing architecture constructed using the Amazon Simple Queue Service. As an example of how powerful this approach is, you’ll build an image downloading and processing pipeline with four queues that can be independently assigned greater or lesser resources.


Chapter 7: EC2 Monitoring, Auto Scaling, and Elastic Load Balancing

Chapter 7 will teach you how to use three powerful EC2 features—monitoring, auto scaling, and load balancing. These hardy features will aid you in keeping a watchful eye on system performance, scaling up and down in response to load, and distributing load across any number of EC2 instances.


Chapter 8: Amazon SimpleDB: A Cloud Database

In Chapter 8, you’ll learn how to store and retrieve any amount of structured or semi-structured data using Amazon SimpleDB. You will also construct an application for parsing and storing RSS feeds, and also make use of Amazon SQS to increase performance.


Chapter 9: Amazon Relational Database Service

In Chapter 9, we’ll look at Amazon Relational Database Service, which allows you to use relational databases in your applications, and query them using SQL. Amazon RDS is a powerful alternative to SimpleDB for cases in which the full query power of a relational database is required. You’ll learn how to create database instances, back them up, scale them up or down, and delete them when they’re no longer necessary.


Chapter 10: Advanced AWS

In this introspective chapter, you’ll learn how to track your AWS usage in SimpleDB. You’ll also explore Amazon EC2’s Elastic Block Storage feature, see how to do backups, learn about public data sets, and discover how to increase performance or capacity by creating a RAID device on top of multiple EBS volumes. Finally, you will learn how to retrieve EC2 instance metadata, and construct system diagrams.


Chapter 11: Putting It All Together: CloudList

Combining all the knowledge gained from the previous chapters, you’ll create a classified advertising application using EC2 services, S3, and SimpleDB.

P.3. The Book’s Web Site

Located at http://www.sitepoint.com/books/cloud1/, the web site that supports this book will give you access to the following facilities.

P.3.1. The Code Archive

As you progress through this book, you’ll note file names above many of the code listings. These refer to files in the code archive, a downloadable ZIP file that contains all of the finished examples presented in this book. Simply click the Code Archive link on the book’s web site to download it.

P.3.2. Updates and Errata

No book is error-free, and attentive readers will no doubt spot at least one or two mistakes in this one. The Corrections and Typos page on the book’s web site will provide the latest information about known typographical and code errors, and will offer necessary updates for new releases of browsers and related standards.

P.4. The SitePoint Forums

If you’d like to communicate with other developers about this book, you should join SitePoint’s online community. The forums offer an abundance of information above and beyond the solutions in this book, and a lot of interesting and experienced web developers hang out there. It’s a good way to learn new tricks, have questions answered in a hurry, and just have a good time.

P.5. The SitePoint Newsletters

In addition to books like this one, SitePoint publishes free email newsletters, such as The SitePoint Tribune, The SitePoint Tech Times, and The SitePoint Design View. Reading them will keep you up to date on the latest news, product releases, trends, tips, and techniques for all aspects of web development. Sign up to one or more SitePoint newsletters at http://www.sitepoint.com/newsletter/.

P.6. The SitePoint Podcast

Join the SitePoint Podcast team for news, interviews, opinions, and fresh thinking for web developers and designers. They discuss the latest web industry topics, present guest speakers, and interview some of the best minds in the industry. You can catch up on all the podcasts at http://www.sitepoint.com/podcast/, or subscribe via iTunes.

P.7. Your Feedback

If you’re unable to find an answer through the forums, or if you wish to contact us for any other reason, the best place to write is books@sitepoint.com. We have an email support system set up to track your inquiries, and friendly support staff members who can answer your questions. Suggestions for improvements, as well as notices of any mistakes you may find, are especially welcome.

P.8. Acknowledgments

First and foremost, I need to thank my loving wife, Carmen. When I told her that I was considering an offer to write a book, she offered her enthusiastic support, and wondered why I hadn’t taken her advice to do this a decade or more earlier.

Next, my amazing children, Stephen, Andy, Tina, Bianca, and Grace. Your support in the form of patience, peace and quiet, constant encouragement, and healthy snacks and meals has been without par. Now I can take care of all of those things that I promised to do “after the book is done!”

My colleagues at Amazon Web Services deserve more than a passing mention. My then-manager, Steve Rabuchin, championed this project internally and asked for nothing in return—save a mention in the acknowledgements. Jeff Bezos created an amazing company, one that allows innovation and good ideas like AWS to flourish. For my peers in AWS Developer Relations, here's what I’ve been working on; I hope that it lives up to your expectations! To all of the internal reviewers, your careful and detailed feedback was incredibly helpful.

And finally, thanks to Keith Hudgins (expert reviewer) and Andrew Tetlaw (technical editor) for all your assistance and feedback.

P.9. Conventions Used in This Book

You’ll notice that we’ve used certain typographic and layout styles throughout this book to signify different types of information. Look out for the following items.

P.9.1. Markup Samples

Any markup—be that HTML or CSS—will be displayed using a fixed-width font, like so:

<h1>A perfect summer's day</h1>
<p>It was a lovely day for a walk in the park. The birds 
were singing and the kids were all back at school.</p>

If the markup forms part of the book’s code archive, the name of the file will appear at the top of the program listing, like this:

listing P-1. example.css

.footer {
  background-color: #CCC;
  border-top: 1px solid #333;
}

If only part of the file is displayed, this is indicated by the word excerpt:

listing P-2. example.css (excerpt)

  border-top: 1px solid #333;

If additional code is to be inserted into an existing example, the new code will be displayed in bold:

function animate() {
  new_variable = "Hello";
}

Where existing code is required for context, a vertical ellipsis will be displayed (rather than repeat all the code):

function animate() {
  ⋮
  return new_variable;
}

Some lines of code are intended to be entered on one line, but we’ve had to wrap them because of page constraints. A ➥ indicates a line break that exists for formatting purposes only, and should be ignored.

URL.open("http://www.sitepoint.com/blogs/2007/05/28/user-style-she
➥ets-come-of-age/");

P.9.2. Tips, Notes, and Warnings


Tip:

Hey, You!

Tips will give you helpful little pointers.



Note:

Notes are useful asides that are related—but not critical—to the topic at hand. Think of them as extra tidbits of information.



Note:

… pay attention to these important points.



Warning:

Watch Out!

Warnings will highlight any gotchas that are likely to trip you up along the way.


  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint