VPCDHCPOptionsAssociation
The VPCDHCPOptionsAssociation resource allows you to associate DHCP options with your Amazon Virtual Private Cloud (VPC). For more details, refer to the AWS EC2 VPCDHCPOptionsAssociations documentation.
Minimal Example
Section titled “Minimal Example”This example demonstrates how to create a basic VPCDHCPOptionsAssociation with required properties.
import AWS from "alchemy/aws/control";
const dhcpOptionsAssociation = await AWS.EC2.VPCDHCPOptionsAssociation("defaultDhcpOptionsAssociation", { VpcId: "vpc-0abcd1234efgh5678", DhcpOptionsId: "dopt-0abcd1234efgh5678", adopt: false // Default is false; this will fail if the resource already exists});
Advanced Configuration
Section titled “Advanced Configuration”This example shows how to create a VPCDHCPOptionsAssociation while adopting an existing resource.
const existingDhcpOptionsAssociation = await AWS.EC2.VPCDHCPOptionsAssociation("existingDhcpOptionsAssociation", { VpcId: "vpc-0abcd1234efgh5678", DhcpOptionsId: "dopt-0abcd1234efgh5678", adopt: true // Set to true to adopt if the resource already exists});
Use Case: Updating DHCP Options
Section titled “Use Case: Updating DHCP Options”In this example, you can see how to update the DHCP options associated with a VPC by creating a new association.
const updatedDhcpOptionsAssociation = await AWS.EC2.VPCDHCPOptionsAssociation("updatedDhcpOptionsAssociation", { VpcId: "vpc-0abcd1234efgh5678", DhcpOptionsId: "dopt-0ijkl9012mnop3456", adopt: false // This will create a new association});