Amazon EC2 API
Amazon EC2 API
Cloud
Developer Guide
API Version 2008-02-01
Amazon Elastic Compute Cloud Developer Guide
Table of Contents
What's New ...................................................................................................................................... 1
Welcome .......................................................................................................................................... 2
Introduction to Amazon Elastic Compute Cloud .............................................................................5
Creating and Preparing AMIs .......................................................................................................... 6
Creating an AMI ........................................................................................................... 6
Starting with an Existing AMI ............................................................................ 6
Creating an AMI through a Loopback File ....................................................... 12
Bundling an AMI ........................................................................................................ 18
Sharing AMIs ..............................................................................................................21
Shared AMI Guidelines .....................................................................................21
Sharing AMIs .................................................................................................... 25
Making an AMI Public ......................................................................................25
Sharing an AMI with Specific Users .................................................................26
Publishing Shared AMIs ................................................................................... 27
Creating Paid AMIs .................................................................................................... 28
Paid and Supported AMIs ................................................................................. 29
Summary of How Paid AMIs Work ..................................................................29
Summary of How Supported AMIs Work ........................................................ 30
Product Registration ..........................................................................................31
Associating a Product Code with an AMI .........................................................32
Sharing Your Paid AMI with Select Users or the Public ..................................33
Confirming an Instance Is Running an AMI Associated with a Product Code .33
Getting the Product Code from Within an Instance .......................................... 34
Launching and Using Instances ..................................................................................................... 35
Instance Usage ............................................................................................................ 35
Instance Types ............................................................................................................ 36
Instance Metadata ....................................................................................................... 37
Instance Storage .......................................................................................................... 43
Availability Zones .......................................................................................................45
Using Shared AMIs .................................................................................................... 47
Paying for AMIs ......................................................................................................... 48
Get Console Output and Reboot Instances ................................................................. 51
Instance Addressing and Network Security ................................................................................... 53
Instance Addressing .................................................................................................... 53
Elastic IP Addresses .......................................................................................... 55
Network Security ........................................................................................................ 57
Concepts ............................................................................................................ 57
Examples ........................................................................................................... 57
Using the APIs ............................................................................................................................... 61
Using the SOAP API .................................................................................................. 61
Using the Query API ...................................................................................................64
API Reference ................................................................................................................................ 68
API Conventions .........................................................................................................68
API Versioning ........................................................................................................... 69
API Error Codes ..........................................................................................................70
Common Data Types .................................................................................................. 73
AvailabilityZoneItemType ................................................................................ 73
BlockDeviceMappingItemType ........................................................................ 73
DescribeImagesResponseItemType .................................................................. 74
DescribeKeyPairsResponseItemType ............................................................... 75
EmptyElementType ...........................................................................................75
GroupSetType ................................................................................................... 76
InstanceStateType ............................................................................................. 76
Amazon Elastic Compute Cloud Developer Guide
IpPermissionType ..............................................................................................77
LaunchPermissionItemType ..............................................................................78
LaunchPermissionOperationType .....................................................................78
PlacementRequestType ..................................................................................... 79
PlacementResponseType ...................................................................................79
ProductCodeItemType ...................................................................................... 79
ProductInstanceResponseItemType .................................................................. 80
ReservationInfoType .........................................................................................80
RunningInstancesItemType ...............................................................................81
SecurityGroupItemType ....................................................................................82
TerminateInstancesResponseInfoType ............................................................. 83
UserDataType ....................................................................................................83
UserIdGroupPairType ....................................................................................... 84
Amazon EC2 SOAP API ............................................................................................ 84
List of Operations by Function ..........................................................................85
AllocateAddress ................................................................................................ 86
AssociateAddress .............................................................................................. 86
AuthorizeSecurityGroupIngress ........................................................................87
ConfirmProductInstance ....................................................................................89
CreateKeyPair ................................................................................................... 90
CreateSecurityGroup .........................................................................................91
DeleteKeyPair ................................................................................................... 92
DeleteSecurityGroup .........................................................................................93
DeregisterImage ................................................................................................ 94
DescribeAddresses ............................................................................................ 95
DescribeAvailabilityZones ................................................................................96
DescribeImageAttribute .................................................................................... 97
DescribeImages ............................................................................................... 100
DescribeInstances ............................................................................................102
DescribeKeyPairs ............................................................................................ 103
DescribeSecurityGroups ..................................................................................104
DisassociateAddress ........................................................................................106
GetConsoleOutput ...........................................................................................107
ModifyImageAttribute .................................................................................... 108
RebootInstances .............................................................................................. 109
RegisterImage ..................................................................................................110
ReleaseAddress ............................................................................................... 111
ResetImageAttribute ........................................................................................112
RevokeSecurityGroupIngress ..........................................................................113
RunInstances ................................................................................................... 115
TerminateInstances ..........................................................................................119
Amazon EC2 Query API .......................................................................................... 120
Common Query Parameters ............................................................................ 120
List of Operations by Function ........................................................................121
AllocateAddress .............................................................................................. 122
AssociateAddress ............................................................................................ 123
AuthorizeSecurityGroupIngress ......................................................................124
ConfirmProductInstance ..................................................................................126
CreateKeyPair ................................................................................................. 127
CreateSecurityGroup .......................................................................................129
DeleteKeyPair ................................................................................................. 130
DeleteSecurityGroup .......................................................................................130
DeregisterImage .............................................................................................. 132
DescribeAddresses .......................................................................................... 132
DescribeAvailabilityZones ..............................................................................133
DescribeImageAttribute .................................................................................. 135
DescribeImages ............................................................................................... 137
DescribeInstances ............................................................................................139
Amazon Elastic Compute Cloud Developer Guide
What's New
This What's New is associated with the 2008-02-01 release of Amazon EC2. This guide was last updated
on March 27, 2008.
The following table describes the important changes since the last release of the Amazon EC2
Developer Guide.
Welcome
Topics
• Audience
• How This Guide Is Organized
• Related Resources
This is the Amazon Elastic Compute Cloud Developer Guide. This section describes who should read
this guide, how the guide is organized, and other resources related to Amazon Elastic Compute Cloud.
The Amazon Elastic Compute Cloud will occasionally be referred to within this guide as simply
"Amazon EC2"; all copyrights and legal protections still apply.
Audience
This guide picks up where the Getting Started Guide ends and provides you with the information to
create more sophisticated AMIs, using advanced service features.
You should also have worked through the Amazon EC2 Getting Started Guide, installed the command
line and API tools, and have a general understanding of the service.
Each section is written to stand on its own, so you should be able to look up the information you need
and go back to work. However, you can also read through the major sections sequentially to get in-depth
knowledge about Amazon EC2.
Related Resources
The table below lists related resources that you'll find useful as you work with this service.
Resource Description
Amazon EC2 Getting Started Guide The Getting Started Guide provides a quick tutorial of the
service based on a simple use case. Examples and
instructions are included.
Amazon EC2 Release Notes The Release Notes give a high-level overview of the current
Resource Description
release. They specifically note any new features, corrections,
and known issues.
AWS Developer Resource Center A central starting point to find documentation, code
samples, release notes, and other information to help you
build innovative applications with AWS.
Amazon EC2 product information The primary web page for information about Amazon EC2.
Discussion Forums A community-based forum for developers to discuss
technical questions related to Amazon Web Services.
E-mail address for questions related to This e-mail address is only for account questions. For
your AWS account: technical questions, use the Discussion Forums.
<[email protected]>
Amazon EC2 is a web service that enables you to provision on-demand compute capacity from
Amazon's world class data centers.
This means you can allocate or release resources within minutes, not hours or weeks, as your application
requires. Most importantly, you only pay for what you use. If you use a server instance for an hour, you
pay for an hour. If you use an instance for a year, you pay for a year.
Although the applications for Amazon EC2 are only limited by your ingenuity, there are popular ways in
which our customers use Amazon EC2:
• Scalable Applications—You can build a scalable application that shrinks or expands to meet your
current demands.
This can help you use only the compute resources that you need and can help you respond to events
where a mention on a popular news site can result in a dramatic spike in traffic.
• Temporary Events—You can use Amazon EC2 for temporary solutions and one-off events that
would require you to maintain a fleet of compute resources that are normally idle.
This includes hosting conferences in virtual worlds, live blogging, distribution of newly released
media, and short-term promotional websites.
• Batch Processing—You can use Amazon EC2 for projects that require massive compute resources
which would be expensive to build on your own.
This includes video and image processing, financial data processing, and science and research
applications.
• Fault Resilient Applications—You can build an application across multiple availability zones which
will be protected against the loss of an entire physical location.
Topics
• Creating an AMI
• Bundling an AMI
• Shared AMI Guidelines
• Sharing AMIs
• Creating Paid AMIs
Creating an AMI
There are two common ways to create an AMI that offer a mix of ease of use and detailed customization
levels.
The easiest method involves starting from an existing public AMI and modifying it according to your
requirements, as described in Starting with an Existing AMI.
Another approach is to build a fresh installation either on a stand-alone machine or on an empty file
system mounted by loopback. This essentially entails building an operating system installation from
scratch and is described in Creating an AMI through a Loopback File.
After the installation package has been built to your satisfaction, you must bundle it and upload it to
Amazon Simple Storage Service (Amazon S3) as described in Bundling an AMI.
Note
Before selecting an AMI, determine whether the instance types you plan to launch are
32-bit or 64-bit. For more information, see Instance Types
1. Select an AMI
2. Generate a Key Pair
3. Launch the Instance
4. Authorize Network Access
5. Connect to the Instance
6. Upload the Key and Certificate
Select an AMI
First, locate an AMI that contains the packages and services you require. This can be one of your own
AMIs or a public AMIs provided by Amazon EC2.
To select an AMI:
The response includes the image ID, the location of the file in Amazon S3, and whether the file is
available.
2. Choose an AMI from the list and write down its AMI ID.
Example
After you generate a key pair, the public key is stored in Amazon EC2 using the key pair name you
selected. Whenever you launch an instance using the key pair name, the public key is copied to the
instance metadata. This allows you to access the instance securely using your private key.
where <keypair-name> is the name you select for the key pair.
Note
Example
To launch an instance
where <ami_id> is the AMI ID you selected earlier and <keypair-name> is the name of the key
pair. The command will return the AMI instance ID, a unique identifier for each launched instance.
You use the instance ID to manipulate the instance. This includes viewing the status of the instance,
terminating the instance, and so on.
When the status field displays "running," the instance was created and is booting. However, the
instance might not be immediately accessible over the network. Make sure to use the appropriate
DNS name provided by the ec2-describe-instances command.
Important
Once you launch an instance, you will be billed for all usage, including hourly CPU time.
Make sure to terminate any instances that you do not want to leave running. For
information on Amazon EC2 pricing, refer to the Amazon EC2 home page.
Example
To connect to an instance
• If you are launching an AMI that supports SSH login (e.g., public AMIs), use the following command
to log in with your private key:
where <private-keyfile> is the file that contains the private key and dns_location is the DNS
location of the instance within Amazon EC2. Your instance displays a prompt that contains your
username and the hostname of the instance.
You now have complete control over the instance. You can add, remove, modify, or upgrade packages
and files to suit your needs.
Important
We recommend exercising extreme care when changing some of the basic Amazon EC2
configuration settings, such as the network interface configuration and the /etc/fstab
contents. Otherwise, the AMI might become unbootable or inaccessible from the network
once running.
Example
Note
For information on obtaining your Amazon EC2 private key and X.509 certificate, refer to
the Amazon Elastic Compute Cloud Getting Started Guide.
1. Copy your Amazon EC2 private key and X.509 certificate to the /mnt directory.
2. Enter the following command:
PROMPT> scp <private_keyfile> <certificate_file> root@<dns_location>:/mnt
where <private_keyfile> is the file that contains the private key, certificate_file is the
file that contains the certificate, and dns_location is the DNS location of the instance within
Amazon EC2.
Amazon EC2 returns the name of the files and some performance statistics.
Note
It is important that the key and cert files are uploaded into /mnt to prevent them from
being bundled with the new AMI.
You are ready to bundle the volume and uploading the resulting AMI to Amazon S3. For more
information, see Bundling an AMI.
Example
Note
Before selecting an AMI, determine whether the instance types you plan to launch are
32-bit or 64-bit. For more information, see Instance Types
Make sure you are using GNU Tar 1.15 or later.
These examples use Fedora Core 4. Please make any adjustments for your distribution.
The dd utility can create files of arbitrary sizes. Make sure to create a file large enough to host the
operating system, tools, and applications that you will install. For example, a baseline Linux installation
requires about 700MB, so your file should be at least 1 GB.
where <image_name> is the name of the image file you are creating and <size> is the size of the
file in megabytes.
Example
Example
1. Create a mount point in the file system where the image will be attached:
# mkdir <image_mountpoint>
where <image_name> is the name of the image file and <image_mountpoint> is the mount
location.
Example
The following commands create and mount the my-image.fs image file:
# mkdir /mnt/ec2-fs
# mount -o loop my-image.fs /mnt/ec2-fs
1. Create a /dev directory and populate it with a minimal set of devices (you can ignore the errors in
the output):
# mkdir /mnt/ec2-fs/dev
# /sbin/MAKEDEV -d <image_mountpoint>/dev -x console
# /sbin/MAKEDEV -d <image_mountpoint>/dev -x null
# /sbin/MAKEDEV -d <image_mountpoint>/dev -x zero
3. Create a temporary yum configuration file (e.g., yum-xen.conf) and add the following
components:
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
exclude=*-debuginfo
gpgcheck=0
obsoletes=1
reposdir=/dev/null
[base]
name=Fedora Core 4 - $basearch - Base
mirrorl
ist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
[updates-released]
name=Fedora Core 4 - $basearch - Released Updates
mirrorl
ist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasev
er
enabled=1
This ensures all the required basic packages and utilities are installed. This file can be located
anywhere on your main file system (not on your loopback file system) and is only used during
installation.
4. Enter the following:
# mkdir <image_mountpoint>/proc
# mount -t proc none <image_mountpoint>/proc
Example
These commands create the /dev directory and populate it with a minimal set of devices:
# mkdir /mnt/ec2-fs/dev
# /sbin/MAKEDEV -d /mnt/ec2-fs/dev -x console
MAKEDEV: mkdir: File exists
MAKEDEV: mkdir: File exists
MAKEDEV: mkdir: File exists
# /sbin/MAKEDEV -d /mnt/ec2-fs/dev -x null
MAKEDEV: mkdir: File exists
MAKEDEV: mkdir: File exists
MAKEDEV: mkdir: File exists
# /sbin/MAKEDEV -d /mnt/ec2-fs/dev -x zero
# mkdir /mnt/ec2-fs/proc
# mount -t proc none /mnt/ec2-fs/proc
You now have a base installation, which you can configure for operation inside Amazon EC2 and
customize for your use.
Example
This example installs the operating system at the /mnt/ec2-fs mount point using the yum-xen.conf
yum configuration file.
# yum -c yum-xen.conf --installroot=/mnt/ec2-fs -y groupinstall Base
Setting up Group Process
Setting up repositories
base 100% |=========================| 1.1 kB 00:00
updates-released 100% |=========================| 1.1 kB 00:00
comps.xml 100% |=========================| 693 kB 00:00
comps.xml 100% |=========================| 693 kB 00:00
Setting up repositories
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 824 kB 00:00
base : ################################################## 2772/2772
Added 2772 new packages, deleted 0 old in 15.32 seconds
primary.xml.gz 100% |=========================| 824 kB 00:00
updates-re: ################################################## 2772/2772
Added 2772 new packages, deleted 0 old in 10.74 seconds
...
Complete!
Note
The Amazon EC2 DHCP server ignores hostname requests. If you set
DHCP_HOSTNAME, the local hostname will be set on the instance but not externally.
Additionally, the local hostname will be the same for all instances of the AMI, which
might be confusing.
2. Ensure that networking starts by making sure the following line appears in the
/mnt/ec2-fs/etc/sysconfig/network file:
NETWORKING=yes
3. Amazon EC2 provides the instance with additional local disk storage on /dev/sda2 and swap
space on /dev/sda3. To ensure both these are mounted at system startup, add the following lines
to /mnt/ec2-fs/etc/fstab:
/dev/sda2 /mnt ext3 defaults 0 0
/dev/sda3 swap swap defaults 0 0
Note
The /dev/sda2 and /dev/sda3 storage locations only apply to small instances. For
more information on instance storage, see Instance Storage .
4. Make sure all of your required services start at system startup by allocating them appropriate
system run levels. For example, to enable the service my-service on multi-user and networked
run levels, enter the following commands:
# chroot /mnt/ec2-fs /bin/sh
# chkconfig --level 345 my-service on
# exit
5. After your new installation is successfully installed and configured to operate in the Amazon EC2
environment, you can unmount the image:
# umount <image_mountpoint>/proc
# umount -d <image_mountpoint>
Example
The following example unmounts the installation from the /mnt/ec2-fs mount point.
# umount /mnt/ec2-fs/proc
# umount -d /mnt/ec2-fs
Bundling an AMI
To use a file system image with Amazon EC2, you must bundle it as an AMI. The bundling process
does the following:
This section describes the AMI tools that automate this process and provides examples of their use.
The AMI tools RPM is available from our public Amazon S3 downloads bucket.
Installation Issues
The AMI tools libraries install in /usr/lib/site_ruby.
If you receive a load error when running one of the AMI utilities, Ruby might not have found the path.
To fix this, add /usr/lib/site_ruby to Ruby's library path, which is set in the RUBYLIB
environment variable.
Viewing Documentation
To view the manual for each utility
where <image_name> is the name of the image file, <private_keyfile> is the file that contains
the private key, <certificate_file> is the file that contains the certificate, and <user_id> is the
user ID associated with your account.
Note
The user ID is your AWS account ID without dashes. It is the same as your Amazon
Access ID and consists of 12 digits.
To bundle an AMI you created by taking a snapshot of the local machine root file system (requires
root privileges)
where <private_keyfile> is the file that contains the private key, <certificate_file> is the
file that contains the certificate, and <user_id> is the user ID associated with your account.
Note
Note
The user ID is your AWS account ID without dashes. It is the same as your Amazon
Access ID and consists of 12 digits.
Example
Buckets must have globally unique names. The ec2-upload-bundle utility uploads the bundled AMI
to a specified bucket. If the specified bucket does not exist, it will be created. If the specified bucket
exists and belongs to another user, the ec2-upload-bundle command will fail.
where <bucket> is the target bucket, <access_key> is your AWS Access Key, and
<secret_key> is your AWS Secret Key.
The AMI manifest file and all image parts are uploaded to Amazon S3. The manifest file is encrypted
with the Amazon EC2 public key before being uploaded.
Sharing AMIs
Topics
Shared AMIs are AMIs that developers build and make available for other AWS developers to use.
Building safe, secure, useable AMIs for public consumption is a fairly straightforward process, if you
follow a few simple guidelines.
For information on building shared AMIs, see Shared AMI Guidelines. For information on sharing
AMIs, see Sharing AMIs
Note
These guidelines are written for Fedora distributions, but the principles apply to any AMI.
You might need to modify the provided examples for other distributions. For other
distributions, review their documentation or search the AWS forums in case someone else
has done it already.
We recommend that your AMIs download and upgrade the Amazon EC2 AMI creation tools during
startup. This ensures that new AMIs based on your shared AMIs will have the latest AMI tools.
Note
When deciding which software to automatically update, consider the amount of WAN
traffic that the update will generate (your users will be charged for it) and the risk of the
update breaking other software on the AMI.
Note
• On most Red Hat systems, add these steps to your /etc/rc.d/rc.local script.
• On Gentoo systems, add them to /etc/conf.d/local.local.
• On Ubuntu systems, add them to /etc/rc.local.
• On Debian, you might need to create a start up script in /etc/init.d and use
update-rc.d <scriptname> defaults 99 (where <scriptname> is the name of
the script you created) and add the steps to this script.
To solve this problem, disable password-based logins for the root user. Additionally, we recommend
you randomize the root password at boot.
1. Open the /etc/ssh/sshd_config file with a text editor and change the following line:
#PermitRootLogin yes
to
PermitRootLogin without-password
The location of this configuration file might differ for your distribution, or if you are not running
OpenSSH. If this is the case, consult the relevant documentation.
2. To randomize the root password, add the following to your boot process:
if [ -f "/root/firstrun" ] ; then
dd if=/dev/urandom count=50|md5sum|passwd --stdin root
rm -f /root/firstrun
else
echo "* Firstrun *" && touch /root/firstrun
fi
Note
This step assumes that a /root/firstboot file is bundled with the image. If file was not
created, the root password will never be randomized and will be set to the default.
Note
If you are using a distribution other than Fedora, you might need to consult the
documentation that accompanied the distribution.
Amazon EC2 allows users to specify a public-private key pair name when launching an instance. When
a valid key pair name is provided to the RunInstances API call (or through the command line API
tools), the public key (the portion of the key pair that Amazon EC2 retains on the server after a call to
CreateKeyPair) is made available to the instance through an HTTP query against the instance metadata.
To login through SSH, your AMI must retrieve the key value at boot and append it to
/root/.ssh/authorized_keys (or the equivalent for any other user account on the AMI). Users will
be able to launch instances of your AMI with a key pair and log in without requiring a root password.
if [ ! -d /root/.ssh ] ; then
mkdir -p /root/.ssh
chmod 700 /root/.ssh
fi
# Fetch public key using HTTP
curl http://169.254.169.254/2008-02-01//meta-data/public-keys/0/openssh-key >
/tmp/my-key
if [ $? -eq 0 ] ; then
cat /tmp/my-key >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
rm /tmp/my-key
fi
This can be applied to any user account; you do not need to restrict it to root.
Note
Rebundling an instance based on this image includes the key with which it was launched.
To prevent the key's inclusion, you must clear out (or delete) the authorized_keys file
or exclude this file from rebundling.
• Open the /etc/ssh/sshd_config file with a text editor and change the following line:
#UseDNS yes
to:
UseDNS no
Note
The location of this configuration file can differ for your distribution or if you are not
running OpenSSH. If this is the case, consult the relevant documentation.
Identify Yourself
Currently, there is no easy way to know who provided a shared AMI as each AMI is represented by a
numeric user ID.
We recommend that you post a description of your AMI, and the AMI ID, in the Amazon EC2
developer forum. This provides a convenient central location for users who are interested in trying new
shared AMIs.
Protect Yourself
The previous sections described how to make your shared AMIs safe, secure, and useable for the users
who launch them. This section describes guidelines to protect yourself from the users of your AMI.
We recommend against storing sensitive data or software on any AMI that you share. Users who launch
a shared AMI might be able to rebundle it and register it as their own. Follow these guidelines to help
you to avoid some easily overlooked security risks:
• Always delete the shell history before bundling. If you attempt more than one bundle upload in the
same image, the shell history contains your secret access key.
• Bundling a running instance requires your private key and X.509 certificate. Put these and other
credentials in a location that is not bundled (such as the ephemeral store).
• Exclude the ssh authorized keys when bundling the image. The Amazon public images store the
public key used to launch an instance with its ssh authorized keys file.
Note
Unfortunately, it is not possible for this list of guidelines to be exhaustive. Build your
shared AMIs carefully and take time to consider where you might expose sensitive data.
Sharing AMIs
Amazon EC2 enables users to share their AMIs with other users. This section describes how to share
AMIs using the Amazon EC2 command line tools.
Note
Before proceeding, make sure to read the security considerations of sharing AMIs in the
Shared AMI Guidelines section.
AMIs have a launchPermission property that controls which users, besides the owner, are allowed to
launch instances of that AMI. By modifying an AMI's launchPermission property, you can allow all
users to launch the AMI (make the AMI public) or only allow a few specific users to launch the AMI.
The launchPermission attribute is a list of users and launch groups. Launch permissions can be
granted by adding or removing items from the list. Explicit launch permissions for users are granted or
revoked by adding or removing their AWS account IDs. The only launch group currently supported is
the all group, which makes the AMI public. The rest of this section refers to launch groups simply as
groups. Launch groups are not the same as security groups and the two should not be confused. An AMI
can have both public and explicit launch permissions.
Note
You are not billed when your AMI is launched by other users. Users launching the AMI
are billed.
• Add the all group to the AMI's launchPermission attribute using the ec2-modify-image-attribute
command:
PROMPT> ec2-modify-image-attribute <ami_id> --launch-permission -a all
This will not affect any explicit launch permissions for the AMI or any running instances of the AMI.
Example
This example removes the all group from the permissions of the ami-2bb65342 AMI, making it
private:
PROMPT> ec2-modify-image-attribute ami-2bb65342 -l -r all
launchPermission ami-2bb65342 REMOVE group all
where <ami_id> is the ID of the AMI and <user_id> is the user's account ID, without hyphens.
where <ami_id> is the ID of the AMI and <user_id> is the user's account ID, without hyphens.
• Enter the following command to remove all public and explicit launch permissions:
PROMPT> ec2-reset-image-attribute <ami_id> -l
Note
The AMI owner always has rights to the AMI and will be unaffected by the
ec2-reset-image-attribute command.
Example
The following example grants launch permissions to the 495219933132 user for the ami-2bb65342
AMI:
PROMPT> ec2-modify-image-attribute ami-2bb65342 -l -a 495219933132
launchPermission ami-2bb65342 ADD userId 495219933132
The following example removes launch permissions from the 495219933132 user for the ami-2bb65342
AMI:
PROMPT> ec2-modify-image-attribute ami-2bb65342 -l -r 495219933132
launchPermission ami-2bb65342 REMOVE userId 495219933132
The following example removes all public and explicit launch permissions from the ami-2bb65342
AMI:
PROMPT> ec2-reset-image-attribute ami-2bb65342 -l
launchPermission ami-2bb65342 RESET
To publish your AMI, post it in the Public AMIs Folder of the Amazon Web Services Resource Center.
• AMI ID
• AMI manifest
• Publisher
• Publisher URL
• OS / Distribution
• Key Features
• Description
• Daemons / Services
• Release Notes
You can cut and paste the following template into the document. You must be in HTML edit mode.
Amazon DevPay is a billing and account management service that enables you to get paid for an AMI
you create and that other Amazon EC2 users use. Amazon DevPay creates and manages the order
pipeline and billing system for you. Your customers sign up for your AMI, and Amazon DevPay
automatically meters their usage of Amazon EC2, bills them based on the pricing you set, and collects
their payments. What else is special about DevPay?
• You can charge customers for your AMI; the charges can include recurring charges based on the
customer's usage Amazon EC2, a fixed one-time charge, and a recurring monthly charge.
• Your customers can easily sign up and pay for your AMI with their trusted Amazon.com accounts.
• Your customers are authenticated, thus ensuring they have access only to what they should.
• If your customers don't pay their bills, DevPay turns off their access to your AMI for you.
• Amazon Payments handles payment processing.
1 Your customer uses an Amazon.com account to sign up and pay for your AMI. The
sign-up page indicates that you have teamed up with Amazon Payments to make billing
easy and secure.
2 Your customer pays the price you've defined to use your product.
3 DevPay subtracts the required DevPay fees and pays you the difference.
4 You pay the costs of Amazon EC2 that your AMI used.
To learn more about Amazon DevPay, see the Amazon DevPay Developer Guide.
• Paid AMIs—You charge for the use of an AMI you've created and shared with either select
customers or the public. You might want to share the AMI with only select customers, for example, if
you're offering a special price to just those customers.
• Supported AMIs—You charge your customers for software or a service you provide that they use
with their own AMIs.
You determine the rates you want to charge customers who use paid AMIs or supported AMIs. The
price you charge can include a one-time charge, a monthly charge, and a markup on the hourly instance
or the data transferred charge. For more information about how you can set your prices, see the Amazon
DevPay Developer Guide.
Note
Detailed information about most of the following steps is provided in the Amazon DevPay
Developer Guide.
2 You register a product with Amazon DevPay (see.Product Registration) As part of this
process, you provide a product description, product pricing, etc. This registration process
creates a product code for the product and a URL where customers can sign up to use the
product (called the purchase URL).
3 You use an Amazon EC2 command or API call to associate the product code with your
AMI (see Associating a Product Code with an AMI ). This makes the AMI a paid AMI.
4 You use an Amazon EC2 command or API call to share the AMI with select customers or
the public (see Sharing Your Paid AMI with Select Users or the Public).
Note
Even if you share a paid AMI and it has a product code, no one can use the
AMI until they sign up for it (see the following steps).
5 You advertise your paid AMI to customers and make the purchase URL available to them.
Note that you can submit your paid AMI to be listed on the AWS Resource Center with
other public AMIs at
http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=116.
6 Customers who want to use your AMI discover your product through your advertisements
or the AWS Resource Center, etc.
7 Customers then use the purchase URL you provide to sign up for and purchase your
product. If they're not already signed up for Amazon EC2, they'll be prompted to sign up.
They purchase your product with their Amazon.com accounts. They must have the
credentials needed to launch Amazon EC2 instances. At this point, they have the AMI ID
(from either step 5 or step 6 above).
8 Customers then launch an Amazon EC2 instance specifying the AMI ID. Because you
associated the shared AMI with the product code, the customers are charged at the rate you
set. For more information, see Paying for AMIs.
Each customer's bill for the AMI is displayed on their Application Billing page, which shows the
activity for DevPay products. For more information, see the Amazon DevPay Developer Guide.
1 You register a product with Amazon DevPay (see Product Registration). As part of this
process, you provide a product description, product pricing, etc. This registration process
creates a product code for the product and a URL where customers can sign up to use the
product (called the purchase URL).
2 You then advertise your paid AMI to customers and make the purchase URL available to
them.
3 Customers who want to use your product discover the product through your
advertisements, etc.
4 Customer then use the purchase URL to sign up for and purchase your product. If they're
not already signed up for Amazon EC2, they'll be prompted to sign up. They purchase
your product with their Amazon.com accounts. They must have the credentials needed to
launch Amazon EC2 instances. At this point, they have the product code (from either step
2 or step 3 above).
5 Customers then use an Amazon EC2 command or API call to associate the product code
with their AMIs (see Associating a Product Code with an AMI).
6 Customers then launch one or more instances of the AMIs. Because the customers
associated their AMIs with the product code, they are charged at the rate you set.
Each customer's bill for the AMI is displayed on their Application Billing page, which shows the
activity for DevPay products. For more information, see the Amazon DevPay Developer Guide.
When a customer contacts you for support for an AMI, you can confirm your product code is associated
with the AMI and the customer's instance is currently running the AMI (see Confirming an Instance Is
Running an AMI Associated with a Product Code).
Product Registration
You must register your AMI (referred to as your product) with Amazon DevPay. During registration,
you provide product information such as pricing, and you receive information you need to sell your
product.
Note
AWS must approve your product after you register it. The approval process takes several
business days. During that time you can begin integrating your product with DevPay.
• Company name
• Product name
• Product description (as you want your customers to see it)
• Redirect URL (the page you want customers to see after they have purchased the product)
• Any terms and conditions you want displayed (optional)
• Contact e-mail address and telephone number (to be used by AWS and not displayed to customers)
• Contact e-mail or URL (to be displayed to customers)
• Pricing for use of the product
The information you display at the redirect URL should give information about the AMI.
• Product code
• Product token
• Purchase URL
You need the product code and purchase URL to integrate your product with DevPay as described in
Summary of How Paid AMIs Work and Summary of How Supported AMIs Work. You need the
product token if you're going to set up your system to later verify whether a customer is still subscribed
to your product. For more information, see the Amazon DevPay Developer Guide.
Important
The Amazon DevPay Developer Guide covers the procedure for registering your product
with Amazon DevPay. Before you register your product, we recommend you read the
information in that guide about how to set your AMI's price and how billing for Amazon
DevPay products works.
You can't change or remove the productCodes attribute after you've set it. If you want to use the same
image without the product code or associate a different product code with the image, you must reregister
the image to obtain a new AMI ID. You can then use that AMI without a product code or associate the
new product code with the AMI ID.
Example
The following example associates the ami-2bb65342 AMI with the 774F4FF8 product code:
PROMPT> ec2-modify-image-attribute ami-2bb65342 --product-code 774F4FF8
productCodes ami-2bb65342 productCode 774F4FF8
This example verifies that the product code is associated with the AMI:
PROMPT> ec2-describe-image-attribute ami-2bb65342 --product-code
productCodes ami-2bb65342 productCode 774F4FF8
Even though you've shared the AMI, no one can use it until they sign up for your product by going to
the purchase URL. Once customers sign up, any instances of the paid AMI they launch will be billed at
the rate you specified during product registration.
Example
The following example shares the ami-2bb65342 AMI with the public:
PROMPT> ec2-modify-image-attribute ami-2bb65342 --launch-permission -a all
launchPermission ami-2bb65342 ADD group all
Note
To confirm an AMI is associated with your product code and an instance is running that AMI
If the AMI is associated with the product code, true is returned with the AMI owner's account ID.
Otherwise, false is returned.
Example
The following example confirms whether the i-10a64379 instance is running the 6883959E product
code:
PROMPT> ec2-confirm-product-instance 6883959E -i i-10a64379
6883959E i-10a64379 true 495219933132
The instance retrieves the product code by querying a web server with this REST-like API call:
GET http://169.254.169.254/2007-03-01/meta-data/product-codes
Example response:
774F4FF8
Topics
• Instance Usage
• Instance Types
• Instance Metadata
• Using Shared AMIs
• Paying for AMIs
• Get Console Output and Reboot Instances
This section describes how to launch instances and retrieve instance-specific data from within the
instance. It also covers launching shared AMIs and security risks associated with running shared AMIs.
Instance Usage
The instance is your basic computation building block. Amazon EC2 offers multiple instance types from
which you can choose. You can run as many or as few instances as you need at any given time.
Once launched, an instance looks very much like a traditional host. You have complete control of your
instances; you have root access to each one and you can interact with them as you would any machine.
Here are some suggestions for making the best use of Amazon EC2 instances.
Instance Types
Amazon EC2 provides the flexibility to meet your computing needs by allowing you to choose from
different instance types. Each instance type provides a predictable amount of dedicated compute
capacity and is charged per instance-hour.
CPU 1 EC2 Compute Unit (1 4 EC2 Compute Units (2 8 EC2 Compute Units (4
virtual core with 1 EC2 virtual cores with 2 EC2 virtual cores with 2 EC2
Compute Unit) Compute Units each) Compute Units each)h
Storage 160 GB instance storage 850 GB instance storage (2 1690 GB instance storage
(150 GB plus 10 GB root x 420 GB plus 10 GB root (4 x 420 GB plus 10 GB
partition) partition) root partition)
Note
The small instance type is the original Amazon EC2 instance type available since the
launch of Amazon EC2. It is the default instance type for all customers. To use other
instance types, you must specify them through the RunInstances operation.
Amazon EC2 uses a variety of measures to provide each instance with a consistent and predictable
amount of CPU capacity. To make it easy for developers to compare CPU capacity between different
instance types, we defined an Amazon EC2 Compute Unit.
Note
We use several internal benchmarks and tests to manage the consistency and predictability
of the performance of an Amazon EC2 Compute Unit. For more information, go to the
Instance page.
To find out which instance will work best for your application, we recommend launching an instance
and using your own benchmark application. This will help you determine which instance type works
best for your specific use case.
I/O Resources
Amazon EC2 provides virtualized server instances. While some resources like CPU, memory and
instance storage are dedicated to a particular instance, other resources like the network and the disk
subsystem are shared amongst instances. If each instance on a physical host tries to use as much of one
of these shared resources as possible, each will receive an equal share of that resource. However, when a
resource is under-utilized you will often be able to consume a higher share of that resource while it is
available.
The different instance types will provide higher or lower minimum performance from the shared
resources depending on their size. Each of the instance types has an I/O performance indicator
(moderate or high). Instance types with high I/O performance have a larger allocation of shared
resources. Allocating larger share of shared resources also reduces the variance of I/O performance. For
most applications, moderate I/O performance is more than enough. However, for applications that
require greater or more consistent I/O performance, consider instances with high I/O performance.
Instance Metadata
Amazon EC2 instances can access instance-specific metadata as well as data supplied when launching
the instances. This data can be used to build more generic AMIs that can be modified by configuration
files supplied at launch time.
Example
If you run web servers for various small businesses, they can all use the same AMI and retrieve their
content from the Amazon S3 bucket you specify at launch.
To add a new customer at any time, simply create a bucket for the customer, add their content, and
launch your AMI.
User-supplied data is treated as opaque data: what you give us is what you get back.
Note
• All instances launched together get the same user-supplied data. You can use the AMI
launch index as an index into the data.
• User data is limited to 16K. This limit applies to the data in raw form, not base64
encoded form.
• The user data must be base64 encoded before being submitted to the API. The API
command-line tools perform the base64 encoding for you. The data is in base64 and is
decoded before presented to the instance.
Data Retrieval
An instance retrieves the data by querying a web server using a Query API. The base URI of all requests
is http://169.254.169.254/2008-02-01/ where 2008-02-01 indicates the API version.
Note
Amazon EC2 Version 1.0 is part of a legacy versioning scheme. Newer versions follow a
date based versioning scheme. For more information on the versioning scheme used by
Amazon EC2, see API Versioning.
The latest version of the API is always available using the URI http://169.254.169.254/latest.
Note
You are not billed for HTTP requests used to retrieve metadata and user-supplied data.
Retrieving Metadata
Requests for a specific metadata resource returns the appropriate value or a 404 HTTP error code if the
resource is not available. All metadata is returned as text (content type text/plain).
Requests for a general metadata resource (i.e. an URI ending with a /) return a list of available resources
or a 404 HTTP error code if there is no such resource. The list items are on separate lines terminated by
line feeds (ASCII 10).
Example
The following examples list HTTP GET requests and responses. You can use a tool such as curl or wget
to make these types of requests.
2007-03-01
2008-02-01
This examples get the value of each metadata item in the above example:
GET http://169.254.169.254/2008-02-01/meta-data/ami-manifest-path
my-amis/spamd-image.manifest.xml
GET http://169.254.169.254/2008-02-01/meta-data/ami-manifest-path
my-amis/spamd-image.manifest.xml
GET http://169.254.169.254/2008-02-01/meta-data/ami-id
ami-2bb65342
GET http://169.254.169.254/2008-02-01/meta-data/reservation-id
r-fea54097
GET http://169.254.169.254/2008-02-01/meta-data/hostname
ec2-67-202-51-223.compute-1.amazonaws.com
Note
All user-supplied data is treated as opaque data; what you give us is what you get back. It
is the responsibility of the instance to interpret this data appropriately.
Example
The master database configuration specifies various database parameters (e.g., the size of store) while
the replicas' configuration specifies different parameters, such as the replication strategy. Alice decides
to provide this data as an ASCII string with a pipe symbol (| delimiting the data for the various
instances:
store-size=123PB backup-every=5min | replicate-every=1min | replicate-
every=2min | replicate-every=10min | replicate-every=20min
Once launched, all instances have a copy of the user data and the common metadata shown here:
Instance 1
Metadata Value
instance-id i-3ea74257
ami-launch-index 0
public-hostname ec2-67-202-51-223.compute-1.amazonaws.com
public-ipv4 67.202.51.223
local-hostname ip-10-251-50-35.ec2.internal
local-ipv4 10.251.50.35
Instance 2
Metadata Value
instance-id i-31a74258
ami-launch-index 1
public-hostname ec2-67-202-51-224.compute-1.amazonaws.com
public-ipv4 67.202.51.224
local-hostname ip-10-251-50-36.ec2.internal
local-ipv4 10.251.50.36
Instance 3
Metadata Value
instance-id i-31a74259
ami-launch-index 2
public-hostname ec2-67-202-51-225.compute-1.amazonaws.com
public-ipv4 67.202.51.225
local-hostname ip-10-251-50-37.ec2.internal
Metadata Value
local-ipv4 10.251.50.37
Instance 4
Metadata Value
instance-id i-31a7425a
ami-launch-index 3
public-hostname ec2-67-202-51-226.compute-1.amazonaws.com
public-ipv4 67.202.51.226
local-hostname ip-10-251-50-38.ec2.internal
local-ipv4 10.251.50.38
Therefore, an instance can determine its portion of the user-supplied data by doing the following:
GET http://169.254.169.254/2008-02-01/meta-data/ami-launch-index
1
GET http://169.254.169.254/2008-02-01/user-data
store-size=123PB backup-every=5min | replicate-every=1min
| replicate-every=2min | replicate-every=10min | replicate-
every=20min
user_data.split('|')[ami_launch_index]
Instance Storage
Every instance includes a fixed amount of storage space on which you can store data. Within this
document, it is referred to as the "ephemeral store" as it is not designed to be a permanent storage
solution.
If an instance reboots (intentionally or unintentionally), the data on the ephemeral store will survive. If
the underlying drive fails or the instance is terminated, the data will be lost.
Storage Locations
API Version 2008-02-01
43
Amazon Elastic Compute Cloud Developer Guide
Disk Performance Optimization
Location Description
/dev/sda1 Formatted and mounted as root (/) on all instance types
/dev/sda2 Formatted and mounted as /mnt on small instances
/dev/sda3 Formatted and mounted as /swap on small instances
/dev/sdb Formatted and mounted as /mnt on large and extra large instances
/dev/sdc Available on large and extra large instances; not mounted
/dev/sdd Available on extra large instances; not mounted
/dev/sde Available on extra large instances; not mounted
To initialize the stores, use the following commands on the m1.large and m1.xlarge instance types:
dd if=/dev/zero of=/dev/sdb bs=1M
dd if=/dev/zero of=/dev/sdc bs=1M
dd if=/dev/zero of=/dev/sdd bs=1M (m1.xlarge only)
dd if=/dev/zero of=/dev/sde bs=1M (m1.xlarge only)
Note
This can take a long time (about 8 hours for an extra-large instance).
RAID Configuration
Configuring drives for RAID initializes them by writing to every drive location. When configuring
software-based RAID, make sure to change the minimum reconstruction speed:
echo $((30*1024)) > /proc/sys/dev/raid/speed_limit_min
Note
You cannot use iostat (part of the sar System Activity Reporting package) to watch
performance. You also cannot watch 'cat /proc/mdstat'.
Availability Zones
Amazon operates state-of-the-art, highly available data center facilities. However, failures can occur that
affect the availability of instances that are in the same location. Although this is rare, if you host all your
Amazon EC2 instances in a single location that is affected by such a failure, your instances will be
unavailable.
Amazon EC2 provides the ability to place instances in multiple locations. Amazon EC2 locations are
composed of availability zones and regions. Regions are geographically dispersed and located in
separate geographic areas or countries. Currently, Amazon EC2 exposes only a single region with
multiple availability zones. Availability zones are distinct locations that are engineered to be insulated
from failures in other availability zones and provide inexpensive, low latency network connectivity to
other availability zones in the same region. Regions consist of one or more availability zones. By
launching instances in separate availability zones, you can protect your applications from the failure of a
single location.
For example, if you have instances distributed across three availability zones and one of them fails, you
can design your application so the instances in the remaining availability zones handle any requests.
Note
You can use availability zones in conjunction with elastic IP addresses to remap IP
addresses across availability zones. For information on elastic IP addresses, see Elastic IP
Addresses.
Note
Availability zones are not the same across accounts. The availability zone us-east-1a for
account A is not necessarily the same as us-east-1a for account B. Zone assignments are
mapped independently for each account.
After determining the availability zones that are available to you, you can launch instances in any of the
zones.
Note
You will be charged a small bandwidth charge for data that crosses availability zones. For
more information, go to the Amazon EC2 portal page.
• Use the ec2-describe-images command (or the abbreviated ec2dim command) with a flag to filter the
results.
Example
The -x all flag shows AMIs executable by all users. This includes AMIs you own.
This command displays a list of AMIs for which you have explicit launch permissions:
PROMPT> ec2dim -x self
where <target_uid> is the account ID of the user who owns the AMIs for which you are looking.
Ideally, you should get the AMI ID from a trusted source (a website, another user, etc). If you do not
know the source of an AMI, we recommended that you search the forums for comments on the AMI
before launching it. Conversely, if you have questions or observations about a shared AMI, feel free to
use the AWS forums to ask or comment.
Amazon's public images have an aliased owner and display amazon in the userId field. This allows you
to find Amazon's public images easily.
Note
If you choose to launch a shared AMI, take the following minimum steps after launch to confirm the
AMI is not doing anything malicious:
1. Check the ssh authorized keys file. The only key in the file should be the key you used to launch the
AMI.
2. Check open ports and running services.
3. Change the root password if is not randomized on startup. For more information on randomizing the
root password on startup, see Disable Password-Based Logins for Root.
4. Check if ssh allows root password logins. See Disable Password-Based Logins for Root for more
information on disabling root based password logins.
5. Check whether there are any other user accounts that might allow backdoor entry to your instance.
Accounts with super user privileges are particularly dangerous.
6. Verify that all cron jobs are legitimate.
Amazon EC2 integrates with Amazon DevPay, allowing developers to charge users for the use of their
AMIs or to provide support for instances. To learn more about Amazon DevPay see the Amazon DevPay
Developer Guide. To learn more about charging for your use of your AMIs, or providing support, see
Creating Paid AMIs
This section describes how to discover paid AMIs, launch paid AMIs, and launch instances with a
support product code. Paid AMIs are AMIs you can purchase from other developers.
You can also tell if an AMI is a paid AMI by describing the image with the ec2-describe-images
command. This command lists the product code associated with an AMI (see the example below). If the
AMI is a paid AMI, it has a product code. Otherwise, it does not. You can then go to the Amazon EC2
resource center and forums, which might have more information about the paid Amazon EC2 and where
you can sign up to use it.
Note
You must sign up for a paid AMI before you can launch it.
where <ami_id> is the AMI ID, <manifest> is the manifest location, <user_id> is the ID of the
user that owns the AMI, <status> indicates whether the AMI is available, and <product_code> is
the product code associated with the AMI. If a product code is present, the AMI is a paid AMI.
Example
This example shows an ec2-describe-images call describing a paid AMI. The product code is
774F4FF8.
$ ec2-describe-images ami-2bb65342
IMAGE ami-2bb65342 awesome-ami/webserver.manifest.xml 495219933132 available
private 774F4FF8
Typically a seller of a paid AMI presents you with information about the AMI, its price, and a link
where you can buy it. When you click the link, you're first asked to log in with an Amazon.com login,
and then you’re taken to a page where you see the paid AMI's price and you confirm you want to
purchase the AMI.
After you purchase a paid AMI, you can launch instances of it. Launching a paid AMI is the same as
launching any other AMI. No additional parameters are required. The instance will be charged according
to the rates set by the owner of the AMI (which will be more than the base Amazon EC2 rate).
Note
The owner of a paid AMI will be able to confirm if a particular instance was launched
using their paid AMI.
Example
This example shows the command used to launch the ami-2bb65342 AMI:
$ ec2-run-instances ami-2bb65342
RESERVATION r-a034c7c9 924417782495 default
INSTANCE i-400df629 ami-2bb65342 pending 0 m1.small 2008-03-21T18:49:33+0000
us-east-1c
Important
To launch a paid AMI, no additional parameters are required for the run-instances. The instance is
charged according to the rates set by the AMI owner.
Example
The following command associates the ami-2bb65342 AMI with the 774F4FF8 product code:
PROMPT> ec2-modify-image-attribute ami-2bb65342 --product-code 774F4FF8
productCodes ami-2bb65342 productCode 774F4FF8
us-east-1c
At any time you can view the usage information for your paid and supported AMIs at
http://www.amazon.com/dp-applications.
Similarly, the ability to reboot instances that are otherwise unreachable is valuable for both
troubleshooting and general instance management.
Amazon EC2 instances do not have a physical monitor through which you can view their console
output. They also lack physical controls that allow you to power up, reboot, or shut them down. To
allow these actions, we provide them through the Amazon EC2 SOAP API, Query API, and
command-line tools.
The posted output is not continuously updated; only when it is likely to be of the most value. This
includes shortly after instance boot, after reboot, and when the instance terminates.
Note
Only the most recent 64 KB of posted output is stored, which is available for at least 1
hour after the last posting.
You can retrieve the console output for an instance through the SOAP API call described in
GetConsoleOutput, the Query API call described in GetConsoleOutput, and the command line tool
described in ec2-get-console-output.
Note
Reboot Instances
Just as you can reset a machine by pressing the reset button, you can reset Amazon EC2 instances
through the SOAP API described in RebootInstances, the Query API described in RebootInstances, and
Topics
• Instance Addressing
• Network Security
This section provides information on the IP addresses that are assigned to instances and how to
configure the firewall provided by Amazon EC2.
Instance Addressing
All Amazon EC2 instances are assigned two IP addresses at launch: a private address (RFC 1918), and a
public address. The public IP address is directly mapped to the private address through Network Address
Translation (NAT). Private addresses are only reachable from within the Amazon EC2 network. Public
addresses are reachable from the Internet.
Amazon EC2 also provides an internal DNS name and a public DNS name which map to the private and
public IP addresses respectively. The internal DNS name can only be resolved within Amazon EC2. The
public DNS name resolves to the public IP address outside the Amazon EC2 network and the private IP
address within the Amazon EC2 network.
Note
If you require persistent Internet routable IP addresses that can be assigned to and removed
from instances as necessary, use elastic IP addresses. For more information, see Elastic IP
Addresses.
This private address is associated exclusively with the instance for its lifetime and is only returned to
Amazon EC2 when the instance terminates.
Always use the internal address when you are communicating between Amazon EC2 instances. This
ensures that your network traffic follows the highest bandwidth, lowest cost, and lowest latency path
through our network.
•
PROMPT> ifconfig eth0
•
PROMPT> curl http://169.254.169.254/latest/meta-data/local-ipv4
The second option refers to the instance data (see Instance Metadata).
Public Addresses
At launch, a public address is also associated with each Amazon EC2 instance using Network Address
Translation (NAT). For more information about NAT, see "RFC 1631: The IP Network Address
Translator (NAT)".
This public address is associated exclusively with the instance until it is terminated or replaced with an
elastic IP address.
Important
Amazon EC2 instances that access other instances through their public NAT IP address are
charged for regional data transfer.
From your instance, you can determine your public IP address by referring to the instance data. For
example:
PROMPT> curl http://169.254.169.254/latest/meta-data/public-ipv4
Public DNS
Each instance is provided an external DNS name in the form
ec2-72-44-45-204.compute-1.amazonaws.com. This DNS name resolves to the public IP address
of the instance outside the Amazon EC2 network and the private IP address from within Amazon EC2
network.
Elastic IP Addresses
By default, all Amazon EC2 instances are assigned two IP addresses at launch: a private (RFC 1918)
address and a public address that is mapped to the private IP address through Network Address
Translation (NAT).
If you use dynamic DNS to map an existing DNS name to a new instance's public IP address, it might
take up to 24 hours for the IP address to propagate through the Internet. As a result, new instances might
not receive traffic while terminated instances continue to receive requests.
To solve this problem, Amazon EC2 provides elastic IP addresses. Elastic IP addresses are static IP
addresses designed for dynamic cloud computing. Elastic IP addresses are associated with your account,
not specific instances. Any elastic IP addresses that you associate with your account remain associated
with your account until you explicitly release them. Unlike traditional static IP addresses, however,
elastic IP addresses allow you to mask instance or availability zone failures by rapidly remapping your
public IP addresses to any instance in your account.
Note
You can only associate one elastic IP address with one instance at a time.
In the following example, web servers are connected to the Internet through elastic IP addresses and to
database servers through their private IP addresses.
The administrator decides to replace a web server with a larger instance type. To do this, the
administrator starts a new instance using a larger instance type (1), disassociates an elastic IP address
from a running instance (2), associates the elastic IP address with the new instance (3), and terminates
the old instance (4).
Note
To ensure our customers are efficiently using elastic IP addresses, we impose a small
hourly charge when these IP addresses are not mapped to an instance. When these IP
addresses are mapped to an instance, they are free of charge.
When you associate an elastic IP address with an instance, its current public IP address is released to the
Amazon EC2 public IP address pool. If you disassociate an elastic IP address from the instance, the
instance is automatically assigned a new public IP address within five to ten minutes.
Network Security
The Amazon EC2 service allows you to dynamically add and remove instances. However, this flexibility
can complicate firewall configuration and maintenance which traditionally relies on IP addresses, subnet
ranges or DNS host names as the basis for the firewall rules.
The Amazon EC2 firewall allows you to assign your instances to user-defined groups and define
firewall rules for these groups. As instances are added or removed, the appropriate rules are enforced.
Similarly, if you change a rule for a group, the changes are automatically applied to all members of the
group.
Concepts
Security Groups
A security group is a named collection of access rules. These access rules specify which ingress (i.e.,
incoming) network traffic should be delivered to your instance. All other ingress traffic will be
discarded.
You can modify rules for a group at any time. The new rules are automatically enforced for all running
instances and instances launched in the future.
Note
Group Membership
When you launch an AMI instance, you can assign it to as many groups as you like.
If no groups are specified, the instance is assigned to the default group. By default, this group allows
all network traffic from other members of this group and discards traffic from other IP addresses and
groups. If this does not meet your needs, you can modify the rule settings of the default group.
Examples
This section provides two examples of how to use the Amazon EC2 firewall.
Note
These examples use the Command Line Tools Reference. You can achieve the same
results using the Using the SOAP API.
Default Group
This example shows Albert modifying the default group to meet his security needs.
2. After a little wait for image launch to complete. Albert, who is a cautious type, checks the access
rules of the default group:
$ ec2-describe-group default
GROUP 598916040194 default default group
PERMISSION default ALLOWS all FROM USER 598916040194 GRPNAME de
fault
Albert notices that it only accepts ingress network connections from other members of the default
group for all protocols and ports.
3. Albert, being paranoid as well as cautious, port scans his instance:
$ nmap -P0 -p1-100 ec2-67-202-51-105.compute-1.amazonaws.com
Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2006-08-07 15:42
SAST
All 100 scanned ports on ec2-67-202-51-105.compute-1.amazonaws.com
(67.202.51.105) are: filtered
Nmap finished: 1 IP address (1 host up) scanned in 31.008 seconds
4. Albert decides he should be able to SSH into his instance, but only from his own machine:
$ ec2-authorize default -P tcp -p 22 -s 192.168.1.130/32
GROUP default
PERMISSION default ALLOWS tcp 22 22 FROM CIDR 192.168.1.130/32
Mary wants to deploy her public, failure resilient, three-tier web service in Amazon EC2. Her grand plan
is to have her web tier start off executing in seven instances of ami-fba54092, her application tier
executing in twenty instances of ami-e3a5408a, and her multi-master database in two instances of
ami-f1a54098. She's concerned about the security of her subscriber database, so she wants to restrict
network access to her middle and back tier machines. When the traffic to her site increases over the
holiday shopping period, she adds additional instances to her web and application tiers to handle the
extra load.
1. First, Mary creates a group for her Apache web server instances and allows HTTP access to the
world.
$ ec2-add-group apache -d "Mary's Apache group"
GROUP apache Mary's Apache group
$ ec2-describe-group apache
GROUP 598916040194 apache Mary's Apache group
$ ec2-authorize apache -P tcp -p 80 -s 0.0.0.0/0
GROUP apache
PERMISSION apache ALLOWS tcp 80 80 FROM CIDR 0.0.0.0/0
$ ec2-describe-group apache
GROUP 598916040194 apache Mary's Apache group
PERMISSION 598916040194 apache ALLOWS tcp 80 80 FROM CIDR
0.0.0.0/0
2. Mary launches seven instances of her web server AMI as members of the apache group:
$ ec2run ami-fba54092 -n 7 -g apache
RESERVATION r-0592776c 598916040194 default
INSTANCE i-cfd732a6 ami-fba54092 pending 0 m1.small
2007-07-11T16:40:44+0000 us-east-1c
INSTANCE i-cfd732a7 ami-fba54092 pending 0 m1.small
2007-07-11T16:40:44+0000 us-east-1c
INSTANCE i-cfd732a8 ami-fba54092 pending 0 m1.small
2007-07-11T16:40:44+0000 us-east-1c
INSTANCE i-cfd732a9 ami-fba54092 pending 0 m1.small
2007-07-11T16:40:44+0000 us-east-1c
INSTANCE i-cfd732aa ami-fba54092 pending 0 m1.small
2007-07-11T16:40:44+0000 us-east-1c
INSTANCE i-cfd732ab ami-fba54092 pending 0 m1.small
2007-07-11T16:40:44+0000 us-east-1c
INSTANCE i-cfd732ac ami-fba54092 pending 0 m1.small
2007-07-11T16:40:44+0000 us-east-1c
$ ec2din i-cfd732a6
RESERVATION r-0592776c 598916040194
INSTANCE i-cfd732a6 ami-fba54092
ec2-67-202-51-245.compute-1.amazonaws.com running 0
m1.small 2007-07-11T16:40:44+0000
3. Being as paranoid as Albert, Mary does a port scan to confirm the permissions she just configured:
$ nmap -P0 -p1-100 ec2-67-202-51-245.compute-1.amazonaws.com
Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2006-08-07 16:21
SAST
Interesting ports on ec2-67-202-51-245.compute-1.amazonaws.com
(67.202.51.245):
(The 99 ports scanned but not shown below are in state: filtered)
PORT STATE SERVICE
80/tcp open http
Nmap finished: 1 IP address (1 host up) scanned in 33.409 seconds
$ telnet ec2-67-202-51-245.compute-1.amazonaws.com 80
Trying 67.202.51.245...
Connected to ec2-67-202-51-245.compute-1.amazonaws.com (67.202.51.245).
Escape character is '^]'.
7. Mary grants network access between her web server group and the application server group:
$ ec2-authorize appserver -o apache -u 495219933132
GROUP appserver
PERMISSION appserver ALLOWS all FROM USER 495219933132 GRPNAME
apache
8. Mary verifies access to her app server is restricted by port scanning one of the application servers:
$ nmap -P0 -p1-100 ec2-67-202-51-162.compute-1.amazonaws.com
Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2006-08-07 15:42
SAST
All 100 scanned ports on ec2-67-202-51-162.compute-1.amazonaws.com
(67.202.51.162) are: filtered
Nmap finished: 1 IP address (1 host up) scanned in 31.008 seconds
9. Mary confirms that her web servers have access to her application servers:
a. She (temporarily) grants SSH access from her workstation to the web server group:
$ ec2-authorize apache -P tcp -p 22 -s 192.168.1.130/32
b. She logs in to one of her web servers and connects to an application server on TCP port 8080:
$ telnet ec2-67-202-51-162.compute-1.amazonaws.com 8080
Trying 67.202.51.162...
Connected to ec2-67-202-51-162.compute-1.amazonaws.com (67.202.51.162).
Escape character is '^]'
c. Satisfied with the setup, she revokes SSH access to the web server group:
$ ec2-revoke apache -P tcp -p 22 -s 192.168.1.130/32
10.Mary repeats these steps to create the database server group and to grant access between the
application server and database server groups.
Notes
• Defining firewall rules in terms of groups is flexible enough to allow you to implement functionality
equivalent to a VLAN.
• In addition to the distributed firewall, you can maintain your own firewall on any of your instances.
This can be useful if you have specific requirements not met by the Amazon EC2 distributed firewall.
Topics
All schemas have a version number (the latest is 2008-02-01). The version number appears in the URL
of a schema file, and in a schema's target namespace. This makes upgrading easy by differentiating
requests based on the version number.
Note
In addition to the latest version, the service will support the older versions for some time,
allowing customers plenty of time to upgrade.
The Amazon EC2 services API WSDL is available from the web at
'http://ec2.amazonaws.com/doc/<version>/ec2.wsdl' where version is the version of the API. At the time
this document was released, the current API version was 2008-02-01, which is available at
http://ec2.amazonaws.com/doc/2008-02-01/AmazonEC2.wsdl
Request Authentication
The Amazon EC2 web service complies with the current WS-Security standard, requiring SOAP request
messages to be hashed and signed for integrity and non-repudiation. WS-Security defines profiles which
are used to implement various levels of security. Amazon EC2 secure SOAP messages use the
BinarySecurityToken profile, consisting of an X.509 certificate with an RSA public key.
To secure the request, we add the BinarySecurityToken element. The Java libraries we supply rely on
the Apache Axis project for XML security, canonicalization, and SOAP support. The Sun Java Web
Service Developer's Pack supplies libraries of equivalent functionality.
<SOAP-ENV:Envelope xm
lns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsse:Security xm
lns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
secext-1.0.xsd">
<wsse:BinarySecurityToken
xm
lns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-u
tility-1.0.xsd"
Encoding
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-se
curity-1.0#Base64Binary"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token
-profile-1.0#X509v3"
wsu:Id="CertId-1064304">....many, many lines of base64 encoded
X.509 certificate...</wsse:BinarySecurityToken>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Al
gorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod
>
<ds:SignatureMethod Al
gorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
<ds:Reference URI="#id-17984263">
<ds:Transforms>
<ds:Transform Al
gorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Al
gorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
<ds:DigestValue>0pjZ1+TvgPf6uG7o+Yp3l2YdGZ4=</ds:DigestValue>
</ds:Reference>
<ds:Reference URI="#id-15778003">
<ds:Transforms>
<ds:Transform Al
gorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Al
gorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
<ds:DigestValue>HhRbxBBmc2OO348f8nLNZyo4AOM=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>bmVx24Qom4kd9QQtclxWIlgLk4QsQBPaKESi79x479xgbO9PEStXMiHZuB
Ai9luuKdNTcfQ8UE/d
jjHKZKEQR
COlLVy0Dn5ZL1RlMHsv+OzJzzvIJFTq3LQKNrzJzsNe</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-17007273">
<wsse:SecurityTokenReference
xm
lns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-u
tility-1.0.xsd" wsu:Id="STRId-22438818">
<wsse:Reference URI="#CertId-1064304"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token
-profile-1.0#X509v3">
</wsse:Reference>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
<wsu:Timestamp
xm
lns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-u
tility-1.0.xsd" wsu:Id="id-17984263">
<wsu:Created>2006-06-09T10:57:35Z</wsu:Created>
<wsu:Expires>2006-06-09T11:02:35Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</SOAP-ENV:Header>
If you are matching this against requests generated by Amazon EC2 supplied libraries, or those of
another vendor, the following are the most important elements:
Elements
an XML schema defined as part of the Amazon EC2 WSDL. The structure of a 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 instancesSet for instances. Item elements are
children of containers and their contents vary according to the container's role.
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<reservationId>r-47a5402e</reservationId>
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
<groupSet>
<item>
<groupId>default</groupId>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-2ba64342</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<dnsName></dnsName>
</item>
<item>
<instanceId>i-2bc64242</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<dnsName>ec2-67-202-51-176.compute-1.amazonaws.com </dnsName>
</item>
<item>
<instanceId>i-2be64332</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<dnsName>ec2-67-202-51-122.compute-1.amazonaws.com</dnsName>
<keyName>example-key-name</keyName>
<instanceType>m1.small</instanceType>
<launchTime>2007-08-07T11:54:42.000Z</launchTime>
</item>
</instancesSet>
</RunInstancesResponse>
• Query Parameters
HTTP Query-based requests are HTTP requests that use the HTTP verb GET or POST and a Query
parameter named Action or Operation. Action is used throughout this documentation, although
Operation is supported for backward compatibility with other AWS Query APIs.
Query Parameters
Each Query request must include some common parameters to handle authentication and selection of an
action. For more information, see Common Query Parameters.
Some operations take lists of parameters. These lists are specified using the param.n notation. Values
of n are integers starting from 1.
The following are the basic steps used to authenticate requests to AWS. This assumes the developer is
registered with AWS and has an Access Key ID and Secret Access Key.
Query Authentication
Note
If a request contains a Timestamp parameter, the signature calculated for the request
expires 15 minutes its value. If a request contains an Expires parameter, the signature
expires at the time specified by the Expires parameter.
2. Compute an RFC 2104 compliant HMAC using the Secret AWS Access Key as the "key".
3. Convert the value to base64.
4. Include the value as the value of the Signature parameter in the request.
For the above Query string, you would calculate the HMAC signature over the following string:
ActionDescribeImagesAWSAccessKey
Id10QMXFEV71ZS32XQFTR2SignatureVersion1Timestamp2006-12-08T07:48:03ZVersion20
07-01-03
Using the string above and the secret key DMADSSfPfdaDjbK+RRUhS/aDrjsiZadgAUm8gRU2 the
base64 encoded signature is as follows:
GjH3941IBe6qsgQu+k7FpCJjpnc=
The following is a Java code sample to compute the signature from the string and the private key.
import java.security.SignatureException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class HmacExample
{
private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1";
/**
* Computes RFC 2104-compliant HMAC signature.
*
* @param data
* The data to be signed.
* @param key
* The signing key.
* @return
* The base64-encoded RFC 2104-compliant HMAC signature.
* @throws
* java.security.SignatureException when signature generation fails
*/
public static String calculateRFC2104HMAC(String data, String key)
throws java.security.SignatureException
{
String result;
try {
// get an hmac_sha1 key from the raw key bytes
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(),
HMAC_SHA1_ALGORITHM);
Note
You must import a base 64 encoder to perform the last step above.
Example Request
Here is a complete example request, including all required parameters:
?AWSAccessKeyId=10QMXFEV71ZS32XQFTR2&Action=DescribeImages&SignatureVersion=1
&Timestamp=2006-12-08T07%3A48%3A03Z&Version=2007-01-03&Signature=69DSJs1z%2B0
wWJmdB77%2BLm0N0Trs%3D
API Reference
Topics
• API Conventions
• API Versioning
• API Error Codes
• Common Data Types
• Amazon EC2 SOAP API
• Amazon EC2 Query API
Amazon EC2 provides two APIs: Using the SOAP API and Using the Query API, which allow you to
launch and control instances from your own applications.
This section discusses the operations available in the Amazon EC2 APIs, their semantics, and their
required parameters. Examples of requests and responses are also provided.
Note
The same XML body is returned in both the Query API and SOAP API.
Before using the API, we recommend that you familiarize yourself with their API Conventions.
API Conventions
Overview
This section describes Amazon EC2 API conventions.
Actions
Actions encapsulate the possible interactions with Amazon EC2. These can be viewed as remote
procedure calls and consist of a request and response message pair. Requests must be signed, allowing
Amazon EC2 to Request Authentication. For clarity, the sample requests and responses illustrating each
of the operations described in this reference are not signed.
Values provided as parameters to the various operations must be of the indicated type. Standard XSD
types (like string, boolean, int) are prefixed with xsd:. Complex types defined by the
Amazon EC2 WSDL are prefixed with ec2:.
Parameters that consist of lists of information are defined within our WSDL to require <info> tags
around each member. Throughout the API, type references for parameters that accept such a list of
values are specified using the notation type[] The type referred to in these instances is the type nested
within the <info> tag (for Amazon EC2 types this is defined in the WSDL).
For example, the <imagesSet> element in the following XML snippet is of type xsd:string[]:
<imagesSet>
<item>
<imageId>ami-61a54008</imageId>
</item>
<item>
<imageId>ami-61b54608</imageId>
</item>
</imagesSet>
And the <instancesSet> element in the following XML snippet is of type xsd:string[]:
<instancesSet>
<item>
<imageId>ami-60a54009</imageId>
<minCount>10</minCount>
<maxCount>30</maxCount>
</item>
<item>
<imageId>ami-60b54209</imageId>
<minCount>5</minCount>
<maxCount>20</maxCount>
</item>
</instancesSet>
API Versioning
Because features and changes can introduce incompatible API changes, all Amazon EC2 API updates
are versioned. By including a version in the request, clients receive responses they can process.
Each API revision is assigned a version in date form (the current API version is 2008-02-01). This
version is included in the request as part of the document namespace when using our SOAP API and as
a Version parameter when using our Query API. The response that Amazon EC2 returns honors the
version included in the request.
SOAP clients that retrieve the Amazon EC2 WSDL at runtime and generate their requests dynamically
using that WSDL should reference the WSDL for the version of the API that the client was developed
against. This ensures that the client software continues to work even if backwards incompatible API
changes are introduced. The WSDL for each supported API version is available from the following URI:
http://ec2.amazonaws.com/doc/<api-version>/AmazonEC2.wsdl
The WSDL for latest version of our API is available from the following URI:
http://ec2.amazonaws.com/doc/AmazonEC2.wsdl
Note
The WSDL should be treated as a moving target as it will always map to the latest release
of the Amazon EC2 SOAP API. If your software depends on retrieving the WSDL at
runtime, we strongly recommend you reference the specific version of the WSDL you are
developing against.
Client error codes suggest that the error was caused by something the client did, such as an
authentication failure or an invalid AMI identifier. In the SOAP API, These error codes are prefixed
with Client. For example: Client.AuthFailure. In the Query API, these errors are accompanied
by a 400-series HTTP response code.
Server error codes suggest a server-side issue caused the error and should be reported. In the SOAP API,
these error codes are prefixed with Server. For example: Server.Unavailable. In the Query API,
these errors are accompanied by a 500-series HTTP response code.
Since both the Query and SOAP APIs return the same XML body, the data types described in the
WSDL are used in both.
AvailabilityZoneItemType
The AvailabilityZoneItemType data type.
Relevant Operations
Operations that use this data type include:
• DescribeAvailabilityZones
Contents
The following table describes the elements contained in AvailabilityZoneItemType.
Name Description
zoneName Name of the Availability Zone.
Type: xsd:string
BlockDeviceMappingItemType
The BlockDeviceMappingItemType data type.
Relevant Operations
Operations that use this data type include:
• DescribeImageAttribute
• RunInstances
Contents
The following table describes the elements contained in BlockDeviceMappingItemType.
Name Description
virtualName Virtual name assigned to the device.
Type: xsd:string
DescribeImagesResponseItemType
The DescribeImagesResponseItemType data type.
Relevant Operations
Operations that use this data type include:
• DescribeImages
Contents
The following table describes the elements contained in DescribeImagesResponseItemType.
Name Description
imageId Unique ID of the AMI described.
Type: xsd:string
Name Description
DescribeKeyPairsResponseItemType
The DescribeKeyPairsResponseItemType data type.
Relevant Operations
Operations that use this data type include:
• DeleteKeyPair
• DescribeKeyPairs
Contents
The following table describes the elements contained in DescribeKeyPairsResponseItemType.
Name Description
keyName The user supplied name for this key pair.
Type: xsd:string
keyFingerprint A fingerprint for the private key of this key pair. This is
computed as the SHA-1 digest of the DER encoded form of
the private key.
Type: xsd:string
EmptyElementType
The EmptyElementType data type.
Relevant Operations
Operations that use this data type include:
• ResetImageAttribute
• DescribeImageAttribute
Contents
API Version 2008-02-01
75
Amazon Elastic Compute Cloud Developer Guide
GroupSetType
GroupSetType
The GroupSetType data type.
Relevant Operations
Operations that use this data type include:
• RunInstances
Contents
The following table describes the elements contained in GroupSetType.
Name Description
groupId Name of a security group.
Type: xsd:string
InstanceStateType
The InstanceStateTypedata type.
Relevant Operations
Operations that use this data type include:
• RunInstances
• DescribeInstances
• TerminateInstances
Contents
The following table describes the elements contained in InstanceStateType.
Name Description
code A 16-bit unsigned integer. The high byte is an opaque
internal value and should be ignored. The low byte is set
based on the state represented:
• 0: pending
• 16: running
• 32: shutting-down
• 48: terminated
Type: xsd:int
Name Description
Type: xsd:string
IpPermissionType
The IpPermissionType data type.
Relevant Operations
Operations that use this data type include:
• AuthorizeSecurityGroupIngress
• DescribeSecurityGroups
• RevokeSecurityGroupIngress
Contents
The following table describes the elements contained in IpPermissionType.
Name Description
ipProtocol IP protocol.
Type: xsd:string
fromPort Start of port range for the TCP and UDP protocols, or an
ICMP type number. An ICMP type number of -1 indicates a
wildcard (i.e., any ICMP type number).
Type: xsd:int
toPort End of port range for the TCP and UDP protocols, or an
ICMP code. An ICMP code of -1 indicates a wildcard (i.e.,
any ICMP code).
Type: xsd:int
LaunchPermissionItemType
The LaunchPermissionItemType data type.
Relevant Operations
Operations that use this data type include:
• ModifyImageAttribute
• DescribeImageAttribute
Contents
The following table describes the elements contained in LaunchPermissionItemType.
userId A launch permission for a user. userId is Choice between group and
an AWS account ID. userId
Type: xsd:string
LaunchPermissionOperationType
The LaunchPermissionOperationType data type.
Relevant Operations
Operations that use this data type include:
• ModifyImageAttribute
Contents
The following table describes the elements contained in LaunchPermissionOperationType.
PlacementRequestType
The PlacementRequestType data type.
Relevant Operations
Operations that use this data type include:
• RunInstances
Contents
The following table describes the elements contained in PlacementRequestType.
Name Description
availabilityZone The availability zone in which to launch the instance(s).
Type: xsd:string
PlacementResponseType
The PlacementResponseType data type.
Relevant Operations
Operations that use this data type include:
• DescribeInstances
Contents
The following table describes the elements contained in PlacementResponseType.
Name Description
availabilityZone The availability zone in which to launch the instance(s).
Type: xsd:string
ProductCodeItemType
The ProductCodeItemType data type.
Relevant Operations
Operations that use this data type include:
• ModifyImageAttribute
• DescribeImageAttribute
Contents
The following table describes the elements contained in ProductCodeItemType.
ProductInstanceResponseItemType
The ProductInstanceResponseItemType data type.
Relevant Operations
Operations that use this data type include:
• ConfirmProductInstance
Contents
The following table describes the elements contained in ProductInstanceResponseItemType.
Name Description
productCode The product code attached to the instance that matches one
of the product codes in the ConfirmProductInstance request.
Type: xsd:string
ReservationInfoType
The ReservationInfoType data type.
Relevant Operations
Operations that use this data type include:
• RunInstances
• DescribeInstances
Contents
Name Description
reservationId Unique ID of the reservation described.
Type: xsd:string
ownerId AWS Access Key ID of the user who owns the reservation.
Type: xsd:string
RunningInstancesItemType
The RunningInstancesItemType data type.
Relevant Operations
Operations that use this data type include:
• RunInstances
• DescribeInstances
Contents
The following table describes the elements contained in RunningInstancesItemType.
Name Description
amiLaunchIndex Optional. The AMI launch index, which can be used to find
this instance within the launch group. For more information,
see Instance Metadata.
Type: xsd:string
dnsName The public DNS name assigned to the instance. This DNS
name is contactable from outside the Amazon EC2 network.
This element remains empty until the instance enters a
running state. For more information, see Instance
Addressing and Network Security.
Type: xsd:string
Name Description
instanceState The current state of the instance.
Type: InstanceStateType
privateDnsName The private DNS name assigned to the instance. This DNS
name can only be used inside the Amazon EC2 network.
This element remains empty until the instance enters a
running state. For more information, see Instance
Addressing and Network Security.
Type: xsd:string
reason Optional. Reason for the most recent state transition. This
might be an empty string.
Type: xsd:string
SecurityGroupItemType
The SecurityGroupItemType data type.
Relevant Operations
Operations that use this data type include:
• DescribeSecurityGroups
Contents
The following table describes the elements contained in SecurityGroupItemType.
Name Description
ownerId AWS Access Key ID of the owner of the security group.
Type: xsd:string
TerminateInstancesResponseInfoType
The TerminateInstancesResponseInfoType data type.
Relevant Operations
Operations that use this data type include:
• TerminateInstances
Contents
The following table describes the elements contained in TerminateInstancesResponseInfoType.
Name Description
instanceId Instance ID returned from previous call to RunInstances
Type: xsd:string
UserDataType
The UserDataType data type.
Relevant Operations
Operations that use this data type include:
• RunInstances
Contents
API Version 2008-02-01
83
Amazon Elastic Compute Cloud Developer Guide
UserIdGroupPairType
Name Description
data The user data.
Type: xsd:string
Notes
UserIdGroupPairType
The UserIdGroupPairType data type.
Relevant Operations
Operations that use this data type include:
• AuthorizeSecurityGroupIngress
• DescribeSecurityGroups
• RevokeSecurityGroupIngress
Contents
The following table describes the elements contained in UserIdGroupPairType.
Name Description
userId AWS Access Key ID of a user.
Type: xsd:string
• RegisterImage
• DescribeImages
• DeregisterImage
Instances
• RunInstances
• DescribeInstances
• TerminateInstances
• ConfirmProductInstance
Key Pairs
• CreateKeyPair
• DescribeKeyPairs
• DeleteKeyPair
Image Attributes
• ModifyImageAttribute
• DescribeImageAttribute
• ResetImageAttribute
Security Groups
• CreateSecurityGroup
• DescribeSecurityGroups
• DeleteSecurityGroup
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
Elastic IP Addresses
• AllocateAddress
• DescribeAddresses
• ReleaseAddress
• AssociateAddress
• DisassociateAddress
Availability Zones
• DescribeAvailabilityZones
AllocateAddress
The AllocateAddress operation acquires an elastic IP address for use with your account.
Request Parameters
The AllocateAddress operation does not have any request parameters.
Response Elements
The following table describes the default response tags included in AllocateAddress responses.
Name Description
publicIp Returned IP address.
Type: xsd:string
Sample Request
<AllocateAddress/>
Sample Response
<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01/">
<publicIp>67.202.55.255</publicIp>
</AllocateAddressResponse>
Related Operations
• DescribeAddresses
• ReleaseAddress
• AssociateAddress
• DisassociateAddress
AssociateAddress
The AssociateAddress operation associates an elastic IP address with an instance. If the IP address is
currently assigned to another instance, the IP address is assigned to the new instance. This is an
idempotent operation. If you enter it more than once, Amazon EC2 does not return an error.
Request Parameters
The following table describes the request parameters for AssociateAddress. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in AssociateAddress responses.
Name Description
return true if the IP address is associated with the instance. Otherwise,
false.
Type: xsd:boolean
Sample Request
<AssociateAddress xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instanceId>i-28a64341</instanceId>
<publicIp>67.202.55.255</publicIp>
</AssociateAddress>
Sample Response
<AssociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</AssociateAddressResponse>
Related Operations
• AllocateAddress
• DescribeAddresses
• ReleaseAddress
• DisassociateAddress
AuthorizeSecurityGroupIngress
The AuthorizeSecurityGroupIngress operation adds permissions to a security group.
Permissions are specified by the IP protocol (TCP, UDP or ICMP), the source of the request (by IP
range or an Amazon EC2 user-group pair), the source and destination port ranges (for TCP and UDP),
and the ICMP codes and types (for ICMP).
Permission changes are propagated to instances within the security group as quickly as possible.
Request Parameters
The following table describes the request parameters for AuthorizeSecurityGroupIngress.
Parameter names are case sensitive.
Response Elements
The following table describes the default response tags included in
AuthorizeSecurityGroupIngress responses.
Name Description
return true if permissions successfully added.
Type: xsd:boolean
Sample Request
<AuthorizeSecurityGroupIngress xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<userId/>
<groupName>WebServers</groupName>
<ipPermissions>
<item>
<ipProtocol>tcp</ipProtocol>
<fromPort>80</fromPort>
<toPort>80</toPort>
<groups/>
<ipRanges>
<item>
<cidrIp>0.0.0.0/0</cidrIp>
</item>
</ipRanges>
</item>
</ipPermissions>
</AuthorizeSecurityGroupIngress>
Sample Response
<AuthorizeSecurityGroupIngressResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</AuthorizeSecurityGroupIngressResponse>
Related Operations
• CreateSecurityGroup
• DescribeSecurityGroups
• RevokeSecurityGroupIngress
• DeleteSecurityGroup
ConfirmProductInstance
The ConfirmProductInstance operation returns true if the specified product code is attached to the
specified instance. The operation returns false if the product code is not attached to the instance.
The ConfirmProductInstance operation can only be executed by the owner of the AMI. This feature
is useful when an AMI owner is providing support and wants to verify whether a user's instance is
eligible.
Request Parameters
The following table describes the request parameters for ConfirmProductInstance. Parameter
names are case sensitive.
instanceId The instance for which to confirm the product code. Yes
Type: xsd:string
Response Elements
The following table describes the default response tags included in ConfirmProductInstance
responses.
Name Description
return True if the product code is attached to the instance, false if it is not.
Type: xsd:boolean
ownerId The instance owner's account ID. Only present if the product code
is attached to the instance.
Type: xsd:string
Sample Request
<ConfirmProductInstance
xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<productCode>774F4FF8</productCode>
<instanceId>i-10a64379</instanceId>
</ConfirmProductInstance>
Sample Response
<ConfirmProductInstanceResponse
xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
<ownerId>254933287430</ownerId>
</ConfirmProductInstanceResponse>
Related Operations
• DescribeInstances
• RunInstances
CreateKeyPair
The CreateKeyPair operation creates a new 2048 bit RSA key pair and returns a unique ID that can
be used to reference this key pair when launching new instances. For more information, see
RunInstances.
Request Parameters
The following table describes the request parameters for CreateKeyPair. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in CreateKeyPair responses.
Name Description
keyName The key pair name provided in the original request.
Type: xsd:string
Sample Request
<CreateKeyPair xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<keyName>example-key-name</keyName>
</CreateKeyPair>
Sample Response
<CreateKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<keyName>example-key-name</keyName>
<keyFingerprint>1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f</
keyFingerprint>
<keyMaterial>-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQBuLFg5ujHrtm1jnutSuoO8Xe56LlT+HM8v/xkaa39EstM3/aFxTHgElQiJLChp
HungXQ29VTc8rc1bW0lkdi23OH5eqkMHGhvEwqa0HWASUMll4o3o/IX+0f2UcPoKCOVUR+jx71Sg
5AU52EQfanIn3ZQ8lFW7Edp5a3q4DhjGlUKToHVbicL5E+g45zfB95wIyywWZfeW/UUF3LpGZyq/
ebIUlq1qTbHkLbCC2r7RTn8vpQWp47BGVYGtGSBMpTRP5hnbzzuqj3itkiLHjU39S2sJCJ0TrJx5
i8BygR4s3mHKBj8l+ePQxG1kGbF6R4yg6sECmXn17MRQVXODNHZbAgMBAAECggEAY1tsiUsIwDl5
91CXirkYGuVfLyLflXenxfI50mDFms/mumTqloHO7tr0oriHDR5K7wMcY/YY5YkcXNo7mvUVD1pM
ZNUJs7rw9gZRTrf7LylaJ58kOcyajw8TsC4e4LPbFaHwS1d6K8rXh64o6WgW4SrsB6ICmr1kGQI7
3wcfgt5ecIu4TZf0OE9IHjn+2eRlsrjBdeORi7KiUNC/pAG23I6MdDOFEQRcCSigCj+4/mciFUSA
SWS4dMbrpb9FNSIcf9dcLxVM7/6KxgJNfZc9XWzUw77Jg8x92Zd0fVhHOux5IZC+UvSKWB4dyfcI
tE8C3p9bbU9VGyY5vLCAiIb4qQKBgQDLiO24GXrIkswF32YtBBMuVgLGCwU9h9HlO9mKAc2m8Cm1
jUE5IpzRjTedc9I2qiIMUTwtgnw42auSCzbUeYMURPtDqyQ7p6AjMujp9EPemcSVOK9vXYL0Ptco
xW9MC0dtV6iPkCN7gOqiZXPRKaFbWADp16p8UAIvS/a5XXk5jwKBgQCKkpHi2EISh1uRkhxljyWC
iDCiK6JBRsMvpLbc0v5dKwP5alo1fmdR5PJaV2qvZSj5CYNpMAy1/EDNTY5OSIJU+0KFmQbyhsbm
rdLNLDL4+TcnT7c62/aH01ohYaf/VCbRhtLlBfqGoQc7+sAc8vmKkesnF7CqCEKDyF/dhrxYdQKB
gC0iZzzNAapayz1+JcVTwwEid6j9JqNXbBc+Z2YwMi+T0Fv/P/hwkX/ypeOXnIUcw0Ih/YtGBVAC
DQbsz7LcY1HqXiHKYNWNvXgwwO+oiChjxvEkSdsTTIfnK4VSCvU9BxDbQHjdiNDJbL6oar92UN7V
rBYvChJZF7LvUH4YmVpHAoGAbZ2X7XvoeEO+uZ58/BGKOIGHByHBDiXtzMhdJr15HTYjxK7OgTZm
gK+8zp4L9IbvLGDMJO8vft32XPEWuvI8twCzFH+CsWLQADZMZKSsBasOZ/h1FwhdMgCMcY+Qlzd4
JZKjTSu3i7vhvx6RzdSedXEMNTZWN4qlIx3kR5aHcukCgYA9T+Zrvm1F0seQPbLknn7EqhXIjBaT
P8TTvW/6bdPi23ExzxZn7KOdrfclYRph1LHMpAONv/x2xALIf91UB+v5ohy1oDoasL0gij1houRe
2ERKKdwz0ZL9SWq6VTdhr/5G994CK72fy5WhyERbDjUIdHaK3M849JJuf8cSrvSb4g==
-----END RSA PRIVATE KEY-----</keyMaterial>
</CreateKeyPairResponse>
Related Operations
• DescribeKeyPairs
• DeleteKeyPair
• RunInstances
CreateSecurityGroup
The CreateSecurityGroup operation creates a new security group.
Every instance is launched in a security group. If no security group is specified during launch, the
instances are launched in the default security group. Instances within the same security group have
unrestricted network access to each other. Instances will reject network access attempts from other
instances in a different security group. As the owner of instances you can grant or revoke specific
permissions using the AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress operations.
Request Parameters
The following table describes the request parameters for CreateSecurityGroup. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in CreateSecurityGroup responses.
Name Description
return true if call succeeded.
Type: xsd:boolean
Sample Request
<CreateSecurityGroup xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<groupName>WebServers</groupName>
<groupDescription>Web</groupDescription>
</CreateSecurityGroup>
Sample Response
<CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</CreateSecurityGroupResponse>
Related Operations
• RunInstances
• DescribeSecurityGroups
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
• DeleteSecurityGroup
DeleteKeyPair
The DeleteKeyPair operation deletes a key pair.
Request Parameters
The following table describes the request parameters for DeleteKeyPair. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in DeleteKeyPair responses.
Name Description
return true if the key was successfully deleted.
Type: xsd:boolean
Sample Request
<DeleteKeyPair xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<keyName>example-key-name</keyName>
</DeleteKeyPair>
Sample Response
<DeleteKeyPair xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DeleteKeyPair>
Related Operations
• CreateKeyPair
• DescribeKeyPairs
DeleteSecurityGroup
The DeleteSecurityGroup operation deletes a security group.
Note
If you attempt to delete a security group that contains instances, a fault is returned.
If you attempt to delete a security group that is referenced by another security group, a
fault is returned. For example, if security group B has a rule that allows access from
security group A, security group A cannot be deleted until the allow rule is removed.
Request Parameters
The following table describes the request parameters for DeleteSecurityGroup. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DeleteSecurityGroup responses.
Name Description
return true if the group is deleted. Otherwise, false.
Type: xsd:boolean
Sample Request
<DeleteSecurityGroup xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<groupName>RangedPortsBySource</groupName>
</DeleteSecurityGroup>
Sample Response
<DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DeleteSecurityGroupResponse>
Related Operations
• CreateSecurityGroup
• DescribeSecurityGroups
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
DeregisterImage
The DeregisterImage operation deregisters an AMI. Once deregistered, instances of the AMI can no
longer be launched.
Request Parameters
The following table describes the request parameters for DeregisterImage. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in DeregisterImage responses.
Name Description
return true if deregistration succeeded; otherwise false.
Type: xsd:boolean
Sample Request
<DeregisterImage xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<imageId>ami-61a54008</imageId>
</DeregisterImage>
Sample Response
<DeregisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DeregisterImageResponse>
Related Operations
• RegisterImage
• DescribeImages
DescribeAddresses
The DescribeAddresses operation lists elastic IP addresses assigned to your account.
Request Parameters
The following table describes the request parameters for DescribeAddresses. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DescribeAddresses responses.
Name Description
publicIp Elastic IP address assigned to your account.
Type: xsd:string
Sample Request
<DescribeAddresses xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<publicIpsSet>
<item>
<publicIp>67.202.55.255</publicIp>
</item>
</publicIpsSet>
</DescribeAddresses>
Sample Response
<DescribeAddressesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instanceId>i-28a64341</instanceId>
<publicIp>67.202.55.255</publicIp>
</DescribeAddressesResponse>
Related Operations
• AllocateAddress
• ReleaseAddress
• AssociateAddress
• DisassociateAddress
DescribeAvailabilityZones
The DescribeAvailabilityZones operation displays availability zones that are currently available
to the account and their states.
Note
Availability zones are not the same across accounts. The availability zone us-east-1a for
account A is not necessarily the same as us-east-1a for account B. Zone assignments are
mapped independently for each account.
Request Parameters
The following table describes the request parameters for DescribeAvailabilityZones. Parameter
names are case sensitive.
Response Elements
The following table describes the default response tags included in DescribeAvailabilityZones
responses.
Name Description
availabilityZoneInfo Availability zone information.
Type: AvailabilityZoneItemType[]
Sample Request
<DescribeAvailabilityZones
xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<availabilityZoneSet/>
<DescribeAvailabilityZones>
Sample Response
<DescribeAvailabilityZonesResponse
xmlns="http://ec2.amazonaws.com/doc/2008-02-01/">
<availabilityZoneInfo>
<item>
<zoneName>us-east-1a</zoneName>
<zoneState>available</zoneState>
</item>
<item>
<zoneName>us-east-1b</zoneName>
<zoneState>available</zoneState>
</item>
<item>
<zoneName>us-east-1c</zoneName>
<zoneState>available</zoneState>
</item>
</availabilityZoneInfo>
</DescribeAvailabilityZonesResponse>
Related Operations
• RunInstances
DescribeImageAttribute
The DescribeImageAttribute operation returns information about an attribute of an AMI. Only one
attribute can be specified per call.
Request Parameters
The following table describes the request parameters for DescribeImageAttribute. Parameter
names are case sensitive.
productCodes Describes the product code associated with the AMI. Choice
Type: EmptyElementType
Response Elements
The following table describes the default response tags included in DescribeImageAttribute
responses.
Name Description
imageId ID of the AMI of which parameters are described.
Type: xsd:string
ramdisk ID of the RAM disk associated with the AMI. Returned if ramdisk
is specified.
Type: xsd:string
blockDeviceMapping Mapping that defines native device names to use when exposing
virtual devices. Returned if blockDeviceMapping is specified.
Name Description
Type: BlockDeviceMappingItemType[]
Related Operations
• DescribeImages
• ModifyImageAttribute
• ResetImageAttribute
DescribeImages
The DescribeImages operation returns information about AMIs available to the user. This includes
public AMIs available for any user to launch, private AMIs owned by the user making the request, and
private AMIs owned by other users for which the user has explicit launch permissions.
Launch Description
Permission
public The owner of the AMI granted launch permissions for the AMI to the all group.
All users have launch permissions for these AMIs.
explicit The owner of the AMI granted launch permissions to a specific user.
implicit A user has implicit launch permissions for all AMIs he or she owns.
The list of AMIs returned can be modified by specifying AMI IDs, AMI owners, or users with launch
permissions. If no options are specified, Amazon EC2 returns all AMIs for which the user has launch
permissions.
If you specify one or more AMI IDs, only AMIs that have the specified IDs are returned. If you specify
an invalid AMI ID, a fault is returned. If you specify an AMI ID for which you do not have access, it
will not be included in the returned results.
If you specify one or more AMI owners, only AMIs from the specified owners and for which you have
access are returned. The results can include the account IDs of the specified owners, amazon for AMIs
owned by Amazon or self for AMIs that you own.
If you specify a list of executable users, only users that have launch permissions for the AMIs are
returned. You can specify account IDs (if you own the AMI(s)), self for AMIs for which you own or
have explicit permissions, or all for public AMIs.
Note
Deregistered images are included in the returned results for an unspecified interval after
deregistration.
If you use the DescribeImages operation on machine images, it displays the kernel IDs and RAM disk
IDs associated with the images. If you specify a kernel or RAM disk ImageType, it displays
information about kernel or RAM disk images.
Request Parameters
The following table describes the request parameters for DescribeImages. Parameter names are case
sensitive.
executableBySet AMIs for which specified users have access Yes (but can
Type: xsd:string[] be empty)
imageType Specify whether to return kernel or ramdisk images. Yes (but can
Type: xsd:string[] be empty)
Response Elements
The following table describes the default response tags included in DescribeImages responses.
Name Description
imagesSet A list of image descriptions
Type: DescribeImagesResponseItemType[]
Sample Request
<DescribeImages xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<executableBySet>
<item>
<user>all</user>
</item>
</executableBySet>
<ownersSet />
<imagesSet>
<item>
<imageId>ami-be3adfd7</imageId>
</item>
</imagesSet>
</DescribeImages>
Sample Response
<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<imagesSet>
<item>
<imageId>ami-be3adfd7</imageId>
<imageLocation>ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml
</imageLocation>
<imageState>available</imageState>
<imageOwnerId>206029621532</imageOwnerId>
<isPublic>false</isPublic>
<architecture>i386</architecture>
<imageType>machine</imageType>
<kernelId>aki-4438dd2d</kernelId>
<ramdiskId>ari-4538dd2c</ramdiskId>
</item>
</imagesSet>
</DescribeImagesResponse>
Related Operations
• DescribeInstances
• DescribeImageAttribute
DescribeInstances
The DescribeInstances operation returns information about instances that you own.
If you specify one or more instance IDs, Amazon EC2 returns information for those instances. If you do
not specify instance IDs, Amazon EC2 returns information for all relevant instances. If you specify an
invalid instance ID, a fault is returned. If you specify an instance that you do not own, it will not be
included in the returned results.
Recently terminated instances might appear in the returned results. This interval is usually less than one
hour.
Request Parameters
The following table describes the request parameters for DescribeInstances. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DescribeInstances responses.
Name Description
reservationSet A list of structures describing the status of all requested instances.
Type: ReservationInfoType[]
Sample Request
<DescribeInstances xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instancesSet>
<item>
<instanceId>i-28a64341</instanceId>
</item>
</instancesSet>
</DescribeInstances>
Sample Response
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<reservationSet>
<item>
<reservationId>r-44a5402d</reservationId>
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
<groupSet>
<item>
<groupId>default</groupId>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-28a64341</instanceId>
<imageId>ami-6ea54007</imageId>
<instanceState>
<code>0</code>
<name>running</name>
</instanceState>
<privateDnsName>10-251-50-132.ec2.internal</privateDnsName>
<dnsName>ec2-72-44-33-4.compute-1.amazonaws.com</dnsName>
<keyName>example-key-name</keyName>
<amiLaunchIndex>23</amiLaunchIndex>
<productCodesSet>
<item><productCode>774F4FF8</productCode></item>
</productCodesSet>
<instanceType>m1.large</instanceType>
<launchTime>2007-08-07T11:54:42.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
<kernelId>aki-ba3adfd3</kernelId>
<ramdiskId>ari-badbad00</ramdiskId>
</item>
</instancesSet>
</item>
</reservationSet>
</DescribeInstancesResponse>
Related Operations
• RunInstances
• TerminateInstances
DescribeKeyPairs
The DescribeKeyPairs operation returns information about key pairs available to you. If you specify
key pairs, information about those key pairs is returned. Otherwise, information for all registered key
pairs is returned.
Request Parameters
The following table describes the request parameters for DescribeKeyPairs. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DescribeKeyPairs responses.
Name Description
keySet A list of key pair descriptions
Type: DescribeKeyPairsResponseItemType[]
Sample Request
<DescribeKeyPairs xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<keySet>
<item>
<keyName>example-key-name</keyName>
</item>
</keySet>
</DescribeKeyPairs>
Sample Response
<DescribeKeyPairsResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<keySet>
<item>
<keyName>example-key-name</keyName>
<keyFingerprint>1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f</
keyFingerprint>
</item>
</keySet>
</DescribeKeyPairsResponse>
Related Operations
• CreateKeyPair
• DeleteKeyPair
• RunInstances
DescribeSecurityGroups
The DescribeSecurityGroups operation returns information about security groups that you own.
If you specify security group names, information about those security group is returned. Otherwise,
information for all security group is returned. If you specify a group that does not exist, a fault is
returned.
Request Parameters
The following table describes the request parameters for DescribeSecurityGroups. Parameter
names are case sensitive.
Response Elements
The following table describes the default response tags included in DescribeSecurityGroups
responses.
Name Description
securityGroupInfo Information about security groups.
Type: SecurityGroupItemType[]
Sample Request
<DescribeSecurityGroups xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<securityGroupSet>
<item>
<groupName>WebServers</groupName>
</item>
<item>
<groupName>RangedPortsBySource</groupName>
</item>
</securityGroupSet>
</DescribeSecurityGroups>
Sample Response
<DescribeSecurityGroupsResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<securityGroupInfo>
<item>
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
<groupName>WebServers</groupName>
<groupDescription>Web</groupDescription>
<ipPermissions>
<item>
<ipProtocol>tcp</ipProtocol>
<fromPort>80</fromPort>
<toPort>80</toPort>
<groups/>
<ipRanges>
<item>
<cidrIp>0.0.0.0/0</cidrIp>
</item>
</ipRanges>
</item>
</ipPermissions>
</item>
<item>
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
<groupName>RangedPortsBySource</groupName>
<groupDescription>A</groupDescription>
<ipPermissions>
<item>
<ipProtocol>tcp</ipProtocol>
<fromPort>6000</fromPort>
<toPort>7000</toPort>
<groups/>
<ipRanges/>
</item>
</ipPermissions>
</item>
</securityGroupInfo>
</DescribeSecurityGroupsResponse>
Related Operations
• CreateSecurityGroup
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
• DeleteSecurityGroup
DisassociateAddress
The DisassociateAddress operation disassociates the specified elastic IP address from the instance
to which it is assigned. This is an idempotent operation. If you enter it more than once, Amazon EC2
does not return an error.
Request Parameters
The following table describes the request parameters for DisassociateAddress. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DisassociateAddress responses.
Name Description
return true if the IP address is disassociated from the instance.
Otherwise, false.
Type: xsd:boolean
Sample Request
<DisassociateAddress xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<publicIp>67.202.55.255</publicIp>
</DisassociateAddress>
Sample Response
API Version 2008-02-01
106
Amazon Elastic Compute Cloud Developer Guide
GetConsoleOutput
<DisassociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DisassociateAddressResponse>
Related Operations
• AllocateAddress
• DescribeAddresses
• ReleaseAddress
• AssociateAddress
GetConsoleOutput
The GetConsoleOutput operation retrieves console output for the specified instance.
Instance console output is buffered and posted shortly after instance boot, reboot, and termination.
Amazon EC2 preserves the most recent 64 KB output which will be available for at least one hour after
the most recent post.
Request Parameters
The following table describes the request parameters for GetConsoleOutput. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in GetConsoleOutput responses.
Name Description
instanceId The instance ID.
Type: xsd:string
Sample Request
<GetConsoleOutput xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instanceId>i-28a64341</instanceId>
</GetConsoleOutput>
Sample Response
<GetConsoleOutputResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instanceId>i-28a64341</instanceId>
<timestamp>2007-01-03 15:00:00</timestamp>
<output>TGludXggdmVyc2lvbiAyLjYuMTYteGVuVSAoYnVpbGRlckBwYXRjaGJhdC5hbWF6b25zY
SkgKGdj
YyB2ZXJzaW9uIDQuMC4xIDIwMDUwNzI3IChSZWQgSGF0IDQuMC4xLTUpKSAjMSBTTVAgVGh1IE9j
dCAyNiAwODo0MToyNiBTQVNUIDIwMDYKQklPUy1wcm92aWRlZCBwaHlzaWNhbCBSQU0gbWFwOgpY
ZW46IDAwMDAwMDAwMDAwMDAwMDAgLSAwMDAwMDAwMDZhNDAwMDAwICh1c2FibGUpCjk4ME1CIEhJ
R0hNRU0gYXZhaWxhYmxlLgo3MjdNQiBMT1dNRU0gYXZhaWxhYmxlLgpOWCAoRXhlY3V0ZSBEaXNh
YmxlKSBwcm90ZWN0aW9uOiBhY3RpdmUKSVJRIGxvY2t1cCBkZXRlY3Rpb24gZGlzYWJsZWQKQnVp
bHQgMSB6b25lbGlzdHMKS2VybmVsIGNvbW1hbmQgbGluZTogcm9vdD0vZGV2L3NkYTEgcm8gNApF
bmFibGluZyBmYXN0IEZQVSBzYXZlIGFuZCByZXN0b3JlLi4uIGRvbmUuCg==</output>
</GetConsoleOutputResponse>
ModifyImageAttribute
The ModifyImageAttribute operation modifies an attribute of an AMI.
Request Parameters
The following table describes the request parameters for ModifyImageAttribute. Parameter names
are case sensitive.
Response Elements
The following table describes the default response tags included in ModifyImageAttribute
responses.
Name Description
return true if the operation succeeded, otherwise false.
Type: xsd:boolean
Sample Response
<ModifyImageAttributeResponse
xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</ModifyImageAttributeResponse>
Related Operations
• ResetImageAttribute
• DescribeImageAttribute
RebootInstances
The RebootInstances operation requests a reboot of one or more instances. This operation is
asynchronous; it only queues a request to reboot the specified instance(s). The operation will succeed if
the instances are valid and belong to the user. Requests to reboot terminated instances are ignored.
Request Parameters
The following table describes the request parameters for RebootInstances. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in RebootInstances responses.
Name Description
result true if the operation succeeded.
Type: xsd:boolean
Sample Request
<RebootInstances xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instancesSet>
<item>
<instanceId>i-28a64341</instanceId>
</item>
</instancesSet>
</RebootInstances>
Sample Response
<RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</RebootInstancesResponse>
RegisterImage
The RegisterImage operation registers an AMI with Amazon EC2. Images must be registered before
they can be launched. For more information, see RunInstances.
Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through the
RegisterImage operation. During registration, Amazon EC2 retrieves the specified image manifest
from Amazon S3 and verifies that the image is owned by the user registering the image.
The image manifest is retrieved once and stored within the Amazon EC2. Any modifications to an
image in Amazon S3 invalidates this registration. If you make changes to an image, deregister the
previous image and register the new image. For more information, see DeregisterImage.
Request Parameters
The following table describes the request parameters for RegisterImage. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in RegisterImage responses.
Name Description
imageId Unique ID of the newly registered machine image.
Type: xsd:string
Sample Request
<RegisterImage xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<imageLocation>/mybucket/myimage.manifest.xml</imageLocation>
</RegisterImage>
Sample Response
<RegisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<imageId>ami-61a54008</imageId>
</RegisterImageResponse>
Related Operations
• DescribeImages
• DeregisterImage
ReleaseAddress
The ReleaseAddress operation releases an elastic IP address associated with your account.
If you run this operation on an elastic IP address that is already released, the address might be assigned
to another account which will cause Amazon EC2 to return an error.
Note
Important
After releasing an elastic IP address, it is released to the IP address pool and might no
longer be available to your account. Make sure to update your DNS records and any
servers or devices that communicate with the address.
Request Parameters
The following table describes the request parameters for ReleaseAddress. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in ReleaseAddress responses.
Name Description
return true if the IP address is released. Otherwise, false.
Type: xsd:boolean
Sample Request
<ReleaseAddress xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<publicIp>67.202.55.255</publicIp>
</ReleaseAddress>
Sample Response
<ReleaseAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</ReleaseAddressResponse>
Related Operations
• AllocateAddress
• DescribeAddresses
• AssociateAddress
• DisassociateAddress
ResetImageAttribute
The ResetImageAttribute operation resets an attribute of an AMI to its default value.
Note
Request Parameters
The following table describes the request parameters for ResetImageAttribute. Parameter names are
case sensitive.
launchPermission Resets the AMI's launch permissions. All public and Yes
explicit launch permissions for the AMI are revoked.
Type: EmptyElementType
Response Elements
The following table describes the default response tags included in ResetImageAttribute responses.
Name Description
return true if the operation succeeded, otherwise false.
Type: xsd:boolean
Sample Request
<ResetImageAttribute xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<imageId>ami-61a54008</imageId>
<launchPermission />
</ResetImageAttribute>
Sample Response
<ResetImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</ResetImageAttributeResponse>
Related Operations
• ModifyImageAttribute
• DescribeImageAttribute
RevokeSecurityGroupIngress
The RevokeSecurityGroupIngress operation revokes permissions from a security group. The
permissions used to revoke must be specified using the same values used to grant the permissions.
Permissions are specified by IP protocol (TCP, UDP, or ICMP), the source of the request (by IP range or
an Amazon EC2 user-group pair), the source and destination port ranges (for TCP and UDP), and the
ICMP codes and types (for ICMP).
Permission changes are quickly propagated to instances within the security group. However, depending
on the number of instances in the group, a small delay is might occur, .
Request Parameters
The following table describes the request parameters for RevokeSecurityGroupIngress. Parameter
names are case sensitive.
Response Elements
The following table describes the default response tags included in RevokeSecurityGroupIngress
responses.
Name Description
return true if permissions successfully revoked.
Type: xsd:boolean
Sample Request
<RevokeSecurityGroupIngress xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<userId/>
<groupName>RangedPortsBySource</groupName>
<ipPermissions>
<item>
<ipProtocol>tcp</ipProtocol>
<fromPort>6000</fromPort>
<toPort>7000</toPort>
<groups/>
<ipRanges/>
</item>
</ipPermissions>
</RevokeSecurityGroupIngress>
Sample Response
<RevokeSecurityGroupIngressResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</RevokeSecurityGroupIngressResponse>
Related Operations
• CreateSecurityGroup
• DescribeSecurityGroups
• AuthorizeSecurityGroupIngress
• DeleteSecurityGroup
RunInstances
The RunInstances operation launches a specified number of instances.
If Amazon EC2 cannot launch the minimum number AMIs you request, no instances will be launched. If
there is insufficient capacity to launch the maximum number of AMIs you request, Amazon EC2
launches the minimum number specified for each AMI and allocate the remaining available instances
using round robin.
In the following example, Libby generates a request to launch two images (database and web_server):
1. Libby runs the RunInstances operation to launch database instances (min. 10, max. 15) and
web_server instances (min. 30, max. 40).
Because there are currently 30 instances available and Libby needs a minimum of 40, no instances
are launched.
2. Libby adjusts the number of instances she needs and runs the RunInstances operation to launch
database instances (min. 5, max. 10) and web_server instances (min. 20, max. 40).
Amazon EC2 launches the minimum number of instances for each AMI (5 database, 20 web_server).
Note
You can provide an optional key pair ID for each image in the launch request (see CreateKeyPair). All
instances that are created from images that use this key pair will have access to the associated public key
at boot. You can use this key to provide secure access to an instance of an image on a per-instance basis.
Amazon EC2 public images use this feature to provide secure access without passwords.
Important
Launching public images without a key pair ID will leave them inaccessible.
The public key material is made available to the instance at boot time by placing it in the
openssh_id.pub file on a logical device that is exposed to the instance as /dev/sda2 (the ephemeral
store). The format of this file is suitable for use as an entry within ~/.ssh/authorized_keys (the
OpenSSH format). This can be done at boot (e.g., as part of rc.local) allowing for secure access
without passwords.
Optional user data can be provided in the launch request. All instances comprising the launch request
have access to this data (see Instance Metadata for details).
Note
If any of the AMIs have a product code attached for which the user has not subscribed, the
RunInstances call will fail.
Request Parameters
The following table describes the request parameters for RunInstances. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in RunInstances responses.
Name Description
RunInstancesResponse Status information about the instances launched.
Type: ReservationInfoType
Sample Request
<RunInstances xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instancesSet>
<item>
<imageId>ami-60a54009</imageId>
<minCount>1</minCount>
<maxCount>3</maxCount>
<keyName>example-key-name</keyName>
<groupSet/>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
<kernelId>aki-ba3adfd3</kernelId>
<ramdiskId>ari-badbad00</ramdiskId>
<blockDeviceMapping>
<item>
<virtualName>ami</virtualName>
<deviceName>sda1<deviceName>
</item>
<item>
<virtualName>root</virtualName>
<deviceName>/dev/sda1</deviceName>
</item>
<item>
<virtualName>ephemeral0</virtualName>
<deviceName>sdb</deviceName>
</item>
<item>
<virtualName>ephemeral1</virtualName>
<deviceName>sdc</deviceName>
</item>
</blockDeviceMapping>
</item>
</instancesSet>
<userData version="1.0" encod
ing="base64"><data>"VGhpcyBpcyBiYXNlIDY0IQ==</data></userData>
<addressingType>public</addressingType>
</RunInstances>
Sample Response
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<reservationId>r-47a5402e</reservationId>
<ownerId>495219933132</ownerId>
<groupSet>
<item>
<groupId>default</groupId>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-2ba64342</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<keyName>example-key-name</keyName>
<amiLaunchIndex>0</amiLaunchIndex>
<instanceType>m1.small</instanceType>
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
</item>
<item>
<instanceId>i-2bc64242</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<keyName>example-key-name</keyName>
<amiLaunchIndex>1</amiLaunchIndex>
<instanceType>m1.small</instanceType>
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
</item>
<item>
<instanceId>i-2be64332</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<keyName>example-key-name</keyName>
<amiLaunchIndex>2</amiLaunchIndex>
<instanceType>m1.small</instanceType>
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
</item>
</instancesSet>
</RunInstancesResponse>
Related Operations
• DescribeInstances
• TerminateInstances
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
• DescribeSecurityGroups
TerminateInstances
The TerminateInstances operation shuts down one or more instances. This operation is idempotent;
if you terminate an instance more than once, each call will succeed.
Terminated instances will remain visible after termination (approximately one hour).
Request Parameters
The following table describes the request parameters for TerminateInstances. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in TerminateInstances responses.
Name Description
instancesSet A complex type describing the current and new state of each
instance specified.
Type: TerminateInstancesResponseInfoType[]
Sample Request
<TerminateInstances xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instancesSet>
<item>
<instanceId>i-28a64341</instanceId>
</item>
</instancesSet>
</TerminateInstances>
Sample Response
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instancesSet>
<item>
<instanceId>i-28a64341</instanceId>
<shutdownState>
<code>32</code>
<name>shutting-down</name>
</shutdownState>
<previousState>
<code>16</code>
<name>running</name>
</previousState>
</item>
</instancesSet>
</TerminateInstancesResponse>
Related Operations
• DescribeInstances
AWSAccessKeyId The Access Key ID for the request sender. This identifies Yes
the account which will be charged for usage of the
service. The account with which the Access Key ID is
associated must be signed up for Amazon EC2, or
requests will not be accepted.
10QMXFEV71ZS32XQFTR2
Timestamp The date and time at which the request is signed, in the Yes
API Version 2008-02-01
120
Amazon Elastic Compute Cloud Developer Guide
List of Operations by Function
Expires The date and time at which the signature included in the Yes
request expires, in the format
YYYY-MM-DDThh:mm:ssZ, as specified in the ISO
8601 standard.
Example: 2006-07-07T15:04:56Z
Note
The Timestamp parameter can be used instead of Expires. Requests must include either
Timestamp or Expires, but cannot contain both.
Parameter values must be URL-encoded. This is true for any Query parameter passed to Amazon EC2
and is typically necessary in the Signature parameter. Some clients do this automatically, but this is
not the norm.
• RegisterImage
• DescribeImages
• DeregisterImage
Instances
• RunInstances
• DescribeInstances
• TerminateInstances
• ConfirmProductInstance
Key Pairs
• CreateKeyPair
• DescribeKeyPairs
• DeleteKeyPair
Image Attributes
• ModifyImageAttribute
• DescribeImageAttribute
• ResetImageAttribute
Security Groups
• CreateSecurityGroup
• DescribeSecurityGroups
• DeleteSecurityGroup
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
Elastic IP Addresses
• AllocateAddress
• DescribeAddresses
• ReleaseAddress
• AssociateAddress
• DisassociateAddress
Availability Zones
• DescribeAvailabilityZones
AllocateAddress
The AllocateAddress operation acquires an elastic IP address for use with your account.
Request Parameters
The AllocateAddress operation does not have any request parameters.
Response Elements
The following table describes the default response tags included in AllocateAddress responses.
Name Description
PublicIp Returned IP address.
Type: xsd:string
Name Description
Sample Request
https://ec2.amazonaws.com/
?Action=AllocateAddress
&...auth parameters...
Sample Response
<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<publicIp>67.202.55.255</publicIp>
</AllocateAddressResponse>
Related Operations
• DescribeAddresses
• ReleaseAddress
• AssociateAddress
• DisassociateAddress
AssociateAddress
The AssociateAddress operation associates an elastic IP address with an instance.
If the IP address is currently assigned to another instance, the IP address is assigned to the new instance.
This is an idempotent operation. If you enter it more than once, Amazon EC2 does not return an error.
Request Parameters
The following table describes the request parameters for AssociateAddress. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in AssociateAddress responses.
Name Description
return true if the IP address is associated with the instance. Otherwise,
Name Description
false.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=AssociateAddress
&InstanceId=i-2ea64347
&PublicIp=67.202.55.255
&...auth parameters...
Sample Response
<AssociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</AssociateAddressResponse>
Related Operations
• AllocateAddress
• DescribeAddresses
• ReleaseAddress
• DisassociateAddress
AuthorizeSecurityGroupIngress
The AuthorizeSecurityGroupIngress operation adds permissions to a security group.
Permissions are specified by the IP protocol (TCP, UDP or ICMP), the source of the request (by IP
range or an Amazon EC2 user-group pair), the source and destination port ranges (for TCP and UDP),
and the ICMP codes and types (for ICMP). When authorizing ICMP, -1 can be used as a wildcard in the
type and code fields.
Permission changes are propagated to instances within the security group as quickly as possible.
However, depending on the number of instances, a small delay might occur.
Request Parameters
The following table describes the request parameters for AuthorizeSecurityGroupIngress.
Parameter names are case sensitive.
Response Elements
The following table describes the default response tags included in
AuthorizeSecurityGroupIngress responses.
Name Description
return true if permissions successfully added.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=AuthorizeSecurityGroupIngress
&IpProtocol=tcp
&FromPort=80
&ToPort=80
&CidrIp=0.0.0.0/0
&...auth parameters...
Sample Response
<AuthorizeSecurityGroupIngressResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</AuthorizeSecurityGroupIngressResponse>
Related Operations
• CreateSecurityGroup
• CreateSecurityGroup
• CreateSecurityGroup
• CreateSecurityGroup
ConfirmProductInstance
The ConfirmProductInstance operation returns true if the specified product code is attached to the
specified instance. The operation returns false if the product code is not attached to the instance.
The ConfirmProductInstance operation can only be executed by the owner of the AMI. This feature
is useful when an AMI owner is providing support and wants to verify whether a user's instance is
eligible.
Request Parameters
The following table describes the request parameters for ConfirmProductInstance. Parameter
names are case-sensitive.
InstanceId The instance for which to confirm the product code. Yes
Type: String
Response Elements
The following table describes the default response tags included in ConfirmProductInstance
responses.
Name Description
result true if the product code is attached to the instance, false if it is
not.
Type: xsd:boolean
Name Description
ownerId The instance owner's account ID. Only present if the product code
is attached to the instance.
Type: xsd:string
Sample Request
https://ec2.amazonaws.com/
?Action=ConfirmProductInstance
&ProductCode=774F4FF8
&InstanceId=i-10a64379
&...auth parameters...
Sample Response
<ConfirmProductInstanceResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<result>true</result>
<ownerId>254933287430</ownerId>
</ConfirmProductInstanceResponse>
Related Operations
• DescribeInstances
• RunInstances
CreateKeyPair
The CreateKeyPair operation creates a new 2048 bit RSA key pair and returns a unique ID that can
be used to reference this key pair when launching new instances. For more information, see
RunInstances.
Request Parameters
The following table describes the request parameters for CreateKeyPair. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in CreateKeyPair responses.
Name Description
keyName The key pair name provided in the original request.
Type: xsd:string
Sample Request
https://ec2.amazonaws.com/
?Action=CreateKeyPair
&KeyName=example-key-name
&...auth parameters...
Sample Response
<CreateKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<keyName>example-key-name</keyName>
<keyFingerprint>1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f</
keyFingerprint>
<keyMaterial>-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQBuLFg5ujHrtm1jnutSuoO8Xe56LlT+HM8v/xkaa39EstM3/aFxTHgElQiJLChp
HungXQ29VTc8rc1bW0lkdi23OH5eqkMHGhvEwqa0HWASUMll4o3o/IX+0f2UcPoKCOVUR+jx71Sg
5AU52EQfanIn3ZQ8lFW7Edp5a3q4DhjGlUKToHVbicL5E+g45zfB95wIyywWZfeW/UUF3LpGZyq/
ebIUlq1qTbHkLbCC2r7RTn8vpQWp47BGVYGtGSBMpTRP5hnbzzuqj3itkiLHjU39S2sJCJ0TrJx5
i8BygR4s3mHKBj8l+ePQxG1kGbF6R4yg6sECmXn17MRQVXODNHZbAgMBAAECggEAY1tsiUsIwDl5
91CXirkYGuVfLyLflXenxfI50mDFms/mumTqloHO7tr0oriHDR5K7wMcY/YY5YkcXNo7mvUVD1pM
ZNUJs7rw9gZRTrf7LylaJ58kOcyajw8TsC4e4LPbFaHwS1d6K8rXh64o6WgW4SrsB6ICmr1kGQI7
3wcfgt5ecIu4TZf0OE9IHjn+2eRlsrjBdeORi7KiUNC/pAG23I6MdDOFEQRcCSigCj+4/mciFUSA
SWS4dMbrpb9FNSIcf9dcLxVM7/6KxgJNfZc9XWzUw77Jg8x92Zd0fVhHOux5IZC+UvSKWB4dyfcI
tE8C3p9bbU9VGyY5vLCAiIb4qQKBgQDLiO24GXrIkswF32YtBBMuVgLGCwU9h9HlO9mKAc2m8Cm1
jUE5IpzRjTedc9I2qiIMUTwtgnw42auSCzbUeYMURPtDqyQ7p6AjMujp9EPemcSVOK9vXYL0Ptco
xW9MC0dtV6iPkCN7gOqiZXPRKaFbWADp16p8UAIvS/a5XXk5jwKBgQCKkpHi2EISh1uRkhxljyWC
iDCiK6JBRsMvpLbc0v5dKwP5alo1fmdR5PJaV2qvZSj5CYNpMAy1/EDNTY5OSIJU+0KFmQbyhsbm
rdLNLDL4+TcnT7c62/aH01ohYaf/VCbRhtLlBfqGoQc7+sAc8vmKkesnF7CqCEKDyF/dhrxYdQKB
gC0iZzzNAapayz1+JcVTwwEid6j9JqNXbBc+Z2YwMi+T0Fv/P/hwkX/ypeOXnIUcw0Ih/YtGBVAC
DQbsz7LcY1HqXiHKYNWNvXgwwO+oiChjxvEkSdsTTIfnK4VSCvU9BxDbQHjdiNDJbL6oar92UN7V
rBYvChJZF7LvUH4YmVpHAoGAbZ2X7XvoeEO+uZ58/BGKOIGHByHBDiXtzMhdJr15HTYjxK7OgTZm
gK+8zp4L9IbvLGDMJO8vft32XPEWuvI8twCzFH+CsWLQADZMZKSsBasOZ/h1FwhdMgCMcY+Qlzd4
JZKjTSu3i7vhvx6RzdSedXEMNTZWN4qlIx3kR5aHcukCgYA9T+Zrvm1F0seQPbLknn7EqhXIjBaT
P8TTvW/6bdPi23ExzxZn7KOdrfclYRph1LHMpAONv/x2xALIf91UB+v5ohy1oDoasL0gij1houRe
2ERKKdwz0ZL9SWq6VTdhr/5G994CK72fy5WhyERbDjUIdHaK3M849JJuf8cSrvSb4g==
-----END RSA PRIVATE KEY-----</keyMaterial>
</CreateKeyPairResponse>
Related Operations
• DescribeKeyPairs
• DeleteKeyPair
• RunInstances
CreateSecurityGroup
The CreateSecurityGroup operation creates a new security group.
Every instance is launched in a security group. If no security group is specified during launch, the
instances are launched in the default security group. Instances within the same security group have
unrestricted network access to each other. Instances will reject network access attempts from other
instances in a different security group. As the owner of instances you can grant or revoke specific
permissions using the AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress operations.
Request Parameters
The following table describes the request parameters for CreateSecurityGroup. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in CreateSecurityGroup responses.
Name Description
return true if call succeeded.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action==CreateSecurityGroup
&GroupName=WebServers
&GroupDescription=Web
&...auth parameters...
Sample Response
<CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</CreateSecurityGroupResponse>
Related Operations
• RunInstances
• DescribeSecurityGroups
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
• DeleteSecurityGroup
DeleteKeyPair
The DeleteKeyPair operation deletes a key pair.
Request Parameters
The following table describes the request parameters for DeleteKeyPair. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in DeleteKeyPair responses.
Name Description
return true if the key was successfully deleted.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=DeleteKeyPair
&KeyName=example-key-name
&...auth parameters...
Sample Response
<DeleteKeyPair xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DeleteKeyPair>
Related Operations
• CreateKeyPair
• DescribeKeyPairs
DeleteSecurityGroup
The DeleteSecurityGroup operation deletes a security group.
Note
If you attempt to delete a security group that contains instances, a fault is returned.
If you attempt to delete a security group that is referenced by another security group, a
fault is returned. For example, if security group B has a rule that allows access from
security group A, security group A cannot be deleted until the allow rule is removed.
Request Parameters
The following table describes the request parameters for DeleteSecurityGroup. Parameter names are
case sensitive.
Note
Response Elements
The following table describes the default response tags included in DeleteSecurityGroup responses.
Name Description
return true if the group is deleted. Otherwise, false.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=DeleteSecurityGroup
&GroupName=RangedPortsBySource
&...auth parameters...
Sample Response
<DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DeleteSecurityGroupResponse>
Related Operations
• CreateSecurityGroup
• DescribeSecurityGroups
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
DeregisterImage
The DeregisterImage operation deregisters an AMI. Once deregistered, instances of the AMI can no
longer be launched.
Request Parameters
The following table describes the request parameters for DeregisterImage. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in DeregisterImage responses.
Name Description
return true if deregistration succeeded; otherwise false.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=DeregisterImage
&ImageId=ami-61a54008
&...auth parameters...
Sample Response
<DeregisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DeregisterImageResponse>
Related Operations
• RegisterImage
• DescribeImages
DescribeAddresses
API Version 2008-02-01
132
Amazon Elastic Compute Cloud Developer Guide
DescribeAvailabilityZones
Request Parameters
The following table describes the request parameters for DescribeAddresses. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DescribeAddresses responses.
Name Description
publicIp Elastic IP address assigned to your account.
Type: xsd:string
Sample Request
https://ec2.amazonaws.com/
?Action=DescribeAddresses
&PublicIp.1=67.202.55.255
&...auth parameters...
Sample Response
<DescribeAddressesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instanceId>i-28a64341</instanceId>
<publicIp>67.202.55.255</publicIp>
</DescribeAddressesResponse>
Related Operations
• AllocateAddress
• ReleaseAddress
• AssociateAddress
• DisassociateAddress
DescribeAvailabilityZones
The DescribeAvailabilityZones operation describes availability zones that are currently available
to the account and their states.
Note
Availability zones are not the same across accounts. The availability zone us-east-1a for
account A is not necessarily the same as us-east-1a for account B. Zone assignments are
mapped independently for each account.
Request Parameters
The following table describes the request parameters for DescribeAvailabilityZones. Parameter
names are case sensitive.
Response Elements
The following table describes the default response tags included in DescribeAvailabilityZones
responses.
Name Description
availabilityZoneInfo Availability zone information.
Type: AvailabilityZoneItemType[]
Sample Request
https://ec2.amazonaws.com/
?Action=DescribeAvailabilityZones
&ZoneName.0=us-east-1a
&ZoneName.1=us-east-1b
&...auth parameters...
Sample Response
<DescribeAvailabilityZonesResponse
xmlns="http://ec2.amazonaws.com/doc/2008-02-01/">
<availabilityZoneInfo>
<item>
<zoneName>us-east-1a</zoneName>
<zoneState>available</zoneState>
</item>
<item>
<zoneName>us-east-1b</zoneName>
<zoneState>available</zoneState>
</item>
<item>
<zoneName>us-east-1c</zoneName>
<zoneState>available</zoneState>
</item>
</availabilityZoneInfo>
</DescribeAvailabilityZonesResponse>
Related Operations
• RunInstances
DescribeImageAttribute
The DescribeImageAttribute operation returns information about an attribute of an AMI. Only one
attribute can be specified per call.
Request Parameters
The following table describes the request parameters for DescribeImageAttribute. Parameter
names are case-sensitive.
Attributes
Attribute Name Description
launchPermission The AMIs launch permissions.
blockDeviceMapping Defines native device names to use when exposing virtual devices.
Type: String
Response Elements
The following table describes the default response tags included in DescribeImageAttribute
responses.
Name Description
imageId ID of the AMI described.
API Version 2008-02-01
135
Amazon Elastic Compute Cloud Developer Guide
DescribeImageAttribute
Name Description
Type: xsd:string
ramdisk ID of the RAM disk associated with the AMI. Returned if ramdisk
is specified.
Type: xsd:string
blockDeviceMapping Mapping that defines native device names to use when exposing
virtual devices. Returned if BlockDeviceMapping is specified.
Type: BlockDeviceMappingItemType[]
Related Operations
• DescribeImages
• ModifyImageAttribute
• ResetImageAttribute
DescribeImages
The DescribeImages operation returns information about AMIs available to the user. This includes
public AMIs available for any user to launch, private AMIs owned by the user making the request, and
private AMIs owned by other users for which the user has explicit launch permissions.
Launch Description
Permission
public The owner of the AMI granted launch permissions for the AMI to the all group.
All users have launch permissions for these AMIs.
explicit The owner of the AMI granted launch permissions to a specific user.
implicit A user has implicit launch permissions for all AMIs he or she owns.
The list of AMIs returned can be modified by specifying AMI IDs, AMI owners, or users with launch
permissions. If no options are specified, Amazon EC2 returns all AMIs for which the user has launch
permissions.
If you specify one or more AMI IDs, only AMIs that have the specified IDs are returned. If you specify
an invalid AMI ID, a fault is returned. If you specify an AMI ID for which you do not have access, it
will not be included in the returned results.
If you specify one or more AMI owners, only AMIs from the specified owners and for which you have
access are returned. The results can include the account IDs of the specified owners, amazon for AMIs
owned by Amazon or self for AMIs that you own.
If you specify a list of executable users, only users that have launch permissions for the AMIs are
returned. You can specify account IDs (if you own the AMI(s)), self for AMIs for which you own or
have explicit permissions, or all for public AMIs.
Note
Deregistered images are included in the returned results for an unspecified interval after
deregistration.
If you use the DescribeImages operation on machine images, it displays the kernel IDs and RAM disk
IDs associated with the images. If you specify a kernel or RAM disk ImageType, it displays
information about kernel or RAM disk images.
Request Parameters
The following table describes the request parameters for DescribeImages. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in DescribeImages responses.
Name Description
imagesSet A list of image descriptions.
Type: DescribeImagesResponseItemType[]
Sample Request
https://ec2.amazonaws.com/
?Action=DescribeImages
&ImageId.1=ami-be3adfd7
&...auth parameters...
Sample Response
<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<imagesSet>
<item>
<imageId>ami-be3adfd7</imageId>
<imageLocation>ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml</image
Location>
<imageState>available</imageState>
<imageOwnerId>206029621532</imageOwnerId>
<isPublic>false</isPublic>
<architecture>i386</architecture>
<imageType>machine</imageType>
<kernelId>aki-4438dd2d</kernelId>
<ramdiskId>ari-4538dd2c</ramdiskId>
</item>
</imagesSet>
</DescribeImagesResponse>
Related Operations
• DescribeInstances
• DescribeImageAttribute
DescribeInstances
The DescribeInstances operation returns information about instances that you own.
If you specify one or more instance IDs, Amazon EC2 returns information for those instances. If you do
not specify instance IDs, Amazon EC2 returns information for all relevant instances. If you specify an
invalid instance ID, a fault is returned. If you specify an instance that you do not own, it will not be
included in the returned results.
Recently terminated instances might appear in the returned results. This interval is usually less than one
hour.
Request Parameters
The following table describes the request parameters for DescribeInstances. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DescribeInstances responses.
Name Description
reservationSet A list of structures describing the status of all requested instances.
Type: ReservationInfoType
Sample Request
https://ec2.amazonaws.com/
?Action=DescribeInstances
&InstanceId.1=i-28a64341
&...auth parameters...
Sample Response
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<reservationSet>
<item>
<reservationId>r-44a5402d</reservationId>
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
<groupSet>
<item>
<groupId>default</groupId>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-28a64341</instanceId>
<imageId>ami-6ea54007</imageId>
<instanceState>
<code>0</code>
<name>running</name>
</instanceState>
<privateDnsName>10-251-50-75.ec2.internal</privateDnsName>
<dnsName>ec2-72-44-33-4.compute-1.amazonaws.com</dnsName>
<keyName>example-key-name</keyName>
<productCodesSet>
<item><productCode>774F4FF8</productCode></item>
</productCodesSet>
<InstanceType>m1.small</InstanceType>
<launchTime>2007-08-07T11:54:42.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
<kernelId>aki-ba3adfd3</kernelId>
<ramdiskId>ari-badbad00</ramdiskId>
</item>
</instancesSet>
</item>
</reservationSet>
</DescribeInstancesResponse>
Related Operations
• RunInstances
• TerminateInstances
DescribeKeyPairs
The DescribeKeyPairs operation returns information about key pairs available to you. If you specify
key pairs, information about those key pairs is returned. Otherwise, information for all registered key
pairs is returned.
Request Parameters
The following table describes the request parameters for DescribeKeyPairs. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DescribeKeyPairs responses.
Name Description
keySet A list of key pair descriptions.
Type: DescribeKeyPairsResponseItemType[]
Sample Request
https://ec2.amazonaws.com/
?Action=DescribeKeyPairs
&KeyName.1=example-key-name
&...auth parameters...
Sample Response
<DescribeKeyPairsResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<keySet>
<item>
<keyName>example-key-name</keyName>
<keyFingerprint>1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f</
keyFingerprint>
</item>
</keySet>
</DescribeKeyPairsResponse>
Related Operations
• CreateKeyPair
• DeleteKeyPair
• RunInstances
DescribeSecurityGroups
The DescribeSecurityGroups operation returns information about security groups that you own.
If you specify security group names, information about those security group is returned. Otherwise,
information for all security group is returned. If you specify a group that does not exist, a fault is
returned.
Request Parameters
The following table describes the request parameters for DescribeSecurityGroups. Parameter
names are case sensitive.
Response Elements
The following table describes the default response tags included in DescribeSecurityGroups
responses.
Name Description
securityGroupInfo Information about security groups.
Type: SecurityGroupItemType[]
Sample Request
https://ec2.amazonaws.com/
?Action=DescribeSecurityGroups
&GroupName.1=WebServers
&GroupName.2=RangedPortsBySource
&...auth parameters...
Sample Response
<DescribeSecurityGroupsResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<securityGroupInfo>
<item>
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
<groupName>WebServers</groupName>
<groupDescription>Web</groupDescription>
<ipPermissions>
<item>
<ipProtocol>tcp</ipProtocol>
<fromPort>80</fromPort>
<toPort>80</toPort>
<groups/>
<ipRanges>
<item>
<cidrIp>0.0.0.0/0</cidrIp>
</item>
</ipRanges>
</item>
</ipPermissions>
</item>
<item>
<ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
<groupName>RangedPortsBySource</groupName>
<groupDescription>A</groupDescription>
<ipPermissions>
<item>
<ipProtocol>tcp</ipProtocol>
<fromPort>6000</fromPort>
<toPort>7000</toPort>
<groups/>
<ipRanges/>
</item>
</ipPermissions>
</item>
</securityGroupInfo>
</DescribeSecurityGroupsResponse>
Related Operations
• CreateSecurityGroup
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
• DeleteSecurityGroup
DisassociateAddress
The DisassociateAddress operation disassociates the specified elastic IP address from the instance
to which it is assigned. This is an idempotent operation. If you enter it more than once, Amazon EC2
does not return an error.
Request Parameters
The following table describes the request parameters for DisassociateAddress. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in DisassociateAddress responses.
Name Description
return true if the IP address is disassociated from the instance.
Otherwise, false.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=DisassociateAddress
&PublicIp=67.202.55.255
&...auth parameters...
Sample Response
<DisassociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</DisassociateAddressResponse>
Related Operations
• AllocateAddress
• DescribeAddresses
• ReleaseAddress
• AssociateAddress
GetConsoleOutput
The GetConsoleOutput operation retrieves console output for the specified instance.
Instance console output is buffered and posted shortly after instance boot, reboot, and termination.
Amazon EC2 preserves the most recent 64 KB output which will be available for at least one hour after
the most recent post.
Request Parameters
The following table describes the request parameters for GetConsoleOutput. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in GetConsoleOutput responses.
Name Description
instanceId The instance ID.
Type: xsd:string
Sample Request
https://ec2.amazonaws.com/
?Action=GetConsoleOutput
&InstanceId=i-2ea64347
&...auth parameters...
Sample Response
API Version 2008-02-01
144
Amazon Elastic Compute Cloud Developer Guide
ModifyImageAttribute
<GetConsoleOutputResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instanceId>i-28a64341</instanceId>
<timestamp>2007-01-03 15:00:00</timestamp>
<output>TGludXggdmVyc2lvbiAyLjYuMTYteGVuVSAoYnVpbGRlckBwYXRjaGJhdC5hbWF6b25zY
SkgKGdj
YyB2ZXJzaW9uIDQuMC4xIDIwMDUwNzI3IChSZWQgSGF0IDQuMC4xLTUpKSAjMSBTTVAgVGh1IE9j
dCAyNiAwODo0MToyNiBTQVNUIDIwMDYKQklPUy1wcm92aWRlZCBwaHlzaWNhbCBSQU0gbWFwOgpY
ZW46IDAwMDAwMDAwMDAwMDAwMDAgLSAwMDAwMDAwMDZhNDAwMDAwICh1c2FibGUpCjk4ME1CIEhJ
R0hNRU0gYXZhaWxhYmxlLgo3MjdNQiBMT1dNRU0gYXZhaWxhYmxlLgpOWCAoRXhlY3V0ZSBEaXNh
YmxlKSBwcm90ZWN0aW9uOiBhY3RpdmUKSVJRIGxvY2t1cCBkZXRlY3Rpb24gZGlzYWJsZWQKQnVp
bHQgMSB6b25lbGlzdHMKS2VybmVsIGNvbW1hbmQgbGluZTogcm9vdD0vZGV2L3NkYTEgcm8gNApF
bmFibGluZyBmYXN0IEZQVSBzYXZlIGFuZCByZXN0b3JlLi4uIGRvbmUuCg==</output>
</GetConsoleOutputResponse>
ModifyImageAttribute
The ModifyImageAttribute operation modifies an attribute of an AMI.
Attributes
Attribute Name Type Description
launchPermission List Controls who has permission to
launch the AMI. Launch
permissions can be granted to
specific users by adding userIds.
To make the AMI public, add
the all group.
Request Parameters
The following table describes the request parameters for ModifyImageAttribute. Parameter names
are case sensitive.
ProductCode.n Attaches a product code to the AMI. Currently only one Conditional
product code can be associated with an AMI. Once set,
the product code cannot be changed or reset.
Type: String
Condition: Required for productCodes
Response Elements
The following table describes the default response tags included in ModifyImageAttribute
responses.
Name Description
return true if the operation succeeded, otherwise false.
Type: xsd:boolean
Sample Response
<ModifyImageAttributeResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</ModifyImageAttributeResponse>
Related Operations
• ResetImageAttribute
• DescribeImageAttribute
RebootInstances
The RebootInstances operation requests a reboot of one or more instances. This operation is
asynchronous; it only queues a request to reboot the specified instance(s). The operation will succeed if
the instances are valid and belong to the user. Requests to reboot terminated instances are ignored.
Request Parameters
The following table describes the request parameters for RebootInstance. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in RebootInstances responses.
Name Description
result true if the operation succeeded.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=RebootInstances
&InstanceId.1=i-2ea64347
&InstanceId.2=i-21a64348
&...auth parameters...
Sample Response
<RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</RebootInstancesResponse>
ReleaseAddress
The ReleaseAddress operation releases an elastic IP address associated with your account.
If you run this operation on an elastic IP address that is already released, the address might be assigned
to another account which will cause Amazon EC2 to return an error.
Note
Important
After releasing an elastic IP address, it is released to the IP address pool and might no
longer be available to your account. Make sure to update your DNS records and any
servers or devices that communicate with the address.
Request Parameters
The following table describes the request parameters for ReleaseAddress. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in ReleaseAddress responses.
Name Description
return true if the IP address is released. Otherwise, false.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=ReleaseAddress
&PublicIp=67.202.55.255
&...auth parameters...
Sample Response
<ReleaseAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</ReleaseAddressResponse>
Related Operations
• AllocateAddress
• DescribeAddresses
• AssociateAddress
• DisassociateAddress
RegisterImage
The RegisterImage operation registers an AMI with Amazon EC2. Images must be registered before
they can be launched. For more information, see RunInstances.
Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through the
RegisterImage operation. During registration, Amazon EC2 retrieves the specified image manifest
from Amazon S3 and verifies that the image is owned by the user registering the image.
The image manifest is retrieved once and stored within the Amazon EC2. Any modifications to an
image in Amazon S3 invalidates this registration. If you make changes to an image, deregister the
previous image and register the new image. For more information, see DeregisterImage.
Request Parameters
The following table describes the request parameters for RegisterImage. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in RegisterImage responses.
Name Description
imageId Unique ID of the newly registered machine image.
Type: xsd:string
Sample Request
https://ec2.amazonaws.com/
?Action=RegisterImage
&ImageLocation=mybucket-myimage.manifest.xml
&...auth parameters...
Sample Response
<RegisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<imageId>ami-61a54008</imageId>
</RegisterImageResponse>
Related Operations
• DescribeImages
• DeregisterImage
ResetImageAttribute
The ResetImageAttribute operation resets an attribute of an AMI to its default value.
Note
Request Parameters
The following table describes the request parameters for ResetImageAttribute. Parameter names are
case sensitive.
Response Elements
The following table describes the default response tags included in ResetImageAttribute responses.
Name Description
return true if the operation succeeded, otherwise false.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=ResetImageAttribute
&ImageId=ami-61a54008
&Attribute=launchPermission
&...auth parameters...
Sample Response
<ResetImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</ResetImageAttributeResponse>
Related Operations
• ModifyImageAttribute
• DescribeImageAttribute
RevokeSecurityGroupIngress
The RevokeSecurityGroupIngress operation revokes permissions from a security group. The
permissions used to revoke must be specified using the same values used to grant the permissions.
Permissions are specified by IP protocol (TCP, UDP, or ICMP), the source of the request (by IP range or
an Amazon EC2 user-group pair), the source and destination port ranges (for TCP and UDP), and the
ICMP codes and types (for ICMP).
Permission changes are quickly propagated to instances within the security group. However, depending
on the number of instances in the group, a small delay is might occur, .
Request Parameters
The following table describes the request parameters for RevokeSecurityGroupIngress. Parameter
names are case sensitive.
Response Elements
The following table describes the default response tags included in RevokeSecurityGroupIngress
responses.
Name Description
return true if permissions successfully revoked.
Type: xsd:boolean
Sample Request
https://ec2.amazonaws.com/
?Action=AuthorizeSecurityGroupIngress
&IpProtocol=tcp
&FromPort=80
&ToPort=80
&CidrIp=0.0.0.0/0
&...auth parameters...
Sample Response
<RevokeSecurityGroupIngressResponse xm
lns="http://ec2.amazonaws.com/doc/2008-02-01">
<return>true</return>
</RevokeSecurityGroupIngressResponse>
Related Operations
• CreateSecurityGroup
• DescribeSecurityGroups
• AuthorizeSecurityGroupIngress
• DeleteSecurityGroup
RunInstances
The RunInstances operation launches a specified number of instances.
Note
If Amazon EC2 cannot launch the minimum number AMIs you request, no instances launch. If there is
insufficient capacity to launch the maximum number of AMIs you request, Amazon EC2 launches as
many as possible to satisfy the requested maximum values.
Every instance is launched in a security group. If you do not specify a security group at launch, the
instances start in your default security group. For more information on creating security groups, see
CreateSecurityGroup.
An optional instance type can be specified. For information about instance types, see Instance Types.
You can provide an optional key pair ID for each image in the launch request (see CreateKeyPair. All
instances that are created from images that use this key pair will have access to the associated public key
at boot. You can use this key to provide secure access to an instance of an image on a per-instance basis.
Amazon EC2 public images use this feature to provide secure access without passwords.
Important
Launching public images without a key pair ID will leave them inaccessible.
The public key material is made available to the instance at boot time by placing it in the
openssh_id.pub file on a logical device that is exposed to the instance as /dev/sda2 (the ephemeral
store). The format of this file is suitable for use as an entry within ~/.ssh/authorized_keys (the
OpenSSH format). This can be done at boot (e.g., as part of rc.local) allowing for secure access
without passwords.
Optional user data can be provided in the launch request. All instances comprising the launch request
have access to this data (see Instance Metadata for details).
Note
If any of the AMIs have a product code attached for which the user has not subscribed, the
RunInstances call will fail.
Request Parameters
The following table describes the request parameters for RunInstances. Parameter names are case
sensitive.
Response Elements
The following table describes the default response tags included in RunInstances responses.
Name Description
RunInstancesResponse Status information about the instances launched.
Type: ReservationInfoType
Sample Request
https://ec2.amazonaws.com/
?Action=RunInstances
&ImageId=ami-60a54009
&MaxCount=3
&MinCount=1
&AddressingType=public
&Placement.AvailabilityZone=us-east-1b
&...auth parameters...
Sample Response
API Version 2008-02-01
155
Amazon Elastic Compute Cloud Developer Guide
RunInstances
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<reservationId>r-47a5402e</reservationId>
<ownerId>495219933132</ownerId>
<groupSet>
<item>
<groupId>default</groupId>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-2ba64342</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<keyName>example-key-name</keyName>
<amiLaunchIndex>0</amiLaunchIndex>
<InstanceType>m1.small</InstanceType>
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
</item>
<item>
<instanceId>i-2bc64242</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<keyName>example-key-name</keyName>
<amiLaunchIndex>1</amiLaunchIndex>
<InstanceType>m1.small</InstanceType>
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
</item>
<item>
<instanceId>i-2be64332</instanceId>
<imageId>ami-60a54009</imageId>
<instanceState>
<code>0</code>
<name>pending</name>
</instanceState>
<privateDnsName></privateDnsName>
<dnsName></dnsName>
<keyName>example-key-name</keyName>
<amiLaunchIndex>2</amiLaunchIndex>
<InstanceType>m1.small</InstanceType>
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
<placement>
<availabilityZone>us-east-1b</availabilityZone>
</placement>
</item>
</instancesSet>
</RunInstancesResponse>
Related Operations
• DescribeInstances
• TerminateInstances
• AuthorizeSecurityGroupIngress
• RevokeSecurityGroupIngress
• DescribeSecurityGroups
TerminateInstances
The TerminateInstances operation shuts down one or more instances. This operation is idempotent;
if you terminate an instance more than once, each call will succeed.
Terminated instances will remain visible after termination (approximately one hour).
Request Parameters
The following table describes the request parameters for TerminateInstances. Parameter names are
case-sensitive.
Response Elements
The following table describes the default response tags included in TerminateInstances responses.
Name Description
instancesSet A complex type describing the current and new state of each
instance specified.
Type: TerminateInstancesResponseInfoType[]
Sample Request
https://ec2.amazonaws.com/
?Action=TerminateInstances
&InstanceId.1=i-2ea64347
&InstanceId.2=i-21a64348
&...auth parameters...
Sample Response
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
<instancesSet>
<item>
<instanceId>i-28a64341</instanceId>
<shutdownState>
<code>32</code>
<name>shutting-down</name>
</shutdownState>
<previousState>
<code>16</code>
<name>running</name>
</previousState>
</item>
<item>
<instanceId>i-21a64348</instanceId>
<shutdownState>
<code>32</code>
<name>shutting-down</name>
</shutdownState>
<previousState>
<code>16</code>
<name>running</name>
</previousState>
</item>
</instancesSet>
</TerminateInstancesResponse>
Related Operations
• DescribeInstances
Introduction
The Amazon EC2 command line tools provide a command line interface to the web service API. This
section describes each tool and its command line arguments in detail.
Command line options and arguments are based on the GNU getopt conventions. Parameters are
invoked using flags, which typically come in short and long form. In their short form, flags use a single
character preceded by a dash. In their long form, flags use a more expressive name preceded by two
dashes.
Note
Some common options apply to all command line tools. These are described below and are
not included in the description of the specific tools.
Errors
Any service errors encountered by the command line tools are passed straight through from the API. For
more information about these errors, see API Error Codes.
Common Options
Most command line tools described in this section accept the following set of optional parameters:
Option Description
-U URL URL is the uniform resource locator of the Amazon EC2 web service
entry point.
Default: The EC2_URL environment variable, or
http://ec2.amazonaws.com if the environment variable is not set.
Example: -U http://ec2.amazonaws.com
-K EC2-PRIVATE-KEY The private key to use when constructing requests to Amazon EC2.
Option Description
Default: The value of the EC2_PRIVATE_KEY environment variable.
Example: -K pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
-? Displays help.
AMI Tools
This section describes each tool used to create AMIs and its command line arguments in detail.
ec2-bundle-image
Syntax
ec2-bundle-image -k private_key -c ec2_cert -u user_id -i image_path -r {i386
| x86_64} [-d destination] [-p ami_prefix] [-b, --batch] [--kernel kernel-id]
[--ramdisk ramdisk_id] [--block-device-mappingblock_device_mapping]
Description
Create a bundled AMI from an operating system image created in a loopback file. For more information,
see Creating an AMI through a Loopback File.
Note
Scripts that require a copy of the public key from the launch key pair must obtain the key
from the instance's metadata (not the key file in the ephemeral store) for instances bundled
with the 2007-08-29 AMI tools and later. AMIs bundled before this release will continue
to work normally.
Options
Note
-c, --cert ec2_cert The user's PEM encoded RSA public key certificate Yes
file.
Example: -c
cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
-u, --user user_id The user's AWS account number without dashes. Do Yes
not use the Access Key ID.
Example: -u 495219933132
-p, --prefix ami_prefix The filename prefix for bundled AMI files. No
Default: image
Example: -p my-image-is-special
Output
Status messages describing the stages and status of the bundling process.
Example
This example creates a bundled AMI from an operating system image that was created in a loopback
file:
$ ec2-bundle-image -k pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -c cert-
HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -u 495219933132 -i image.img -d bundled/
-p fred -r x86_64
Splitting bundled/fred.gz.crypt...
Created fred.part.00
Created fred.part.01
Created fred.part.02
Created fred.part.03
Created fred.part.04
Created fred.part.05
Created fred.part.06
Created fred.part.07
Created fred.part.08
Created fred.part.09
Created fred.part.10
Created fred.part.11
Created fred.part.12
Created fred.part.13
Created fred.part.14
Generating digests for each part...
Digests generated.
Creating bundle manifest...
Bundle Image complete.
Related Topics
• ec2-bundle-vol
• ec2-unbundle
• ec2-upload-bundle
• ec2-download-bundle
• ec2-delete-bundle
ec2-bundle-vol
Syntax
ec2-bundle-vol -k private_key -u user_id -c ec2_cert -r {i386 | x86_64} [-s
size] [-d destination] [-e exclude_directory_1,exclude_directory_1,...] [-p
ami_prefix] [-v volume] [--ec2cert ami_path] [--fstab fstab_path] [--kernel
kernel-id] [--ramdisk ramdisk_id]
[--block-device-mappingblock_device_mapping] [-b, --batch]
Description
Creates a bundled AMI by compressing, encrypting and signing a snapshot of the local machine's root
file system.
Note
Scripts that require a copy of the public key from the launch key pair must obtain the key
from the instance's metadata (not the key file in the ephemeral store) for instances bundled
with the 2007-08-29 AMI tools and later. AMIs bundled before this release will continue
to work normally.
On a running instance, Amazon EC2 attempts to inherit product codes, kernel settings,
RAM disk settings, and block device mappings with which the instance launched.
Options
Note
-c, --cert ec2_cert The user's PEM encoded RSA public key certificate Yes
file.
Example: -c
cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
-u, --user user_id The user's AWS account number without dashes. Do Yes
not use the Access Key ID.
Example: -u 495219933132
-s, --size size The size, in MB (1024 * 1024 bytes), of the image No
file to create. The maximum size is 10240 MB.
Default: 10240
-p, --prefix ami_prefix The filename prefix for bundled AMI files. No
Default: image
Example: -p my-image-is-special
-v, --volume volume The absolute path to the mounted volume from which No
to create the bundle.
Default: The root directory (/)
Example: -v /mnt/my-customized-ami
--ec2cert ami_path The path to the Amazon EC2 X509 public key No
certificate.
Default: /etc/aes/amiutil/cert-ec2.pem
Example: --ec2cert
/etc/aes/amiutil/cert-ec2.pem
--fstab fstab_path The path to the fstab to bundle into the image. If this No
is not specified, Amazon EC2 will provide its own
fstab.
Example: --fstab /etc/fstab
Output
Status messages describing the stages and status of the bundling
Example
This example creates a bundled AMI by compressing, encrypting and signing a snapshot of the local
machine's root file system.
$ ec2-bundle-vol -d /mnt -k pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -c cert-
HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -u 495219933132 -r x86_64
Copying / into the image file /mnt/image.img...
Excluding:
sys
dev/shm
proc
dev/pts
proc/sys/fs/binfmt_misc
dev
media
mnt
proc
sys
tmp/image.img
mnt/img-mnt
1+0 records in
1+0 records out
mke2fs 1.38 (30-Jun-2005)
warning: 256 blocks unused.
Splitting /mnt/image.gz.crypt...
Created image.part.00
Created image.part.01
Created image.part.02
Created image.part.03
...
Created image.part.22
Created image.part.23
Generating digests for each part...
Digests generated.
Creating bundle manifest...
Bundle Volume complete.
Related Topics
• ec2-bundle-image
• ec2-unbundle
• ec2-upload-bundle
• ec2-download-bundle
• ec2-delete-bundle
ec2-delete-bundle
Syntax
ec2-delete-bundle -b s3_bucket -a access_key_id -s secret_key [-m
manifest_path] [-p ami_prefix] [--url url] [--retry] [-y] [--clear]
Description
Deletes the specified bundle from Amazon S3 storage.
Options
Note
Output
Amazon EC2 displays status messages indicating the stages and status of the delete process.
Example
This example deletes a bundle from Amazon S3:
$ ec2-delete-bundle -b my-s3-bucket -a 10QMXFEV71ZS32XQFTR2 -s DMADSSfPfdaD
jbK+RRUhS/aDrjsiZadgAUm8gRU2 -p fred
Deleting files:
my-s3-bucket/fred.manifest.xml
my-s3-bucket/fred.part.00
my-s3-bucket/fred.part.01
my-s3-bucket/fred.part.02
my-s3-bucket/fred.part.03
my-s3-bucket/fred.part.04
my-s3-bucket/fred.part.05
my-s3-bucket/fred.part.06
Continue? [y/n]
y
Deleted my-s3-bucket/fred.manifest.xml
Deleted my-s3-bucket/fred.part.00
Deleted my-s3-bucket/fred.part.01
Deleted my-s3-bucket/fred.part.02
Deleted my-s3-bucket/fred.part.03
Deleted my-s3-bucket/fred.part.04
Deleted my-s3-bucket/fred.part.05
Deleted my-s3-bucket/fred.part.06
ec2-delete-bundle complete.
Related Topics
• ec2-bundle-image
• ec2-bundle-vol
• ec2-unbundle
• ec2-upload-bundle
• ec2-download-bundle
ec2-download-bundle
Syntax
ec2-download-bundle -b s3_bucket -m manifest -a access_key_id -s secret_key
-k private_key [-p ami_prefix] [-d directory] [--url url]
Description
Download the specified bundles from S3 storage.
Options
Note
-k, --privatekey The private key used to decrypt the manifest. Yes
private_key Example: -k
pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem
-p, --prefix The filename prefix for the bundled AMI files. No
ami_prefix Default: image
Example: -p my-image
Output
Status messages indicating the various stages of the download process are displayed.
Example
This example downloads creates the bundled directory and downloads the bundle from the
my-s3-bucket Amazon S3 bucket.
$ mkdir bundled
$ ec2-download-bundle -b my-s3-bucket -m fred.manifest.xml -a
10QMXFEV71ZS32XQFTR2 -s DMADSSfPfdaDjbK+RRUhS/aDrjsiZadgAUm8gRU2 -k pk-
HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -d bundled
downloading manifest https://s3.amazonaws.com/my-s3-bucket/image.manifest.xml
to bundled/image.manifest.xml ...
downloading part https://s3.amazonaws.com/my-s3-bucket/image.part.00 to
bundled/image.part.00 ...
Downloaded image.part.00 from https://s3.amazonaws.com/my-s3-bucket.
downloading part https://s3.amazonaws.com/my-s3-bucket/image.part.01 to
bundled/image.part.01 ...
Downloaded image.part.01 from https://s3.amazonaws.com/my-s3-bucket.
downloading part https://s3.amazonaws.com/my-s3-bucket/image.part.02 to
bundled/image.part.02 ...
Downloaded image.part.02 from https://s3.amazonaws.com/my-s3-bucket.
downloading part https://s3.amazonaws.com/my-s3-bucket/image.part.03 to
bundled/image.part.03 ...
Downloaded image.part.03 from https://s3.amazonaws.com/my-s3-bucket.
downloading part https://s3.amazonaws.com/my-s3-bucket/image.part.04 to
bundled/image.part.04 ...
Downloaded image.part.04 from https://s3.amazonaws.com/my-s3-bucket.
downloading part https://s3.amazonaws.com/my-s3-bucket/image.part.05 to
bundled/image.part.05 ...
Downloaded image.part.05 from https://s3.amazonaws.com/my-s3-bucket.
downloading part https://s3.amazonaws.com/my-s3-bucket/image.part.06 to
bundled/image.part.06 ...
Downloaded image.part.06 from https://s3.amazonaws.com/my-s3-bucket.
Download Bundle complete.
Related Topics
• ec2-bundle-image
• ec2-bundle-vol
• ec2-unbundle
• ec2-upload-bundle
• ec2-delete-bundle
ec2-unbundle
Syntax
ec2-unbundle -m manifest -k private_key [-d destination_directory] [-s
source_directory]
Description
Recreates the AMI from the bundled AMI parts.
Options
Note
-k, --privatekey The path to your PEM-encoded RSA key file. Yes
private_key Example: -k $HOME/pk-234242DEADCAFE.pem
Example
This example unbundles the AMI specified in the fred.manifest.xml file:
$ mkdir unbundled
$ ec2-unbundle -m fred.manifest.xml -s bundled -d unbundled
cat bundled/fred.part.00 bundled/fred.part.01 bundled/fred.part.02 bundled/
fred.part.03 bundled/fred.part.04 bundled/fred.part.05 bundled/fred.part.06
bundled/fred.part.07 bundled/fred.part.08 bundled/fred.part.09 bundled/
fred.part.10 bundled/fred.part.11 bundled/fred.part.12 bundled/fred.part.13
bundled/fred.part.14 | openssl enc -d -aes-128-cbc -K
a8fbe9586b7fd3df893b237f88e351a9 -iv 121febdf64b0322cd4ffda03aa1ab535 | gun
zip > unbundled/fred.img
Unbundle complete.
$ ls -l unbundled
total 1025008
-rw-r--r-- 1 root root 1048578048 Aug 25 23:46 fred.img
Output
Status messages indicating the various stages of the unbundling process are displayed.
Related Topics
• ec2-bundle-image
• ec2-bundle-vol
• ec2-upload-bundle
• ec2-download-bundle
• ec2-delete-bundle
ec2-upload-bundle
Syntax
ec2-upload-bundle -b s3_bucket -m manifest -a access_key_id -s secret_key
[--acl acl] [--ec2cert certificate] [-d directory] [--part part] [--url url]
[--retry] [--skipmanifest]
Description
Upload a bundled AMI to Amazon S3 storage.
Options
Note
-m, --manifest The path to the manifest file. The manifest file is Yes
manifest created during the bundling process and can be found
in the directory containing the bundle.
Example: -m
/var/spool/my-first-bundle/Manifest
--acl acl The access control list policy of the bundled image. No
Valid Values: public-read | aws-exec-read
Default: aws-exec-read
Example: --acl public-read
API Version 2008-02-01
171
Amazon Elastic Compute Cloud Developer Guide
ec2-upload-bundle
--part part Starts uploading the specified part and all subsequent No
parts.
Example: --part
Output
Amazon EC2 displays status messages that indicate the stages and status of the upload process.
Example
This example uploads the bundle specified by the bundled/fred.manifest.xml manifest:
$ ec2-upload-bundle -b my-s3-bucket -m bundled/fred.manifest.xml -a
10QMXFEV71ZS32XQFTR2 -s DMADSSfPfdaDjbK+RRUhS/aDrjsiZadgAUm8gRU2 -d bundled
Encrypting bundle manifest...
Completed encryption.
Uploading encrypted manifest...
Uploaded encrypted manifest to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.manifest.xml.
Uploading bundled AMI parts to http://s3.amazonaws.com:80/alpowell-images...
Uploaded fred.part.00 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.00.
Uploaded fred.part.01 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.01.
Uploaded fred.part.02 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.02.
Uploaded fred.part.03 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.03.
Uploaded fred.part.04 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.04.
Uploaded fred.part.05 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.05.
Uploaded fred.part.06 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.06.
Uploaded fred.part.07 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.07.
Uploaded fred.part.08 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.08.
Uploaded fred.part.09 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.09.
Uploaded fred.part.10 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.10.
Uploaded fred.part.11 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.11.
Uploaded fred.part.12 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.12.
Uploaded fred.part.13 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.13.
Uploaded fred.part.14 to ht
tp://s3.amazonaws.com:80/alpowell-images/fred.part.14.
Upload Bundle complete.
Related Topics
• ec2-bundle-image
• ec2-bundle-vol
• ec2-unbundle
• ec2-download-bundle
• ec2-delete-bundle
API Tools
This section describes each API tool and its command line arguments in detail.
• ec2-register
• ec2-deregister
• ec2-describe-images
Instances
• ec2-run-instances
• ec2-describe-instances
• ec2-terminate-instances
• ec2-confirm-product-instance
Key Pairs
• ec2-add-keypair
• ec2-describe-keypairs
• ec2-delete-keypair
• ec2-fingerprint-key
Image Attributes
• ec2-modify-image-attribute
• ec2-describe-image-attribute
• ec2-reset-image-attribute
Security Groups
• ec2-add-group
• ec2-delete-group
• ec2-describe-group
• ec2-authorize
• ec2-revoke
Elastic IP Addresses
• ec2-allocate-address
• ec2-describe-addresses
• ec2-release-address
• ec2-associate-address
• ec2-disassociate-address
Availability Zones
• ec2-describe-availability-zones
ec2-add-group
Syntax
ec2-add-group group -d description
Description
Creates a new security group. Group names must be unique per account.
Options
Output
Amazon EC2 returns a table that contains the following information:
Example
This example creates the websrv security group.
$ ec2-add-group websrv -d 'Web servers'
GROUP websrv Web servers
Related Topics
• CreateSecurityGroup
• ec2-describe-group
• ec2-delete-group
• ec2-authorize
• ec2-revoke
ec2-add-keypair
Syntax
ec2-add-keypair key
Description
Creates a new 2048 bit RSA key pair with the specified name. The public key is stored by Amazon EC2
and the private key is displayed on the console. The private key is returned as an unencrypted PEM
encoded PKCS#8 private key. If a key with the specified name already exists, Amazon EC2 returns an
error.
Options
API Version 2008-02-01
175
Amazon Elastic Compute Cloud Developer Guide
ec2-allocate-address
Output
Amazon EC2 returns a table that contains the following information:
Example
This example creates a key pair named gsg-keypair:
$ ec2-add-keypair gsg-keypair
KEYPAIR gsg-keypair
1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f
-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQBuLFg5ujHrtm1jnutSuoO8Xe56LlT+HM8v/xkaa39EstM3/aFxTHgElQiJLChp
HungXQ29VTc8rc1bW0lkdi23OH5eqkMHGhvEwqa0HWASUMll4o3o/IX+0f2UcPoKCOVUR+jx71Sg
5AU52EQfanIn3ZQ8lFW7Edp5a3q4DhjGlUKToHVbicL5E+g45zfB95wIyywWZfeW/UUF3LpGZyq/
ebIUlq1qTbHkLbCC2r7RTn8vpQWp47BGVYGtGSBMpTRP5hnbzzuqj3itkiLHjU39S2sJCJ0TrJx5
i8BygR4s3mHKBj8l+ePQxG1kGbF6R4yg6sECmXn17MRQVXODNHZbAgMBAAECggEAY1tsiUsIwDl5
91CXirkYGuVfLyLflXenxfI50mDFms/mumTqloHO7tr0oriHDR5K7wMcY/YY5YkcXNo7mvUVD1pM
ZNUJs7rw9gZRTrf7LylaJ58kOcyajw8TsC4e4LPbFaHwS1d6K8rXh64o6WgW4SrsB6ICmr1kGQI7
3wcfgt5ecIu4TZf0OE9IHjn+2eRlsrjBdeORi7KiUNC/pAG23I6MdDOFEQRcCSigCj+4/mciFUSA
SWS4dMbrpb9FNSIcf9dcLxVM7/6KxgJNfZc9XWzUw77Jg8x92Zd0fVhHOux5IZC+UvSKWB4dyfcI
tE8C3p9bbU9VGyY5vLCAiIb4qQKBgQDLiO24GXrIkswF32YtBBMuVgLGCwU9h9HlO9mKAc2m8Cm1
jUE5IpzRjTedc9I2qiIMUTwtgnw42auSCzbUeYMURPtDqyQ7p6AjMujp9EPemcSVOK9vXYL0Ptco
xW9MC0dtV6iPkCN7gOqiZXPRKaFbWADp16p8UAIvS/a5XXk5jwKBgQCKkpHi2EISh1uRkhxljyWC
iDCiK6JBRsMvpLbc0v5dKwP5alo1fmdR5PJaV2qvZSj5CYNpMAy1/EDNTY5OSIJU+0KFmQbyhsbm
rdLNLDL4+TcnT7c62/aH01ohYaf/VCbRhtLlBfqGoQc7+sAc8vmKkesnF7CqCEKDyF/dhrxYdQKB
gC0iZzzNAapayz1+JcVTwwEid6j9JqNXbBc+Z2YwMi+T0Fv/P/hwkX/ypeOXnIUcw0Ih/YtGBVAC
DQbsz7LcY1HqXiHKYNWNvXgwwO+oiChjxvEkSdsTTIfnK4VSCvU9BxDbQHjdiNDJbL6oar92UN7V
rBYvChJZF7LvUH4YmVpHAoGAbZ2X7XvoeEO+uZ58/BGKOIGHByHBDiXtzMhdJr15HTYjxK7OgTZm
gK+8zp4L9IbvLGDMJO8vft32XPEWuvI8twCzFH+CsWLQADZMZKSsBasOZ/h1FwhdMgCMcY+Qlzd4
JZKjTSu3i7vhvx6RzdSedXEMNTZWN4qlIx3kR5aHcukCgYA9T+Zrvm1F0seQPbLknn7EqhXIjBaT
P8TTvW/6bdPi23ExzxZn7KOdrfclYRph1LHMpAONv/x2xALIf91UB+v5ohy1oDoasL0gij1houRe
2ERKKdwz0ZL9SWq6VTdhr/5G994CK72fy5WhyERbDjUIdHaK3M849JJuf8cSrvSb4g==
-----END RSA PRIVATE KEY-----
Related Topics
• CreateKeyPair
• ec2-describe-keypairs
• ec2-delete-keypair
ec2-allocate-address
Syntax
ec2-allocate-address
Description
Acquires an elastic IP address for use with your account.
Output
Amazon EC2 returns a table that contains the following information:
Example
This example returns an elastic IP address for use with the account.
$ ec2-allocate-address
ADDRESS 67.202.55.255
Related Topics
• ec2-describe-addresses
• ec2-release-address
• ec2-associate-address
• ec2-disassociate-address
ec2-associate-address
Syntax
ec2-associate-address -i instance_id ip_address
Description
Associates an elastic IP address with an instance. If the IP address is currently assigned to another
instance, the IP address is assigned to the new instance. This is an idempotent operation. If you enter it
more than once, Amazon EC2 does not return an error.
Options
Option Description Required
instance_id The instance to which the IP address is assigned. Yes
Example: i-43a4412a
ip_address The IP address that you are assigning to the instance. Yes
API Version 2008-02-01
177
Amazon Elastic Compute Cloud Developer Guide
ec2-authorize
Output
Amazon EC2 returns a table that contains the following information:
Example
This example assigns the 67.202.55.255 IP address to the i-43a4412a instance.
$ ec2-associate-address -i i-43a4412a 67.202.55.255
ADDRESS 67.202.55.255 i-43a4412a
Related Topics
• ec2-allocate-address
• ec2-describe-addresses
• ec2-release-address
• ec2-disassociate-address
ec2-authorize
Syntax
ec2-authorize group [-P protocol] (-p port_range | -t icmp_type_code) [-u
source_group_user ...] [-o source_group ...] [-s source_subnet ...]
Description
Adds a rule to the specified security group. If no source host, group or subnet is provided, requests from
any source address will be honored.
Options
Option Description Required
group The group to which this rule will apply. Yes
Example: webservers
-p port_range For the TCP or UDP protocols, this specifies the Yes
range of ports to allow. You specify a single integer
or a range (min-max).
Condition: Applies when specifying a CIDR subnet
as the source.
Example: -p 80
-t icmp_type_code For the ICMP protocol, the ICMP type and code must Yes
be specified. This must be specified in the format
type:code where both are integers. Type, code, or
both can be specified as -1, which is a wildcard.
Condition: Applies when specifying a CIDR subnet
as the source.
Example: -t 2:5
Output
Amazon EC2 returns a table that contains the following information:
Example
This example grants TCP port 80 access from the 205.192.0.0/16 address range to the websrv security
group:
$ ec2-authorize websrv -P tcp -p 80 -s 205.192.0.0/16
GROUP websrv ""
PERMISSION websrv ALLOWS tcp 80 80 FROM CIDR 205.192.0.0/16
Related Topics
• AuthorizeSecurityGroupIngress
• ec2-add-group
• ec2-describe-group
• ec2-delete-group
• ec2-revoke
ec2-confirm-product-instance
Syntax
ec2-confirm-product-instance product_code -i instance_id
Description
Returns a boolean indicating whether the specified product code is attached to the specified instance. If
it is attached, It returns true. Otherwise, it returns false.
This command can only be executed by the AMI owner. This is useful when an AMI owner is providing
support and wants to verify whether a user's instance is eligible.
Options
Option Description Required
instance_id Instance identifier that was generated when the Yes
instance launched.
Example: i-10a64379
Output
Amazon EC2 returns a table that contains the following information:
• Product code.
• Instance ID.
Example
This example confirms whether the 774F4FF8 product code is attached to the i-10a64379 instance:
$ ec2-confirm-product-instance 774F4FF8 -i i-10a64379
774F4FF8 i-10a64379 true
Related Topics
• DescribeInstances
• ec2-modify-image-attribute
ec2-delete-group
Syntax
ec2-delete-groupgroup
Description
Deletes the specified security group.
Note
If you attempt to delete a security group that contains instances, a fault is returned.
If you attempt to delete a security group that is referenced by another security group, a
fault is returned. For example, if security group B has a rule that allows access from
security group A, security group A cannot be deleted until the allow rule is removed.
Options
Option Description Required
group Name of the security group. Yes
Example: webservers
Output
Amazon EC2 returns a table that contains the following information:
Example
This command deletes the websrv security group:
$ ec2-delete-group websrv
GROUP websrv
Related Topics
• DeleteSecurityGroup
• ec2-add-group
• ec2-describe-group
• ec2-authorize
• ec2-revoke
ec2-delete-keypair
Syntax
ec2-delete-keypair key_pair
Description
Deletes the specified key pair, by removing the public key from Amazon EC2
Options
Option Description Required
key_pair Name of the key pair. Yes
Example: primary_keypair
Output
Amazon EC2 returns a table that contains the following information:
Example
This example deletes the gsg-keypair key pair:
$ ec2-delete-keypair gsg-keypair
KEYPAIR gsg-keypair
Related Topics
• DeleteKeyPair
• ec2-add-keypair
• ec2-describe-keypairs
ec2-deregister
Syntax
ec2-deregister ami_id
Description
Deregisters the specified AMI. Once deregistered, the AMI cannot be used to launch new instances.
Note
This command does not delete the AMI from Amazon S3.
Options
Option Description Required
ami_id AMI identifier. Yes
Example: ami-4fa54026
Output
Amazon EC2 returns a table that contains the following information:
Example
This example deregisters the ami-4fa54026 AMI:
$ ec2-deregister ami-4fa54026
IMAGE ami-4fa54026
Related Topics
• DeregisterImage
• ec2-register
• ec2-describe-images
ec2-describe-addresses
Syntax
ec2-describe-addresses [public_ip ...]
Description
Lists elastic IP addresses assigned to your account.
Options
Option Description Required
public_ip Elastic IP addresses to describe No
Example: 67.202.55.255
Output
Amazon EC2 returns a table that contains the following information:
Example
This example returns elastic IP addresses assigned to the account.
$ ec2-describe-addresses
Related Topics
• ec2-allocate-address
• ec2-release-address
• ec2-associate-address
• ec2-disassociate-address
ec2-disassociate-address
Syntax
ec2-disassociate-address ip_address
Description
Disassociates the specified elastic IP address from the instance to which it is assigned. This is an
idempotent operation. If you enter it more than once, Amazon EC2 does not return an error.
Options
Option Description Required
ip_address The IP address that you are disassociating from the Yes
instance.
Example: 67.202.55.255
Output
Amazon EC2 returns a table that contains the following information:
Example
This example disassociates the 67.202.55.255 IP address from the instance to which it is assigned.
$ ec2-disassociate-address 67.202.55.255
ADDRESS 67.202.55.255
Related Topics
• ec2-allocate-address
• ec2-describe-addresses
• ec2-release-address
• ec2-associate-address
ec2-describe-availability-zones
Syntax
ec2-describe-availability-zones [zone-name...]
Description
API Version 2008-02-01
185
Amazon Elastic Compute Cloud Developer Guide
ec2-describe-group
Describes availability zones that are currently available to the account and their states.
Note
Availability zones are not the same across accounts. The availability zone us-east-1a for
account A is not necessarily the same as us-east-1a for account B. Zone assignments are
mapped independently for each account.
Options
Option Description Required
zone-name Name of an availability zone. No
Example: us-east-1a
Output
Amazon EC2 returns a table that contains the following information:
Example
This example displays the availability zones that are available to the account:
$ ec2-describe-availability-zones
AVAILABILITYZONE us-east-1a available
AVAILABILITYZONE us-east-1b available
AVAILABILITYZONE us-east-1c available
Related Topics
• ec2-run-instances
ec2-describe-group
Syntax
ec2-describe-group [group ...]
Description
Describes the current state of each specified security group. If no security groups are explicitly listed,
Amazon EC2 displays all security groups owned by the current user.
Options
Option Description Required
group Name of the security group. Yes
Example: webservers
Output
Amazon EC2 returns a table that contains the following information:
Example
This example displays the state of the websrv security group:
$ ec2-describe-group websrv
GROUP 495219933132 websrv Web servers
PERMISSION 495219933132 websrv ALLOWS tcp 80 80 FROM CIDR 0.0.0.0/0
Related Topics
• DescribeSecurityGroups
• ec2-add-group
• ec2-delete-group
• ec2-authorize
• ec2-revoke
ec2-describe-image-attribute
Syntax
ec2-describe-image-attribute ami_id ( -l | -p )
Description
Describes an attribute for the specified AMI.
Options
Output
Amazon EC2 returns a table that contains the following information:
Examples
This example lists the launch permissions for the ami-2bb65342 AMI:
$ ec2-describe-image-attribute ami-2bb65342 -l
launchPermission ami-2bb65342 group all
launchPermission ami-2bb65342 userId 495219933132
This example lists the product code for the ami-2bb65342 AMI:
$ ec2-describe-image-attribute ami-2bb65342 -p
productCodes ami-2bb65342 productCode 774F4FF8
Related Topics
• DescribeImageAttribute
• ec2-modify-image-attribute
• ec2-reset-image-attribute
• Sharing AMIs
ec2-describe-images
Syntax
ec2-describe-images[ami_id ...] [-a] [-o owner ...] [-x user_id]
Description
Returns information about AMIs available to the user. This includes public AMIs available for any user
to launch, private AMIs owned by the user making the request, and private AMIs owned by other users
for which the user has explicit launch permissions.
The list of AMIs returned can be modified by specifying AMI IDs, AMI owners, or users with launch
permissions. If no options are specified, Amazon EC2 returns all AMIs for which the user has launch
permissions.
If you specify one or more AMI IDs, only AMIs that have the specified IDs are returned. If you specify
an invalid AMI ID, a fault is returned. If you specify an AMI ID for which you do not have access, it
will not be included in the results.
If you specify one or more AMI owners, only AMIs from the specified owners and for which you have
access are returned. The results can include the account IDs of the specified owners, amazon for AMIs
owned by Amazon or self for AMIs that you own.
If you specify a list of executable users, only users that have launch permissions for the AMIs are
returned. You can specify account IDs (if you own the AMI(s)), self for AMIs for which you own or
have explicit permissions, or all for public AMIs.
Note
If you do not specify any optional parameters, Amazon EC2 returns images you own or
images for which you have explicit access. Public images are not returned.
If you use this command on machine images, it displays the kernel IDs and RAM disk IDs associated
with the images. If you specify a kernel or RAM disk ImageType, it displays information about kernel
or RAM disk images.
In addition to machine images, you can view available kernel or RAM disk images by specifying
kernel or ramdisk.
Options
Option Description Required
--image-type Returns machine (default), kernel, or RAM disk No
images.
Accepts the values machine, kernel, or ramdisk.
Example: kernel
-a Returns AMIs that the user owns and for which the No
API Version 2008-02-01
189
Amazon Elastic Compute Cloud Developer Guide
ec2-describe-images
Output
Amazon EC2 returns a table that contains the following information:
Example
This example describes the ami-78a54011 AMI:
$ ec2-describe-images ami-78a54011
IMAGE ami-78a54011 powerdns/image.manifest.xml 495219933132 available private
774F4FF8
Related Topics
• DescribeImages
• ec2-register
• ec2-deregister
ec2-describe-instances
Syntax
ec2-describe-instances [instance_id|availability-zone ...]
Description
Describes the current state of the specified instance(s). If you do not specify instances, all your instances
are included in the output.
Options
Option Description Required
instance_id Instance identifier that was generated when the No
instance launched.
Example: r-15a4417c
Output
Amazon EC2 returns a table that contains the following information:
Example
This example describes the current state of the instances (currently one) owned by this user:
$ ec2-describe-instances
RESERVATION r-15a4417c 495219933132
INSTANCE i-3ea74257 ami-6ba54002 ec2-72-44-33-4.compute-1.amazonaws.com
10-251-50-154.ec2.internal running 0 774F4FF8 m1.small
2007-07-11T16:40:44+0000 aki-ba3adfd3 ari-badbad00 us-east-1a
INSTANCE i-31a74258 ami-6ba54002 ec2-72-44-34-23.compute-1.amazonaws.com
10-251-50-156.ec2.internal running 1 m1.small 2007-07-11T16:40:44+0000 aki-
ba3adfd3 ari-badbad00 us-east-1a
Related Topics
• DescribeInstances
• ec2-run-instances
• ec2-terminate-instances
ec2-describe-keypairs
Syntax
ec2-describe-keypairs [key_id ...]
Description
Describes the current state of each specified key. If no keys are specified, all keys owned by the current
user are included in the output.
Options
Option Description Required
key_id Names of one or more keys. No
Example: gsg-keypair
Output
Amazon EC2 returns a table that contains the following information:
Example
Related Topics
• DescribeKeyPairs
• ec2-add-keypair
• ec2-delete-keypair
ec2-fingerprint-key
Syntax
ec2-fingerprint-key keyfile
Description
Computes and displays the fingerprint for a private key produced by Amazon EC2. .
This operation is performed entirely on the client-side. Network access is not required.
Options
Option Description Required
keyfile The path to a file containing an unencrypted Yes
PEM-encoded PKCS#8 private key.
Example: mykey.pem
Output
A key fingerprint. This is formatted as a hash digest with each octet separated by a colon.
Example
This example computes and displays the fingerprint for the mykey.pem private key:
$ ec2-fingerprint-key mykey.pem
1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f
Related Topics
• ec2-add-keypair
• ec2-describe-keypairs
ec2-get-console-output
Syntax
ec2-get-console-output instance_id [-r]
Description
Retrieves the console output for specified instance, if available, and displays it to stdout.
Options
Option Description Required
instance_id Instance identifier generated when the instance Yes
launched.
Example: i-10a64379
Output
• A timestamp indicating the time of the last update.
• The instance console output. By default the ^ESC character is escaped and duplicate new-lines are
removed to facilitate reading.
Example
This example retrieves the console output for the i-10a64379 instance
$ ec2-get-console-output i-10a64379
2007-01-03 12:00:00
Linux version 2.6.16-xenU ([email protected]) (gcc version 4.0.1
20050727 (Red Hat 4.0.1-5)) #1 SMP Thu Oct 26 08:41:26 SAST 2006
BIOS-provided physical RAM map:
Xen: 0000000000000000 - 000000006a400000 (usable)
980MB HIGHMEM available.
727MB LOWMEM available.
NX (Execute Disable) protection: active
IRQ lockup detection disabled
Built 1 zonelists
Kernel command line: root=/dev/sda1 ro 4
Enabling fast FPU save and restore... done.
ec2-modify-image-attribute
Syntax
ec2-modify-image-attribute ami_id -l (-a item_value | -r item_value)
Description
Modifies an attribute for the specified AMI.
Attributes
Attribute Name Type Description
launchPermission List Controls who has permission to launch
the AMI. You can grant launch
permissions by adding user IDs or
make the AMI public by adding the
all group. To learn more about
sharing AMIs see Sharing AMIs.
Note
Note
Options
Option Description Required
-l Modifies the launchPermission property. Yes
Example: -l
Example: -a all
Output
Amazon EC2 returns a table that contains the following information:
Examples
The following example modifies launch permission attributes for the ami-2bb65342 AMI:
$ ec2-modify-image-attribute ami-2bb65342 -l -a 495219933132
launchPermission ami-2bb65342 ADD userId 495219933132
The following example adds the 774F4FF8 product code to the ami-2bb65342 AMI:
$ ec2-modify-image-attribute ami-2bb65342 -p 774F4FF8
productCodes ami-2bb65342 productCode 774F4FF8
Related Topics
• ModifyImageAttribute
• ec2-reset-image-attribute
• ec2-describe-image-attribute
• Sharing AMIs
ec2-reboot-instances
Syntax
ec2-reboot-instances instance_id [instance_id ...]
Description
Reboots one or more specified instances. You must specify at least one instance ID.
Options
Option Description Required
instance_id Instance identifier that was assigned to the instance at Yes
launch.
Example: i-3ea74257
Output
This command displays no output on success.
Example
This example reboots the i-3ea74257 instance.
$ ec2-reboot-instances i-3ea74257
ec2-release-address
Syntax
ec2-release-address ip_address
Description
Releases an elastic IP address associated with your account.
If you run this operation on an elastic IP address that is already released, the address might be assigned
to another account which will cause Amazon EC2 to return an error.
Note
Important
After releasing an elastic IP address, it is released to the IP address pool and might no
longer be available to your account. Make sure to update your DNS records and any
servers or devices that communicate with the address.
Options
Output
Amazon EC2 returns a table that contains the following information:
Example
This example releases an elastic IP address associated with the account.
$ ec2-release-address 67.202.55.255
ADDRESS 67.202.55.255
Related Topics
• ec2-allocate-address
• ec2-describe-addresses
• ec2-associate-address
• ec2-disassociate-address
ec2-register
Syntax
ec2-register manifest
Description
Registers the Amazon Machine Image (AMI) specified in the manifest file and generates a new Amazon
Machine Image (AMI) ID.
Options
Option Description Required
manifest Location and filename of the manifest file. The Yes
manifest file must be located in Amazon S3 and must
be in the bucket/object form.
Example: mybucket/image.manifest.xml
Output
Amazon EC2 assigns and returns an AMI ID.
Example
This example registers the AMI specified in the image.manifest.xml manifest file:
$ ec2-register mybucket/image.manifest.xml
IMAGE ami-78a54011
Related Topics
• RegisterImage
• ec2-deregister
• ec2-describe-images
ec2-reset-image-attribute
Syntax
ec2-reset-image-attribute ami_id -l
Description
Resets an attribute for the specified AMI.
Options
Option Description Required
ami_id The identifier that was assigned to the AMI when it Yes
was registered.
Example: r-15a4417c
Output
Amazon EC2 returns a table that contains the following information:
Example
This example resets the lauchPermission attribute:
$ ec2-reset-image-attribute ami-6ba54002 -l
launchPermission ami-6ba54002 RESET
Related Topics
• ResetImageAttribute
• ec2-modify-image-attribute
• ec2-describe-image-attribute
• Sharing AMIs
ec2-revoke
Syntax
ec2-revoke group [-P protocol] (-p port_range | -t icmp_type_code) [-u
source_group_user ...] [-o source_group ...] [-s source_subnet ...]
Description
Revokes a rule from the security group named GROUP. To identify the rule to be removed you must
provide exactly the same set of options used to create that rule (see ec2-add-group).
Options
Option Description Required
group The group to which this rule will apply. Yes
Example: webservers
-p port_range For the TCP or UDP protocols, this specifies the Yes
range of ports to revoke. You specify a single integer
or a range (min-max).
Condition: Applies when specifying a CIDR subnet
as the source.
Example: -p 80
-t icmp_type_code For the ICMP protocol, you must specify the ICMP Yes
type and code. Use the type:code format, where both
are integers. To specify a wildcard for either or both,
enter -1.
API Version 2008-02-01
200
Amazon Elastic Compute Cloud Developer Guide
ec2-revoke
Output
A table containing the following information is returned:
Example
This example revokes TCP port 80 access from the 205.192.0.0/16 address range for the websrv
security group:
$ ec2-revoke websrv -P tcp -p 80 -s 205.192.0.0/16
GROUP websrv ""
PERMISSION websrv ALLOWS tcp 80 80 FROM CIDR 205.192.0.0/16
Related Topics
• RevokeSecurityGroupIngress
• ec2-add-group
• ec2-describe-group
• ec2-delete-group
• ec2-authorize
ec2-run-instances
Syntax
ec2-run-instances ami_id [-n instance_count] [-g group [-g group ...]] [-k
keyname] [-d user_data | -f user_data_file] [ --addressing addressing_type] [
--instance-type instance_type] [ --availability-zone zone] [ --kernel
kernel_id] [ --ramdisk ramdisk_id] [
--block-device-mappingblock_device_mapping]
Description
Launches one or more instances of the specified AMI.
Every instance is launched in a security group. If you do not specify a security group at launch, the
instances start in your default security group. For more information on creating security groups, see
CreateSecurityGroup.
An optional instance type can be specified. For information about instance types, see Instance Types.
You can provide an optional key pair ID for each image in the launch request (see CreateKeyPair. All
instances that are created from images that use this key pair will have access to the associated public key
at boot. You can use this key to provide secure access to an instance of an image on a per-instance basis.
Amazon EC2 public images use this feature to provide secure access without passwords.
Important
Launching public images without a key pair ID will leave them inaccessible.
The public key material is made available to the instance at boot time by placing it in the
openssh_id.pub file on a logical device that is exposed to the instance as /dev/sda2 (the ephemeral
store). The format of this file is suitable for use as an entry within ~/.ssh/authorized_keys (the
OpenSSH format). This can be done at boot (e.g., as part of rc.local) allowing for secure access
without passwords.
Optional user data can be provided in the launch request. All instances comprising the launch request
have access to this data (see Instance Metadata for details).
Note
If the AMI has a Amazon DevPay product code attached for which the user has not
subscribed, the ec2-run-instances call will fail.
Options
Option Description Required
ami_id The identifier that was assigned to the AMI when it Yes
API Version 2008-02-01
202
Amazon Elastic Compute Cloud Developer Guide
ec2-run-instances
Output
Amazon EC2 returns a table that contains the following information:
Example
This example launches five instances of the ami-6ba54002 AMI:
$ ec2-run-instances ami-6ba54002 -n 5 --availability-zone us-east-1a --
RESERVATION r-0ea54067 495219933132 default
INSTANCE i-3ea74257 ami-6ba54002 pending 0 m1.small 2007-07-11T16:40:44+0000
us-east-1a
INSTANCE i-31a74258 ami-6ba54002 pending 1 m1.small 2007-07-11T16:40:44+0000
us-east-1a
INSTANCE i-31a74259 ami-6ba54002 pending 2 m1.small 2007-07-11T16:40:44+0000
us-east-1a
INSTANCE i-31a7425a ami-6ba54002 pending 3 m1.small 2007-07-11T16:40:44+0000
us-east-1a
INSTANCE i-31a7425b ami-6ba54002 pending 4 m1.small 2007-07-11T16:40:44+0000
us-east-1a
INSTANCE i-31a7425c ami-6ba54002 pending 5 m1.small 2007-07-11T16:40:44+0000
us-east-1a
Related Topics
• RunInstances
• ec2-terminate-instances
• ec2-describe-instances
• ec2-add-keypair
• Instance Metadata
ec2-terminate-instances
Syntax
ec2-terminate-instances instance_id [instance_id ...]
Description
Terminates the specified instances.
Options
Option Description Required
instance_id ID of the instance that was assigned at lauch. Yes
Example: i-3ea74257
Output
Amazon EC2 returns a table that contains the following information:
Example
This example terminates the i-3ea74257 instance:
$ ec2-terminate-instances i-3ea74257
INSTANCE i-3ea74257 running shutting-down
Related Topics
• TerminateInstances
• ec2-run-instances
• ec2-describe-instances
Technical FAQ
Topics
• General Information
• Operation Information
• Instance Types and Architectures
• IP Information
• Availability Zones
• Monitoring, Errors, and Unexpected Behavior
• Error Messages
• Paid AMIs
• Miscellaneous
General Information
How many instances can I launch?
Each user has a concurrent running instance limit. For new users, this limit is 20. If you need more than
20 instances, please complete the Amazon EC2 Instance Request Form and your request will be
considered.
When you sign up with Amazon Web Services, you are provided an AWS Account ID. This is your
username. For more information, refer to the Amazon Elastic Compute Cloud Getting Started Guide.
Amazon EC2 must move the images around the network before they can be launched. For big images
and/or congested networks, this can take several minutes. To improve performance, images are cached.
As you launch your images more frequently, it should be less noticeable.
Instance stores appear to an instance as a local disk. They will survive intentional and unintentional
reboots of the instance unless the instance terminates or the underlying drive fails.
What happens to my running instances if the machines on which they are running go down?
The instances will terminate and will need to be relaunched. The data on the instances' hard drives will
be lost.
Not at present. You can use the SOAP API, Query API, or the command-line tools.
With a service as flexible as Amazon EC2, you can use many types of load balancing systems. The load
balancing instances can forward traffic to other systems. There are several open source solutions that are
in wide use.
Yes. Periodically, Amazon might perform maintenance that requires a reboot of your system. Make sure
your instances can recover and restart after being rebooted.
Operation Information
How do I handle time synchronization between instances?
You can set up NTP (Network Time Protocol). For more information, go to www.ntp.org. NTP is
particularly important if you plan on using any Amazon web services (such as Amazon S3 or
Amazon EC2) from within an instance, since requests to these services must be timestamped.
From within your instance you can use REST-like queries to http://169.254.169.254/2008-02-01/ to
retrieve various instance-specific metadata, including the instance ID. For more information, see
Instance Metadata.
Yes, although the size of the data is limited to 16K. For more information, see Instance Metadata.
Not with any reliability. Amazon EC2 tries to shut an instance down cleanly (running system shutdown
scripts), but there is only a short time available. In some cases (e.g., hardware failure), this does not
happen.
Since there is no way to ensure shutdown scripts run, have a strategy to deal with abnormal
terminations.
You can allow other users to launch your AMIs by modifying the AMI's launchPermission attribute.
You can grant public launch permissions or explicit permissions to specific users. For more information,
see Sharing AMIs.
Why do I need to reregister a rebundled AMI? Can I keep the same AMI ID?
An AMI ID is associated with the physical bits in an image. To protect users from images being
modified, we require you to reregister AMIs after rebundling.
Yes. By setting the environment variable EC2_JVM_ARGS, you can pass arbitrary JVM properties to the
command line tools.
Yes. By passing in JVM properties through the EC2_JVM_ARGS environment variable, you can specify
proxy settings for the command line tools. For example, in Linux:
export EC2_JVM_ARGS="-Dhttp.proxyHost=http://my.proxy.com -Dht
tp.proxyPort=8080"
Setting Description
https.proxyHost HTTPS proxy host
https.proxyPort HTTPS proxy port
http.proxyHost HTTPS proxy host
http.proxyPort HTTPS proxy port
http.proxyRealm Proxy realm (https and http)
http.proxyUser Proxy username (https and http)
http.proxyPass Proxy password (https and http)
Note
The original instance type is still available. It is called the small instance (m1.small) and it has the same
technical specifications.
If I do not specify an instance type at launch, what type of instance will I get?
Does my instance limit apply to all instance types or is there a separate limit for each type?
The instance limit applies to the sum of all instances, regardless of type. There is no separate instance
limit per type.
Can I mix instance types, or do I have to use the same type for all of my instances?
You can launch any combination of instance types. Choose the instance types that have the most
appropriate memory, CPU, and storage for each function within your application.
The small instance (m1.small) is 32-bit. The large (m1.large) and extra large (m1.xlarge) instances are
64-bit.
No. You must use 64-bit AMIs on large (m1.large) and extra large (m1.xlarge) instances and 32-bit
AMIs on small Instances (m1.small).
Not at present. However, as of version 2008-02-01 of the Amazon EC2 API you can use any of the
kernels published by Amazon EC2 or selected vendors.
Can I build an AMI that works on both 32-bit and 64-bit instances?
You can run a 32-bit application on a 64-bit host if the Linux kernel is compiled with IA32 emulation
and the correct 32-bit libraries are available.
By default, the Amazon DomU Kernel has IA32 emulation enabled and there are many public AMIs that
include pre-installed 32-bit libraries. If the library you require is not included with the AMI, you can
install it using standard tools (e.g., yum).
The large and extra large instances have higher and more consistent I/O performance than the original
(small) instance.
Note
The first write to any given block of the disk will be slower than subsequent writes. For
more information, see Disk Performance Optimization
Can I RAID the spindles exposed on large and extra large instances?
Yes, you can use software RAID on top of the exposed spindles.
Note
The initial RAID setup might take a long time. For more information, see Disk
Performance Optimization
IP Information
How do I host a public domain if I have to DHCP an IP address?
You can use a dynamic DNS service, such as DynDNS or ZoneEdit. Alternatively, you can map an
elastic IP address to your instance and avoid the propagation delays possible with a dynamic DNS
solution.
Why do I get an internal (RFC 1918) IP address when I look up a DNS name that I expect to map to my
instance's external IP address?
The Amazon EC2 DNS servers return the internal IP address when asked about an instance's public
DNS name. In this way, DNS lookups that would resolve to a public Amazon EC2 IP address will be
translated to the correct internal IP address. This only works when using the Amazon EC2 DNS servers
from an Amazon EC2 instance.
Public IP space is a limited resource. Amazon EC2 is adopting NAT to ensure that we are able to
efficiently make use of our public Internet addresses.
Furthermore, the new NAT networking will enable Amazon to deliver new features in the future. For
example, some users might not want external addresses. This would allow for non-Internet routable
clusters, which will further preserve IPs and increase security for those not running public facing
servers.
Not at present. Your image must be configured as a DHCP client and it will be assigned an IP address.
Currently, all instances come with Internet- addressable IP addresses. If you enable access through the
firewall from the "world", you can address them from anywhere.
How does the instance know its public and private addresses?
curl http://169.254.169.254/2008-02-01//meta-data/public-ipv4
Public (IPV4) Internet addresses are a scarce public resource. Amazon EC2 is committed to helping use
that space efficiently.
By default, all accounts are limited to 5 elastic IP addresses. If you need more than 5 Elastic IP
addresses, please complete the Amazon EC2 Elastic IP Address Request Form. We will ask you to think
through your use case and help us understand your need for additional addresses.
Unlike a traditional dedicated IP addresses, an elastic IP can be assigned to many different instances
over time.
When operating within the 5 address limit, you can leave addresses unattached as you need. However,
we reserve the right to reclaim elastic IP addresses that are chronically underutilized.
To ensure our customers are efficiently using elastic IP addresses, we impose the a small hourly charge
when these IP addresses are not mapped to an instance. When these IP addresses are mapped to an
instance, they are free of charge. To avoid charges for elastic IP addresses that you are not using, use
ReleaseAddress.
Do I need one elastic IP address for every instance that I have running?
You do not need an elastic IP address for all your instances. By default, every instance comes with a
private IP address and an Internet routable public IP address. These addresses are fixed for the life of the
instance. We believe this should be adequate for many applications where you do not need a long lived
Internet routable end point (e.g., compute clusters, web crawling, and backend services).
Because of the scarcity of IPV4 Internet address, Amazon EC2 will be actively investigating the use of
IPV6 addresses. We believe this is the only tenable long term solution. We don't yet have a timeline for
introducing IPV6 addresses, but when we do support IPV6 addresses, we will be able to remove the
friction we have imposed with IPV4 address.
You cannot currently launch an instance without a public IP address. We understand that for many
applications, it is desirable to have no Internet routable IP address (e.g., internal databases).
After you successfully make an API call to remap an IP address, it will usually occur within a few
minutes.
Will I be charged for the time when my IP address is unattached because my instance failed?
You are not charged until your elastic IP address has been unattached for a full hour. As long as you are
monitoring your instances, you will have plenty of time to reattach your instance before the charge is
metered.
No. The first 100 remaps per account are free. After that, there will be a charge for each remap.
Availability Zones
Can I assume that my availability zone us-east-1a is the same location as someone else's availability
zone us-east-1a?
No. Currently, we do not support cross-account proximity. Each account's availability zones are
independent. There is no assurance that your availability zone us-east-1a will be the same as any other
account's availability zone us-east-1a.
How can I make sure that I am in the same availability zone as another developer?
We do not currently support the ability to coordinate availability groups between developer accounts.
We are seeking customer feedback to understand the types of use cases for proximity control between
accounts. We will use this feedback to determine how and when we can provide availability zone
control between accounts.
Do I get double charged for regional data transfer? Why do you meter regional data transfer on both
the sender and the receiver?
The cost of regional data transfer is divided between the sender and the receiver and each instance will
accrue half the cost. This is useful when a transfer involves multiple accounts as each account is equally
charged.
Regional data transfer seems like such a small charge, why are you complicating my bill with this?
We anticipate that for most common use cases, regional data transfer will only constitute a very small
portion of your monthly usage charges. There are valid use cases that involve moving large amounts of
data between availability zones. In these cases, the regional data transfer can be a significant cost.
We try to enable as many use cases as possible while charging you only for what you use. Because of
the large potential differences in the way developers will use regional data transfer, we think it is
appropriate to break this cost out rather than amortize it across other charges.
Why does my account show that I am using regional data transfer but no associated charge?
Until recently, Amazon EC2 did not support availability zone control. Therefore, you might want to
relaunch your instances to arrange them for optimal cost effectiveness and availability. To give you time
to do this, regional data transfer activity shows up on your account, but does not accrue charges until
July 1, 2008.
Amazon EC2 provides basic monitoring. You can use DescribeInstances to check whether an instance
appears to be running. However, if you are using Amazon EC2 as your data center, you might want to
set up for sophisticated monitoring on your instances, such as SNMP.
There are a few common reasons for broken connectivity to your instance.
Amazon EC2 changes the state of your instance to running after your operating system starts booting.
Depending on your AMI, there will be a delay before the instance is fully set up and functional.
If your instance has been running for several minutes, you verify you authorized the appropriate access
to your host through the Amazon EC2 firewall. If you have launched your instances without specifying a
security group, the default group is used. Permissions on the default group are very strict and
disallow all access from the Internet and other groups. You will need to modify the permissions of your
default group or set up a new group with appropriate permissions. For more information, see
Network Security
If this doesn't solve your issue, make sure you authorized port 22 and try to open an SSH connection
with verbose output. Use the man page for the exact syntax of your system, but the command is likely to
be similar to ssh -vv root@[hostname]. This output is very useful if you are posting to the forum.
Launch errors can be the result of an internal error during launch or a corrupt Amazon EC2 image.
Internal errors are rare, as we actively test for and isolate suspect hosts. Consult the DescribeInstances
operation for details on why your instance failed to launch.
Note
The ec2-describe-instances command line tool does not provide this information.
Use the -v flag to read the detailed SOAP response and get detailed information.
You can also attempt to launch the image again. If this proves to be a persistent problem (especially with
a shared image), post to the AWS forums.
I ran shutdown from within an ssh session, but my instance still shows up as running when I query it
with DescribeInstances and I can't shell into it.
To shut down an instance, use the TerminateInstances call (ec2-terminate) on the command line.
You can also use shutdown -h, but must verify the instance shut down using the DescribeInstances
call.
This situation is rare and might be the result of a software error or misconfiguration.
Why do I get an "AuthFailure: User is not AMI creator" error when I try to register an image?
Make sure that you are using the correct user ID and certificate to create and upload the image. You
must use the same ID and certificate to register the image with Amazon EC2.
Error Messages
Why do I get an "InsufficientInstanceCapacity" error when I try to launch an instance?
This error indicates that we do not currently have enough available capacity to service your request.
If you are requesting a large number of instances, there might not be enough server capacity to host
them. You can try again later or specify a smaller number of instances.
This error indicates you reached your concurrent running instance limit. For new users during the public
beta, the limit is 20.
Why can't I retrieve my instance-specific data from within a running instance when querying
http://169.254.169.254/2008-02-01/?
The Parameterized Launches feature is available to instances that were launched after the feature was
released. If you launched your instance before this, the data will not be available. If you want to use this
functionality, relaunch your instances.
If, after relaunching your instance, you still experience problems retrieving the data, check the
following:
Note
Instance metadata is always available, even if you do not specify it at instance launch.
To reduce the risk of replay attacks, our requests include a timestamp. This and the most important parts
of the request are signed to ensure the message (including the timestamp) cannot be modified without
detection.
If the difference between the timestamp in the request and the time on our servers is larger than 5
minutes, the request is too old (or too new) and an error is returned.
You need to ensure that your system clock is accurate and configured to use the correct timezone. For
more information, go to NTP.
Paid AMIs
Note
You can still share AMIs without charging. Public and paid AMIs can be listed in the
Resource Center.
By describing images (ec2dim) with the "-a" flag and looking for AMIs that have a product code. For
example, if you run ec2dim -a, the result contains an AMI with the ID ami-bd9d78d4. This is our
Demo Paid AMI with product code A79EC0DB.
By describing images (ec2dim). An AMI is a paid AMI if a product code is returned. Example: run
ec2dim -a amazon, and the AMI ami-bd9d78d4 will be returned with a product code (A79EC0DB).
Is there anything that prevents a paid AMI from being rebundled? How can this be restricted?
Paid AMIs are comparable to shared AMIs with regards to rebundling and trying to restrict rebundling.
If you allow a user running the AMI to see all of its contents (e.g. by giving root access to the AMI), the
user could rebundle these into their own AMI.
Why can't I query a particular AMI's attributes to see if the AMI is paid?
Only the owner of an AMI can query the AMI attributes. However, anyone can tell if an AMI is paid by
describing images (ec2dim). An AMI is paid if a product code is returned. Example: run ec2dim -a
amazon, and the AMI with ID ami-bd9d78d4 will be returned with a product code (A79EC0DB).
Only the owner of the AMI can use this command. Owners use this command with supported AMIs to
determine if a supported instance with a given product code attached is up and running.
If your customer uses AWS tools to rebundle the AMI, the product code associated with the AMI is
inherited by the rebundled AMI. When launching the rebundled AMI the customer is still billed for
usage based on your price.
Note
This is a convenience feature and not a guarantee that the product code will always be
attached to rebundled AMIs.
Note that the customer's workflow could bundle the AMI outside of Amazon EC2, or the customer could
use modified versions of the AWS tools, preventing the product code from being inherited.
If you rebundle an AMI, it inherits the kernel and RAM disk from the source AMI unless you specify a
different kernel and RAM disk.
Note
This is a convenience feature and not a guarantee that the kernel/RAM disk will always be
attached to rebundled AMIs.
I created my paid AMIs with one AWS developer account, but I want to sell them using a different AWS
developer account. Can I transfer them?
No, you can't automatically transfer AMIs from one account to another. You would have to upload them
again using the second AWS developer account and then register them with DevPay using that account.
Alternately, you could leave the AMIs with the original account (the AMI owner account) and register
them with DevPay using another AWS developer account (the product owner account). You could then
use the AMI owner account to associate the product code with the AMIs. However, keep in mind that
only the product owner (and not the AMI owner in this case) can use the ec2-confirm-product-instance
command, which confirms that an instance is running an AMI associated with the product owner's
product code.
Amazon EC2 provides user selectable kernels which enables you to select a kernel when bundling an
AMI or launching an instance. User selectable kernels are useful for keeping your instances up to date
with security fixes and updates, being able to use functionality provided by new distributions, and for
using specialty applications that have unique timing requirements.
Use the DescribeInstances operation with the --kernel option. This lists all public kernels that are
currently available. After locating a kernel to launch or bundle with your AMI, go to the Resource
Center and search for it to determine whether there are any known issues and whether it has any
dependencies.
Not at present. However, as of version 2008-02-01 of the Amazon EC2 API you can use any of the
kernels published by Amazon EC2 or selected vendors.
Kernels are most likely to require a RAM disk that contains required drivers (e.g., Xen drivers, video
drivers, and so on). If you launch a kernel without a required RAM disk, it will not work properly.
If you are concerned about whether the kernel/image combination will work well together, Amazon
provides several AMIs that have tested combinations that you can use as a starting point for your AMIs
or AMIs that you can use as a foundations for a public AMIs. If you require a certified kernel/ AMI
combination, you can find them as paid AMIs through organizations such as RedHat. For more
information, see Paying for AMIs.
Miscellaneous
Are there any special requirements to use FTP?
The File Transfer Protocol (FTP) has a PORT command by which a client sends its address back to the
server. The server then connects to the client at that address to send the file data. If the client looks up its
own internal address and sends this to the server, the connection will fail. In this specific case, there are
two solutions to the problem. First, configure the client to send its public IP address. Second, the client
can use "passive FTP" which makes connections only to the server, rather than from the server to the
client. In general, applications which encode local addresses and port numbers in data sent to external
servers might have problems with NAT. Care must always be taken to send the public address, rather
than the internal one.
We recommend using passive mode unless it is not supported by the FTP server.
Glossary
Amazon machine image (AMI) An Amazon Machine Image (AMI) is an encrypted machine image
stored in Amazon S3. It contains all the information necessary to
boot instances of your software.
instance Once an AMI has been launched, the resulting running system is
referred to as an instance. All instances based on the same AMI start
out identical and any information on them is lost when the instances
are terminated or fail.
group Also known as a security group, groups define firewall rules that can
be shared among a group of instances that have similar security
requirements. The group is specified at instance launch.
public AMI An AMI that all users have launch permissions for.
shared AMI AMIs that developers build and make available for other AWS
developers to use.
Document Conventions
This section lists the common typographical and symbol use conventions for AWS technical
publications.
Typographical Conventions
This section describes common typographical use conventions.
Convention Description/Example
Call-outs A call-out is a number in the body text to give you a visual reference. The
reference point is for further discussion elsewhere.
You can use this resource regularly.
Code in text Inline code samples (including XML) and commands are identified with a
special font.
You can use the command java -version.
Code blocks Blocks of sample code are set apart from the body and marked accordingly.
# ls -l /var/www/html/index.html
-rw-rw-r-- 1 root root 1872 Jun 21 09:33 /
var/www/html/index.html
# date
Wed Jun 21 09:33:42 EDT 2006
Emphasis Unusual or important words and phrases are marked with a special font.
You must sign up for an account before you can use the service.
Logical values, A special font is used for expressions that are important to identify, but are
constants, and regular not code.
expressions, abstracta If the value is null, the returned response will be false.
Convention Description/Example
Product and feature Named AWS products and features are identified on first use.
names Create an Amazon Machine Image (AMI).
User entered values A special font marks text that the user types.
At the password prompt, type MyPassword.
User interface controls Denotes named items on the UI for easy identification.
and labels On the File menu, click Properties.
Variables When you see this style, you must change the value of the content when you
copy the text of a sample to a command line.
% ec2-register <your-s3-bucket>/image.manifest
See also the symbol convention below.
Symbol Conventions
This section describes the common use of symbols.
Optional [square brackets] Within a code description, square brackets denote completely
parameters optional commands or parameters.
XML variable
text % sed [-n, -quiet]
<CustomerId>[ID]</CustomerId>
Variables <arrow brackets> Within a code sample, arrow brackets denote a variable that
must be replaced with a valid value.
% ec2-register <your-s3-bucket>/image.manifest
CLI
ec2-add-group, 174
Index ec2-add-keypair, 171, 175
ec2-allocate-address, 176
ec2-associate-address, 177
A ec2-authorize, 178
actions, 68 ec2-bundle-image, 160
addressing, 53 ec2-bundle-vol, 163
AllocateAddress, 86, 122 ec2-confirm-product-instance, 180
allocating elastic IP addresses, 86, 122, 176 ec2-delete-bundle, 166
Amazon DevPay, 28 ec2-delete-group, 181
AMI tools ec2-delete-keypair, 182
ec2-add-keypair, 171 ec2-deregister, 183
ec2-bundle-image, 160 ec2-describe-addresses, 184
ec2-bundle-vol, 163 ec2-describe-availability-zones, 185
ec2-delete-bundle, 166 ec2-describe-group, 186
ec2-download-bundle, 168 ec2-describe-image-attribute, 187
ec2-unbundle, 169 ec2-describe-images, 189
AMIs ec2-describe-instances, 191
bundling, 18 ec2-describe-keypairs, 192
creating, 6 ec2-disassociate-address, 185
paid, 48 ec2-download-bundle, 168
shared, 47 ec2-fingerprint-key, 193
finding, 47 ec2-get-console-output, 194
security, 47 ec2-modify-image-attribute, 194
sharing, 21 ec2-reboot-instances, 196
API ec2-register, 198
actions, 68 ec2-release-address, 197
common data types, 73 ec2-reset-image-attribute, 199
conventions, 68 ec2-revoke, 200
data types, 69 ec2-run-instances, 202
Query, 64 ec2-terminate-instances, 205
reference, 68 ec2-unbundle, 169
SOAP, 61 list of operations, 173
APIs, using, 61 client error codes, 70
AssociateAddress, 86, 123 command line tools, 159
associating elastic IP addresses, 86, 123, 177 AMI tools, 160
audience, 2 API tools, 173
authentication errors, 159
Query, 65 options, 159
SOAP, 62 common data types, 73
AuthorizeSecurityGroupIngress, 87, 124 computation building block, 35
authorizing security group ingress, 87, 124, 178 compute resources, measuring, 37
availability zones, 45, 212 confirming instances, 89, 126, 180
describing, 96, 133, 185 ConfirmProductInstance, 89, 126
AvailabilityZoneItemType, 73 console output, 51
getting, 107, 144, 194
conventions
B API, 68
batch processing, 5 CPU, 37
best practices, 35 CreateKeyPair, 90, 127
block device mapping, 215 CreateSecurityGroup, 91, 129
BlockDeviceMappingItemType, 73 creating AMIs, 6
bundling AMIs, 18 creating keypairs, 90, 127
creating paid AMIs, 28
C
categories, 38 D
changes to Amazon EC2, 1 data retrieval, 39
LaunchPermissionOperationType, 78
G locality, 45
general information, 206
GetConsoleOutput, 107, 144 M
getopt, 159 mapping, block device, 215
getting console output, 107, 144, 194 memory, 37
glossary, 217 metadata, 37
groups, 57 categories, 38
GroupSetType, 76 retrieval, 39
miscellaneous FAQs, 216
I ModifyImageAttribute, 108, 145
modifying image attributes, 108, 145, 194
I/O resources, 37 monitoring information, 212
images
deregistering, 94, 132, 183
describing, 100, 137, 189 N
describing attributes, 97, 135, 187 NAT, 53
modifying attributes, 108, 145, 194 network security, 53
registering, 110, 149, 198 new features, 1
resetting attributes, 112, 150, 199
instance types, 208 O
instances
addressing, 53 operations
confirming, 89, 126, 180 CLI, 173
describing, 102, 139, 191 information, 207
launching, 35 Query, 85, 120, 121
metadata, 37 SOAP, 84
rebooting, 51, 109, 147, 196 output, console, 51
running, 115, 153, 202 overview, 5
security, 53
sizes, 36 P
storage, 43 paid AMIs
terminating, 119, 157, 205 creating, 28
types, 36 information, 214
usage, 35 Paid AMIs, 48
InstanceStateType, 76 parameters, Query, 120
introduction, 5 performance, optimization, 44
IP address information, 210 permissions, 35
IP addresses PlacementRequestType, 79
allocating, 86, 122, 176 PlacementResponseType, 79
associating, 86, 123, 177 private addresses, 53
describing, 95, 132, 184 ProductCodeItemType, 79
disassociating, 106, 143, 185 ProductInstanceResponseItemType, 80
releasing, 111, 148, 197 programming language support, 62
IpPermissionType, 77 proximity, 45, 212
public addresses, 53
K
kernels, 215 Q
keypairs Query
creating, 90, 127 AllocateAddress, 122
deleting, 92, 130, 182 API, 64
describing, 103, 140, 192 AssociateAddress, 123
authentication, 65
L AuthorizeSecurityGroupIngress, 124
launch data, security, 39 common parameters, 120
launch index, example, 41 ConfirmProductInstance, 126
LaunchPermissionItemType, 78 CreateKeyPair, 127
CreateSecurityGroup, 129
W
web services references, 64
WSDL, 61
Z
zones, availability, 212