Skip to content
GitHubXDiscord

DHCPOptions

The DHCPOptions resource allows you to manage AWS EC2 DHCPOptions for configuring DHCP settings in your VPC.

Create a basic DHCPOptions resource with essential properties such as domain name and DNS servers.

import AWS from "alchemy/aws/control";
const dhcpOptions = await AWS.EC2.DHCPOptions("basicDhcpOptions", {
DomainName: "example.local",
DomainNameServers: ["192.168.1.1", "192.168.1.2"],
Tags: [
{ Key: "Environment", Value: "Development" }
]
});

Configure a DHCPOptions resource with additional settings, including NTP servers and NetBIOS options.

const advancedDhcpOptions = await AWS.EC2.DHCPOptions("advancedDhcpOptions", {
DomainName: "example.local",
DomainNameServers: ["192.168.1.1", "192.168.1.2"],
NtpServers: ["ntp.example.local"],
NetbiosNameServers: ["192.168.1.3"],
NetbiosNodeType: 8,
Ipv6AddressPreferredLeaseTime: 300,
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Department", Value: "IT" }
]
});

Demonstrate how to create a DHCPOptions resource with custom NetBIOS settings.

const customNetbiosDhcpOptions = await AWS.EC2.DHCPOptions("customNetbiosDhcpOptions", {
DomainName: "custom.local",
DomainNameServers: ["10.0.0.1"],
NetbiosNameServers: ["10.0.0.2"],
NetbiosNodeType: 4,
Tags: [
{ Key: "Project", Value: "Migration" }
]
});

Show how to adopt existing DHCPOptions instead of creating a new one.

const adoptExistingDhcpOptions = await AWS.EC2.DHCPOptions("existingDhcpOptions", {
DomainName: "existing.local",
DomainNameServers: ["10.0.1.1"],
adopt: true
});