Menu
Amazon Elastic Compute Cloud
API Reference (API Version 2016-11-15)

AllocateAddress

Acquires an Elastic IP address.

An Elastic IP address is for use either in the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.

Domain

Set to vpc to allocate the address for use with instances in a VPC.

Default: The address is for use with instances in EC2-Classic.

Type: String

Valid Values: vpc | standard

Required: No

DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No

Response Elements

The following elements are returned by the service.

allocationId

[EC2-VPC] The ID that AWS assigns to represent the allocation of the Elastic IP address for use with instances in a VPC.

Type: String

domain

Indicates whether this Elastic IP address is for use with instances in EC2-Classic (standard) or instances in a VPC (vpc).

Type: String

Valid Values: vpc | standard

publicIp

The Elastic IP address.

Type: String

requestId

The ID of the request.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

Examples

Example for EC2-Classic

This example request allocates an Elastic IP address for use with instances in EC2-Classic.

Sample Request

Copy
https://ec2.amazonaws.com/?Action=AllocateAddress &AUTHPARAMS

Sample Response

Copy
<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <publicIp>192.0.2.1</publicIp> <domain>standard</domain> </AllocateAddressResponse>

Example for EC2-VPC

This example request allocates an Elastic IP address for use with instances in a VPC.

Sample Request

Copy
https://ec2.amazonaws.com/?Action=AllocateAddress Domain=vpc &AUTHPARAMS

Sample Response

Copy
<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <publicIp>198.51.100.1</publicIp> <domain>vpc</domain> <allocationId>eipalloc-5723d13e</allocationId> </AllocateAddressResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: