Amazon Elastic Compute Cloud
API Reference (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

AssociateDhcpOptions

Description

Associates a set of DHCP options (that you've previously created) with the specified VPC. Or, associates no DHCP options with the VPC.

After you associate the options with the VPC, any existing instances and all new instances that you launch in that VPC use the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. If you want, you can explicitly renew the lease using the operating system on the instance.

For more information about the supported DHCP options and using them with a VPC, see Using DHCP Options in Your VPC in the Amazon Virtual Private Cloud User Guide.

Request Parameters

DhcpOptionsId

The ID of the DHCP options you want to associate with the VPC, or default if you want the VPC to use no DHCP options.

Type: String

Default: None

Required: Yes

VpcId

The ID of the VPC to associate the DHCP options with.

Type: String

Default: None

Required: Yes

Response Elements

The following elements are returned in an AssociateDhcpOptionsResponse element.

requestId

The ID of the request.

Type: xsd:string

return

Returns true if the request succeeds. Otherwise, returns an error.

Type: xsd:boolean

Examples

Example Request

This example associates the DHCP options with ID dopt-7a8b9c2d with the VPC with ID vpc-1a2b3c4d.

https://ec2.amazonaws.com/?Action=AssociateDhcpOptions 
&DhcpOptionsId=dopt-7a8b9c2d
&VpcId=vpc-1a2b3c4d
&AUTHPARAMS

Example Response

<AssociateDhcpOptionsResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
   <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
   <return>true</return> 
</AssociateDhcpOptionsResponse>

Example Request

This example changes the VPC with ID vpc-1a2b3c4d to use no DHCP options.

https://ec2.amazonaws.com/?Action=AssociateDhcpOptions 
&DhcpOptionsId=default
&VpcId=vpc-1a2b3c4d
&AUTHPARAMS

Example Response

<AssociateDhcpOptionsResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
   <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
   <return>true</return> 
</AssociateDhcpOptionsResponse>