Skip to main content

db_subnet_groups

Creates, updates, deletes, gets or lists a db_subnet_groups resource.

Overview

Namedb_subnet_groups
TypeResource
Idaws.rds.db_subnet_groups

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
db_subnet_group_arnstringThe Amazon Resource Name (ARN) for the DB subnet group.
db_subnet_group_descriptionstringProvides the description of the DB subnet group.
db_subnet_group_namestringThe name of the DB subnet group.
subnet_group_statusstringProvides the status of the DB subnet group.
subnetsstringContains a list of Subnet elements. The list of subnets shown here might not reflect the current state of your VPC. For the most up-to-date information, we recommend checking your VPC configuration directly.
supported_network_typesstringThe network type of the DB subnet group. Valid values: IPV4 DUAL A DBSubnetGroup can support only the IPv4 protocol or the IPv4 and the IPv6 protocols (DUAL). For more information, see Working with a DB instance in a VPC in the Amazon RDS User Guide.
vpc_idstringProvides the VpcId of the DB subnet group.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_db_subnet_groupsselectregionDBSubnetGroupName, Filters, MaxRecords, MarkerReturns a list of DBSubnetGroup descriptions. If a DBSubnetGroupName is specified, the list will contain only the descriptions of the specified DBSubnetGroup. For an overview of CIDR ranges, go to the Wikipedia Tutorial.
create_db_subnet_groupinsertDBSubnetGroupName, DBSubnetGroupDescription, SubnetIds, regionTagsCreates a new DB subnet group. DB subnet groups must contain at least one subnet in at least two AZs in the Amazon Web Services Region.
modify_db_subnet_groupupdateDBSubnetGroupName, SubnetIds, regionDBSubnetGroupDescriptionModifies an existing DB subnet group. DB subnet groups must contain at least one subnet in at least two AZs in the Amazon Web Services Region.
delete_db_subnet_groupdeleteDBSubnetGroupName, regionDeletes a DB subnet group. The specified database subnet group must not be associated with any DB instances.

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.

NameDatatypeDescription
DBSubnetGroupDescriptionstringThe description for the DB subnet group.
DBSubnetGroupNamestringThe name of the database subnet group to delete. You can't delete the default subnet group. Constraints: Must match the name of an existing DBSubnetGroup. Must not be default. Example: mydbsubnetgroup
SubnetIdsarrayThe EC2 subnet IDs for the DB subnet group.
regionstringAWS region (default: us-east-1)
DBSubnetGroupDescriptionstringThe description for the DB subnet group.
DBSubnetGroupNamestringThe name of the DB subnet group to return details for.
FiltersarrayThis parameter isn't currently supported.
MarkerstringAn optional pagination token provided by a previous DescribeDBSubnetGroups request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords.
MaxRecordsintegerThe maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a pagination token called a marker is included in the response so that you can retrieve the remaining results. Default: 100 Constraints: Minimum 20, maximum 100.
TagsarrayTags to assign to the DB subnet group.

SELECT examples

Returns a list of DBSubnetGroup descriptions. If a DBSubnetGroupName is specified, the list will contain only the descriptions of the specified DBSubnetGroup. For an overview of CIDR ranges, go to the Wikipedia Tutorial.

SELECT
db_subnet_group_arn,
db_subnet_group_description,
db_subnet_group_name,
subnet_group_status,
subnets,
supported_network_types,
vpc_id
FROM aws.rds.db_subnet_groups
WHERE region = '{{ region }}' -- required
AND DBSubnetGroupName = '{{ DBSubnetGroupName }}'
AND Filters = '{{ Filters }}'
AND MaxRecords = '{{ MaxRecords }}'
AND Marker = '{{ Marker }}'
;

INSERT examples

Creates a new DB subnet group. DB subnet groups must contain at least one subnet in at least two AZs in the Amazon Web Services Region.

INSERT INTO aws.rds.db_subnet_groups (
DBSubnetGroupName,
DBSubnetGroupDescription,
SubnetIds,
region,
Tags
)
SELECT
'{{ DBSubnetGroupName }}',
'{{ DBSubnetGroupDescription }}',
'{{ SubnetIds }}',
'{{ region }}',
'{{ Tags }}'
RETURNING
db_subnet_group_arn,
db_subnet_group_description,
db_subnet_group_name,
subnet_group_status,
subnets,
supported_network_types,
vpc_id
;

UPDATE examples

Modifies an existing DB subnet group. DB subnet groups must contain at least one subnet in at least two AZs in the Amazon Web Services Region.

UPDATE aws.rds.db_subnet_groups
SET
-- No updatable properties
WHERE
DBSubnetGroupName = '{{ DBSubnetGroupName }}' --required
AND SubnetIds = '{{ SubnetIds }}' --required
AND region = '{{ region }}' --required
AND DBSubnetGroupDescription = '{{ DBSubnetGroupDescription}}'
RETURNING
db_subnet_group_arn,
db_subnet_group_description,
db_subnet_group_name,
subnet_group_status,
subnets,
supported_network_types,
vpc_id;

DELETE examples

Deletes a DB subnet group. The specified database subnet group must not be associated with any DB instances.

DELETE FROM aws.rds.db_subnet_groups
WHERE DBSubnetGroupName = '{{ DBSubnetGroupName }}' --required
AND region = '{{ region }}' --required
;