AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the AssociateDhcpOptions operation. 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. You can explicitly renew the lease using the operating system on the instance.

For more information, see DHCP option sets in the Amazon VPC User Guide.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.EC2.AmazonEC2Request
      Amazon.EC2.Model.AssociateDhcpOptionsRequest

Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public class AssociateDhcpOptionsRequest : AmazonEC2Request
         IAmazonWebServiceRequest

The AssociateDhcpOptionsRequest type exposes the following members

Constructors

NameDescription
Public Method AssociateDhcpOptionsRequest()

Empty constructor used to set properties independently even when a simple constructor is available

Public Method AssociateDhcpOptionsRequest(string)

Instantiates AssociateDhcpOptionsRequest with the parameterized properties

Properties

NameTypeDescription
Public Property DhcpOptionsId System.String

Gets and sets the property DhcpOptionsId.

The ID of the DHCP options set, or default to associate no DHCP options with the VPC.

Public Property VpcId System.String

Gets and sets the property VpcId.

The ID of the VPC.

Examples

This example associates the specified DHCP options set with the specified VPC.

To associate a DHCP options set with a VPC


var client = new AmazonEC2Client();
var response = client.AssociateDhcpOptions(new AssociateDhcpOptionsRequest 
{
    DhcpOptionsId = "dopt-d9070ebb",
    VpcId = "vpc-a01106c2"
});


            

This example associates the default DHCP options set with the specified VPC.

To associate the default DHCP options set with a VPC


var client = new AmazonEC2Client();
var response = client.AssociateDhcpOptions(new AssociateDhcpOptionsRequest 
{
    DhcpOptionsId = "default",
    VpcId = "vpc-a01106c2"
});


            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5