subnets
Creates, updates, deletes, gets or lists a subnets
resource.
Overview
Name | subnets |
Type | Resource |
Id | linode.vpcs.subnets |
Fields
The following fields are returned by SELECT
queries:
- get_vpc_subnet
- get_vpc_subnets
A VPC Subnet object.
Name | Datatype | Description |
---|---|---|
id | integer | Filterable, Read-only The unique ID of the VPC Subnet. |
created | string (date-time) | Filterable, Read-only The date-time of VPC Subnet creation. (example: 2023-07-11T00:00:00) |
ipv4 | string (ip) | IPv4 range in CIDR canonical form. - The range must belong to a private address space as defined in RFC1918. - Allowed prefix lengths: 1-29. - The range must not overlap with 192.168.128.0/17. - The range must not overlap with other Subnets on the same VPC. (example: 10.0.1.0/24) |
label | string | Filterable The VPC Subnet's label, for display purposes only. - Must be unique among the VPC's Subnets. - Can only contain ASCII letters, numbers, and hyphens (- ). You can't use two consecutive hyphens (-- ). (example: cool-vpc-subnet) |
linodes | array | Read-only An array of Linode IDs assigned to the VPC Subnet. A Linode is assigned to a VPC Subnet if it has a Configuration Profile with a vpc purpose interface with the subnet's subnet_id . Even if the Configuration Profile is not active, meaning the Linode does not have access to the Subnet, the Linode still appears in this array. |
updated | string (date-time) | Filterable, Read-only The date-time of the most recent VPC Subnet update. (example: 2023-09-11T00:00:00) |
A paginated list of VPC Subnet objects.
Name | Datatype | Description |
---|---|---|
id | integer | Filterable, Read-only The unique ID of the VPC Subnet. |
created | string (date-time) | Filterable, Read-only The date-time of VPC Subnet creation. (example: 2023-07-11T00:00:00) |
ipv4 | string (ip) | IPv4 range in CIDR canonical form. - The range must belong to a private address space as defined in RFC1918. - Allowed prefix lengths: 1-29. - The range must not overlap with 192.168.128.0/17. - The range must not overlap with other Subnets on the same VPC. (example: 10.0.1.0/24) |
label | string | Filterable The VPC Subnet's label, for display purposes only. - Must be unique among the VPC's Subnets. - Can only contain ASCII letters, numbers, and hyphens (- ). You can't use two consecutive hyphens (-- ). (example: cool-vpc-subnet) |
linodes | array | Read-only An array of Linode IDs assigned to the VPC Subnet. A Linode is assigned to a VPC Subnet if it has a Configuration Profile with a vpc purpose interface with the subnet's subnet_id . Even if the Configuration Profile is not active, meaning the Linode does not have access to the Subnet, the Linode still appears in this array. |
updated | string (date-time) | Filterable, Read-only The date-time of the most recent VPC Subnet update. (example: 2023-09-11T00:00:00) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_vpc_subnet | select | Get information about a single VPC Subnet. Learn more... | ||
get_vpc_subnets | select | page , page_size | Get information about all VPC Subnets associated with a VPC. Learn more... | |
post_vpc_subnet | insert | data__ipv4 , data__label | Create a VPC Subnet. - The User accessing this operation must have read_write grants to the VPC.- A successful request triggers a subnet_create event.Once a VPC Subnet is created, it can be attached to a Linode by assigning the Subnet to one of the Linode's Configuration Profile Interfaces. This step can be accomplished with the following operations: - Create a Linode - Create a config profile - Update a config profile - Add a configuration profile interface Learn more... Learn more... | |
put_vpc_subnet | replace | Update a VPC Subnet. - The User accessing this operation must have read_write grants to the VPC.- A successful request triggers a subnet_update event.Learn more... Learn more... | ||
delete_vpc_subnet | delete | Delete a single VPC subnet. The user accessing this operation must have read_write grants to the VPC. A successful request triggers a subnet_delete event.> 📘 > > You need to delete all the Configuration Profile Interfaces that this subnet is assigned to before you can delete it. If those interfaces are active, the associated Linode needs to be shut down before they can be removed. Learn more... Learn more... |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
page | integer | The page of a collection to return. |
page_size | integer | The number of items to return per page. |
SELECT
examples
- get_vpc_subnet
- get_vpc_subnets
Get information about a single VPC Subnet.
Learn more...
SELECT
id,
created,
ipv4,
label,
linodes,
updated
FROM linode.vpcs.subnets;
Get information about all VPC Subnets associated with a VPC.
Learn more...
SELECT
id,
created,
ipv4,
label,
linodes,
updated
FROM linode.vpcs.subnets
WHERE page = '{{ page }}'
AND page_size = '{{ page_size }}';
INSERT
examples
- post_vpc_subnet
- Manifest
Create a VPC Subnet.
- The User accessing this operation must have read_write
grants to the VPC.
- A successful request triggers a subnet_create
event.
Once a VPC Subnet is created, it can be attached to a Linode by assigning the Subnet to one of the Linode's Configuration Profile Interfaces. This step can be accomplished with the following operations:
- Create a Linode
- Create a config profile
- Update a config profile
- Add a configuration profile interface
Learn more...
Learn more...
INSERT INTO linode.vpcs.subnets (
data__ipv4,
data__label
)
SELECT
'{{ ipv4 }}' --required,
'{{ label }}' --required
RETURNING
id,
created,
ipv4,
label,
linodes,
updated
;
# Description fields are for documentation purposes
- name: subnets
props:
- name: ipv4
value: string
description: >
IPv4 range in CIDR canonical form.
- The range must belong to a private address space as defined in [RFC1918](https://datatracker.ietf.org/doc/html/rfc1918).
- Allowed prefix lengths: 1-29.
- The range must not overlap with 192.168.128.0/17.
- The range must not overlap with other Subnets on the same VPC.
- name: label
value: string
description: >
__Filterable__ The VPC Subnet's label, for display purposes only.
- Must be unique among the VPC's Subnets.
- Can only contain ASCII letters, numbers, and hyphens (`-`). You can't use two consecutive hyphens (`--`).
REPLACE
examples
- put_vpc_subnet
Update a VPC Subnet.
- The User accessing this operation must have read_write
grants to the VPC.
- A successful request triggers a subnet_update
event.
Learn more...
Learn more...
REPLACE linode.vpcs.subnets
SET
data__label = '{{ label }}'
WHERE
RETURNING
id,
created,
ipv4,
label,
linodes,
updated;
DELETE
examples
- delete_vpc_subnet
Delete a single VPC subnet.
The user accessing this operation must have read_write
grants to the VPC. A successful request triggers a subnet_delete
event.
> 📘
>
> You need to delete all the Configuration Profile Interfaces that this subnet is assigned to before you can delete it. If those interfaces are active, the associated Linode needs to be shut down before they can be removed.
Learn more...
Learn more...
DELETE FROM linode.vpcs.subnets;