Skip to main content

cache_subnet_groups

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

Overview

Namecache_subnet_groups
TypeResource
Idaws.elasticache.cache_subnet_groups

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe ARN (Amazon Resource Name) of the cache subnet group.
cache_subnet_group_descriptionstringThe description of the cache subnet group.
cache_subnet_group_namestringThe name of the cache subnet group.
subnetsstringA list of subnets associated with the cache subnet group.
supported_network_typesstringEither ipv4 | ipv6 | dual_stack. IPv6 is supported for workloads using Valkey 7.2 and above, Redis OSS engine version 6.2 to 7.1 or Memcached engine version 1.6.6 and above on all instances built on the Nitro system.
vpc_idstringThe Amazon Virtual Private Cloud identifier (VPC ID) of the cache subnet group.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_cache_subnet_groupsselectregionCacheSubnetGroupName, MaxRecords, MarkerReturns a list of cache subnet group descriptions. If a subnet group name is specified, the list contains only the description of that group. This is applicable only when you have ElastiCache in VPC setup. All ElastiCache clusters now launch in VPC by default.
create_cache_subnet_groupinsertCacheSubnetGroupName, CacheSubnetGroupDescription, SubnetIds, regionTagsCreates a new cache subnet group. Use this parameter only when you are creating a cluster in an Amazon Virtual Private Cloud (Amazon VPC).
modify_cache_subnet_groupupdateCacheSubnetGroupName, regionCacheSubnetGroupDescription, SubnetIdsModifies an existing cache subnet group.
delete_cache_subnet_groupdeleteCacheSubnetGroupName, regionDeletes a cache subnet group. You cannot delete a default cache subnet group or one that is associated with any clusters.

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
CacheSubnetGroupDescriptionstringA description for the cache subnet group.
CacheSubnetGroupNamestringThe name of the cache subnet group to delete. Constraints: Must contain no more than 255 alphanumeric characters or hyphens.
SubnetIdsarrayA list of VPC subnet IDs for the cache subnet group.
regionstringAWS region (default: us-east-1)
CacheSubnetGroupDescriptionstringA description of the cache subnet group.
CacheSubnetGroupNamestringThe name of the cache subnet group to return details for.
MarkerstringAn optional marker returned from a prior request. Use this marker for pagination of results from this operation. 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 marker is included in the response so that the remaining results can be retrieved. Default: 100 Constraints: minimum 20; maximum 100.
SubnetIdsarrayThe EC2 subnet IDs for the cache subnet group.
TagsarrayA list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

SELECT examples

Returns a list of cache subnet group descriptions. If a subnet group name is specified, the list contains only the description of that group. This is applicable only when you have ElastiCache in VPC setup. All ElastiCache clusters now launch in VPC by default.

SELECT
arn,
cache_subnet_group_description,
cache_subnet_group_name,
subnets,
supported_network_types,
vpc_id
FROM aws.elasticache.cache_subnet_groups
WHERE region = '{{ region }}' -- required
AND CacheSubnetGroupName = '{{ CacheSubnetGroupName }}'
AND MaxRecords = '{{ MaxRecords }}'
AND Marker = '{{ Marker }}'
;

INSERT examples

Creates a new cache subnet group. Use this parameter only when you are creating a cluster in an Amazon Virtual Private Cloud (Amazon VPC).

INSERT INTO aws.elasticache.cache_subnet_groups (
CacheSubnetGroupName,
CacheSubnetGroupDescription,
SubnetIds,
region,
Tags
)
SELECT
'{{ CacheSubnetGroupName }}',
'{{ CacheSubnetGroupDescription }}',
'{{ SubnetIds }}',
'{{ region }}',
'{{ Tags }}'
RETURNING
arn,
cache_subnet_group_description,
cache_subnet_group_name,
subnets,
supported_network_types,
vpc_id
;

UPDATE examples

Modifies an existing cache subnet group.

UPDATE aws.elasticache.cache_subnet_groups
SET
-- No updatable properties
WHERE
CacheSubnetGroupName = '{{ CacheSubnetGroupName }}' --required
AND region = '{{ region }}' --required
AND CacheSubnetGroupDescription = '{{ CacheSubnetGroupDescription}}'
AND SubnetIds = '{{ SubnetIds}}'
RETURNING
arn,
cache_subnet_group_description,
cache_subnet_group_name,
subnets,
supported_network_types,
vpc_id;

DELETE examples

Deletes a cache subnet group. You cannot delete a default cache subnet group or one that is associated with any clusters.

DELETE FROM aws.elasticache.cache_subnet_groups
WHERE CacheSubnetGroupName = '{{ CacheSubnetGroupName }}' --required
AND region = '{{ region }}' --required
;