Amazon Elastic Compute Cloud
User Guide (API Version 2014-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Query Requests

Query requests are HTTP or HTTPS requests that use the HTTP verb GET or POST and a Query parameter named Action. For a list of Amazon EC2 API actions, see Actions.

Structure of a GET Request

The Amazon EC2 documentation presents the GET requests as URLs, which can be used directly in a browser.


Because the GET requests are URLs, you must URL encode the parameter values. In the Amazon EC2 documentation, we leave the example GET requests unencoded to make them easier to read.

The request consists of the following:

  • Endpoint: The URL that serves as the entry point for the web service.

  • Action: The action that you want to perform (for example, use RunInstance to run an instance).

  • Parameters: Any parameters for the action; each parameter is separated by an ampersand (&). You must also include authorization parameters that AWS uses to ensure the validity and authenticity of the request. Amazon EC2 supports Signature Version 2. For more information, see Query API Authentication.

The following is an example request that launches instances:​Version=2014-02-01​&Expires=2010-10-10T12:00:00Z​&Signature=lBP67vCvGlDMBQ1do​fZxg8E8SUEXAMPLE&SignatureVersion=2&SignatureMethod=HmacSHA256

To make these example requests even easier to read, the Amazon EC2 documentation presents them in the following format:

The first line specifies the endpoint of the request. After the endpoint is a question mark (?), which separates the endpoint from the parameters.

The Action parameter indicates the action to perform. For a complete list of actions, see Actions in the Amazon Elastic Compute Cloud API Reference.

The remaining lines specify additional parameters for the request.


An endpoint is a URL that serves as an entry point for a web service. You can select a regional endpoint for Amazon EC2 when you make your requests to reduce latency. For more information about regions, see Region and Availability Zone Concepts. For information about the endpoints for Amazon EC2, see Regions and Endpoints in the Amazon Web Services General Reference.

If you specify the general endpoint,, we use the endpoint for us-east-1. To use a different region, specify its associated endpoint. For example, if you specify as the endpoint, we direct your request to the us-west-2 endpoint.

Query Parameters

Each Query request must include required common parameters to handle authentication and selection of an action. For more information, see Common Query Parameters in the Amazon Elastic Compute Cloud API Reference.

Some operations take lists of parameters. These lists are specified using the param.n notation, where n is an integer starting from 1.

The following example adds multiple devices to a block device mapping using a list of BlockDeviceMapping parameters.

Query API Authentication

You can send Query requests over either the HTTP or HTTPS protocol.

Regardless of which protocol you use, you must include a signature in every Query request. Amazon EC2 supports Signature Version 2. For more information, see Signature Version 2 Signing Process in the Amazon Web Services General Reference.

In the example Query requests we present in the Amazon EC2 documentation, we omit the parameters related to authentication to make it easier for you to focus on the parameters for the action. We replace them with the following literal string to remind you that you must include these parameters in your request: &AUTHPARAMS.

Query Response Structures

In response to a Query request, the service returns an XML data structure that conforms to an XML schema defined as part of the WSDL file for Amazon EC2. The structure of an XML response is specific to the associated request. In general, the response data types are named according to the operation performed and whether the data type is a container (can have children). Examples of containers include groupSet for security groups and keySet for key pairs (see the example that follows). Item elements are children of containers, and their contents vary according to the container's role.

Every response includes a request ID in a requestId element. The value is a unique string that AWS assigns. If you ever have issues with a particular request, AWS will ask for the request ID to help troubleshoot the issue. The following shows an example response.

<DescribeKeyPairsResponse xmlns="">