Associate Address operation
The Associate Address 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 a new instance. This is an idempotent operation (produces the same results no matter how many times it is performed). If you perform the operation more than once, Amazon EC2 does not return an error.
The following figure shows a sample <items> XML element for the Associate Address operation.
Sample <items> XML element for the Associate Address operation
<item>
<parameters>
<public-ip></public-ip>
<instance-id></instance-id>
</parameters>
</item>
</items>
The following table describes the adapter request elements for this request.
Adapter request elements for the Associate Address operation
Element | Definition | Required |
|---|---|---|
<wsdl-location> | Specifies the target Web Service Description Language (WSDL) URL for Amazon EC2 | Conditional:
|
<endpoint-address> | Specifies the web service endpoint for the adapter to use while performing operations on Amazon EC2 instances across different regions | No |
<signature-properties> | Specifies the mode for signing the adapter request | Conditional:
|
<operation-name> | Contains the name of the operation: associate-address | Yes |
<public-ip> | Specifies the IP address that you assign to the instance | Yes |
<instance-id> | Specifies the instance to associate with the IP address | Yes |
The following figure shows a sample adapter request for the Associate Address operation.
Sample adapter request for the Associate Address operation
<wsdl-location>http://ec2.amazonaws.com/doc/2009-11-30/</wsdl-location>
<endpoint-address>http://us-east-1.ec2.amazonaws.com/</endpoint-address>
<signature-properties mode = "key-files">
<private-key-file>C:\Security\
pk-MJ5GIUNLM2XJ3VRJSYTKOFDWILELDQHB.PEM</private-key-file>
<certificate-file>C:\Security\
cert-MJ5GIUNLM2XJ3VRJSYTKOFDWILELDQHB.PEM</certificate-file>
</signature-properties>
<operation-name>associate-address</operation-name>
<parameters>
<public-ip>184.73.215.42</public-ip>
<instance-id>i-edd49186</instance-id>
</parameters>
</amazon-ec2-request>
The following figure shows the response for the sample adapter request for the Associate Address operation.
Sample adapter response for the Associate Address operation
<metadata>
<status>success</status>
</metadata>
<AssociateAddressResponse>
<requestId>d417e51b-80a7-49eb-8fdc-45b6fbd89189</requestId>
<return>true</return>
</AssociateAddressResponse>
</amazon-ec2-response>