AWS::EC2::VPCDHCPOptionsAssociation - AWS CloudFormation

AWS::EC2::VPCDHCPOptionsAssociation

Associates a set of DHCP options with a 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.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::EC2::VPCDHCPOptionsAssociation", "Properties" : { "DhcpOptionsId" : String, "VpcId" : String } }

YAML

Type: AWS::EC2::VPCDHCPOptionsAssociation Properties: DhcpOptionsId: String VpcId: String

Properties

DhcpOptionsId

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

Required: Yes

Type: String

Update requires: Replacement

VpcId

The ID of the VPC.

Required: Yes

Type: String

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ID of the DHCP options association.

For more information about using the Ref function, see Ref.

Examples

VPC DHCP options association

The following example uses the Ref intrinsic function to associate the myDHCPOptions DHCP options with the myVPC VPC. The VPC and DHCP options can be declared in the same template or added as input parameters. For more information about the VPC or the DHCP options resources, see AWS::EC2::VPC or AWS::EC2::DHCPOptions.

JSON

"myVPCDHCPOptionsAssociation" : { "Type" : "AWS::EC2::VPCDHCPOptionsAssociation", "Properties" : { "VpcId" : {"Ref" : "myVPC"}, "DhcpOptionsId" : {"Ref" : "myDHCPOptions"} } }

YAML

myVPCDHCPOptionsAssociation: Type: AWS::EC2::VPCDHCPOptionsAssociation Properties: VpcId: Ref: myVPC DhcpOptionsId: Ref: myDHCPOptions

See also