dhcp_options
Creates, updates, deletes or gets a dhcp_option resource or lists dhcp_options in a region
Overview
| Name | dhcp_options |
| Type | Resource |
| Description | Resource Type definition for AWS::EC2::DHCPOptions |
| Id | awscc.ec2.dhcp_options |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
dhcp_options_id | string | |
domain_name | string | This value is used to complete unqualified DNS hostnames. |
domain_name_servers | array | The IPv4 addresses of up to four domain name servers, or AmazonProvidedDNS. |
netbios_name_servers | array | The IPv4 addresses of up to four NetBIOS name servers. |
netbios_node_type | integer | The NetBIOS node type (1, 2, 4, or 8). |
ntp_servers | array | The IPv4 addresses of up to four Network Time Protocol (NTP) servers. |
ipv6_address_preferred_lease_time | integer | The preferred Lease Time for ipV6 address in seconds. |
tags | array | Any tags assigned to the DHCP options set. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
dhcp_options_id | string | |
region | string | AWS region. |
For more information, see AWS::EC2::DHCPOptions.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | dhcp_options | INSERT | region |
delete_resource | dhcp_options | DELETE | Identifier, region |
update_resource | dhcp_options | UPDATE | Identifier, PatchDocument, region |
list_resources | dhcp_options_list_only | SELECT | region |
get_resource | dhcp_options | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual dhcp_option.
SELECT
region,
dhcp_options_id,
domain_name,
domain_name_servers,
netbios_name_servers,
netbios_node_type,
ntp_servers,
ipv6_address_preferred_lease_time,
tags
FROM awscc.ec2.dhcp_options
WHERE
region = '{{ region }}' AND
Identifier = '{{ dhcp_options_id }}';
Lists all dhcp_options in a region.
SELECT
region,
dhcp_options_id
FROM awscc.ec2.dhcp_options_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new dhcp_option resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.dhcp_options (
DomainName,
DomainNameServers,
NetbiosNameServers,
NetbiosNodeType,
NtpServers,
Ipv6AddressPreferredLeaseTime,
Tags,
region
)
SELECT
'{{ domain_name }}',
'{{ domain_name_servers }}',
'{{ netbios_name_servers }}',
'{{ netbios_node_type }}',
'{{ ntp_servers }}',
'{{ ipv6_address_preferred_lease_time }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ec2.dhcp_options (
DomainName,
DomainNameServers,
NetbiosNameServers,
NetbiosNodeType,
NtpServers,
Ipv6AddressPreferredLeaseTime,
Tags,
region
)
SELECT
'{{ domain_name }}',
'{{ domain_name_servers }}',
'{{ netbios_name_servers }}',
'{{ netbios_node_type }}',
'{{ ntp_servers }}',
'{{ ipv6_address_preferred_lease_time }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: dhcp_option
props:
- name: domain_name
value: '{{ domain_name }}'
- name: domain_name_servers
value:
- '{{ domain_name_servers[0] }}'
- name: netbios_name_servers
value:
- '{{ netbios_name_servers[0] }}'
- name: netbios_node_type
value: '{{ netbios_node_type }}'
- name: ntp_servers
value:
- '{{ ntp_servers[0] }}'
- name: ipv6_address_preferred_lease_time
value: '{{ ipv6_address_preferred_lease_time }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a dhcp_option resource, using stack-deploy.
/*+ update */
UPDATE awscc.ec2.dhcp_options
SET PatchDocument = string('{{ {
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ dhcp_options_id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.dhcp_options
WHERE
Identifier = '{{ dhcp_options_id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the dhcp_options resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
ec2:CreateDhcpOptions,
ec2:DescribeDhcpOptions,
ec2:CreateTags
ec2:DescribeDhcpOptions,
ec2:DescribeTags
ec2:CreateTags,
ec2:DescribeDhcpOptions,
ec2:DeleteTags
ec2:DeleteDhcpOptions,
ec2:DeleteTags,
ec2:DescribeDhcpOptions
ec2:DescribeDhcpOptions