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.

Creates a set of DHCP options for your VPC. After creating the set, you must associate it with the VPC, causing all existing and new instances that you launch in the VPC to use this set of DHCP options. The following are the individual DHCP options you can specify. For more information about the options, see RFC 2132.

Your VPC automatically starts out with a set of DHCP options that includes only a DNS server that we provide (AmazonProvidedDNS). If you create a set of options, and if your VPC has an internet gateway, make sure to set the domain-name-servers option either to AmazonProvidedDNS or to a domain name server of your choice. For more information, see DHCP options sets in the Amazon Virtual Private Cloud User Guide.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to CreateDhcpOptionsAsync.

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

Syntax

C#
public virtual CreateDhcpOptionsResponse CreateDhcpOptions(
         CreateDhcpOptionsRequest request
)

Parameters

request
Type: Amazon.EC2.Model.CreateDhcpOptionsRequest

Container for the necessary parameters to execute the CreateDhcpOptions service method.

Return Value


The response from the CreateDhcpOptions service method, as returned by EC2.

Examples

This example creates a DHCP options set.

To create a DHCP options set


var client = new AmazonEC2Client();
var response = client.CreateDhcpOptions(new CreateDhcpOptionsRequest 
{
    DhcpConfigurations = new List<DhcpConfiguration> {
        new DhcpConfiguration {
            Key = "domain-name-servers",
            Values = new List<string> {
                "10.2.5.1",
                "10.2.5.2"
            }
        }
    }
});

DhcpOptions dhcpOptions = response.DhcpOptions;

            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

See Also