Professional Documents
Culture Documents
• The Amazon Elastic Compute Cloud (Amazon EC2) API is a web service
that enables you to launch and manage Linux/UNIX and Windows
server instances in Amazon's data centers.
• Provides users the ability to "compute" in the cloud, it provides users
with complete control of their computing resources and lets them run
on Amazon's computing environment.
• Amazon EC2 changes the economics of computing by allowing users
to pay only for capacity that is actually used. This is a REST-based API.
• The Amazon Web Services (AWS) environment acts as an integrated
collection of hardware and software services designed to enable the
easy, quick, and inexpensive use of computing resources.
• Now, sitting atop this integrated collection is the AWS application
programming interface (API): In essence, an API represents a way to
communicate with a computing resource.
• With respect to AWS, nothing gets done without using the AWS API.
The AWS API is the sole way that external users interact with AWS
resources, and there’s literally no way to use AWS resources without
the API being involved.
• If you access AWS through the AWS Management Console or the
command line tools, you are actually using tools that make calls to the
AWS API.
What are APIs?
• APIs (application programming interfaces) have become increasingly
important in the world of computing.
• You may consider yourself the kind of person who’d never, ever have
to use an API. You’d be wrong.
• APIs have been important, they are important now, and they’ll
become even more important. More likely than not, you’ve been
using APIs for years without even knowing it.
• A good way to describe an API is to say that it represents a way for one
program to interact with another via a defined interface — in other
words, a mechanism by which any other program that communicates
with the program can be assured that it will fulfill its role.
• AWS 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.
Query requests for Amazon EC2
• Query requests are HTTP or HTTPS requests that use the HTTP verb
GET or POST and a Query parameter named Action.
• For each Amazon EC2 API action, you can choose whether to use GET
or POST.
• Regardless of which verb you choose, the same data is sent and
received.
Structure of a GET request
• The Amazon EC2 presents the GET requests as URLs, which can be used directly in a browser.
Note Because the GET requests are URLs, you must URL encode the parameter values.
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 RunInstances to launch an instance.
• Parameters: Any parameters for the action; each parameter is separated by an ampersand (&).
• Version: The API version to use. For the Amazon EC2 API, the version is 2016-11-15.
• Authorization parameters: AWS uses to ensure the validity and authenticity of the request.
https://ec2.amazonaws.com/?Action=RunInstances
&ImageId=ami-2bb65342
&MaxCount=3
&MinCount=1
&Placement.AvailabilityZone=us-east-1a
&Monitoring.Enabled=true
&Version=2016-11-15
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLEus-east-1%2Fec2%2Faws4_request
&X-Amz-Date=20130813T150206Z
&X-Amz-SignedHeaders=content-type%3Bhost%3Bx-amz-date&X-Amz-
Signature=ced6826de92d2bdeed8f846f0bf508e8559e98e4b0194b84example54174deb456c
Content-type: application/json
host:ec2.amazonaws.com