Making requests to the Amazon EC2 API - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Making requests to the Amazon EC2 API


As of October 14, 2022, HTTP responses from the Amazon EC2 APIs no longer include a reason-phrase element. As recommended by RFC7230, you should ensure that your applications do not make use of the reason-phrase content. Ensure that your applications use the 3-digit status-code element included in the HTTP response instead.

We provide the Query API for Amazon EC2, as well as software development kits (SDK) for Amazon that enable you to access Amazon EC2 from your preferred programming language.

To monitor the calls made to the Amazon EC2 API for your account, including calls made by the Amazon Web Services Management Console, command line tools, and other services, use Amazon CloudTrail. For more information, see the Amazon CloudTrail User Guide.

Required knowledge

If you plan to access Amazon EC2 through an API, you should be familiar with the following:

  • XML

  • Web services

  • HTTP requests

  • One or more programming languages, such as Java, PHP, Perl, Python, Ruby, C#, or C++.

Available APIs for Amazon EC2

The Amazon EC2 Query API provides HTTP or HTTPS requests that use the HTTP verb GET or POST and a Query parameter named Action.

Amazon provides libraries, sample code, tutorials, and other resources for software developers who prefer to build applications using language-specific APIs instead of submitting a request over HTTP or HTTPS. These libraries provide basic functions that automatically take care of tasks such as cryptographically signing your requests, retrying requests, and handling error responses, so that it is easier for you to get started.

For more information about the Amazon SDKs, see Amazon SDKs and Tools.