Chapter 2. Interacting with Amazon Web Services

In this chapter, we will show you how to create and send HTTP requests that will be understood by the Amazon Web Services (AWS) infrastructure. To demonstrate how to communicate with the AWS REST and Query interfaces, we will build a communications library in Ruby. In later chapters we will build client programs that work with the API interface for each AWS infrastructure service. These service clients will take advantage of the low-level communication library we present in this chapter.

To interact with AWS, our communications library must create HTTP request messages that describe the actions to perform, and it must provide the data the service will operate on. The library will send request messages to the designated service, wait for a response, determine whether the request was successful, and pass the response back to the client for further processing. Although the infrastructure services have very different capabilities and applications, at the HTTP communication level they work in much the same way and will reuse the same library functionality.


Amazon’s S3, EC2, SQS, FPS, and SimpleDB services are made available via two application programming interfaces (APIs) that are based on the standard features of the HTTP protocol: the REST and Query interfaces. Each service’s API defines the structure and content of the HTTP request messages the service will understand and the response messages it will return.

HTTP Requests ...

Get Programming Amazon Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.