cache_subnet_groups
Creates, updates, deletes, gets or lists a cache_subnet_groups resource.
Overview
| Name | cache_subnet_groups |
| Type | Resource |
| Id | aws.elasticache.cache_subnet_groups |
Fields
The following fields are returned by SELECT queries:
- describe_cache_subnet_groups
| Name | Datatype | Description |
|---|---|---|
arn | string | The ARN (Amazon Resource Name) of the cache subnet group. |
cache_subnet_group_description | string | The description of the cache subnet group. |
cache_subnet_group_name | string | The name of the cache subnet group. |
subnets | string | A list of subnets associated with the cache subnet group. |
supported_network_types | string | Either 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_id | string | The Amazon Virtual Private Cloud identifier (VPC ID) of the cache subnet group. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_cache_subnet_groups | select | region | CacheSubnetGroupName, MaxRecords, Marker | 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. |
create_cache_subnet_group | insert | CacheSubnetGroupName, CacheSubnetGroupDescription, SubnetIds, region | Tags | Creates 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_group | update | CacheSubnetGroupName, region | CacheSubnetGroupDescription, SubnetIds | Modifies an existing cache subnet group. |
delete_cache_subnet_group | delete | CacheSubnetGroupName, region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
CacheSubnetGroupDescription | string | A description for the cache subnet group. |
CacheSubnetGroupName | string | The name of the cache subnet group to delete. Constraints: Must contain no more than 255 alphanumeric characters or hyphens. |
SubnetIds | array | A list of VPC subnet IDs for the cache subnet group. |
region | string | AWS region (default: us-east-1) |
CacheSubnetGroupDescription | string | A description of the cache subnet group. |
CacheSubnetGroupName | string | The name of the cache subnet group to return details for. |
Marker | string | An 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. |
MaxRecords | integer | The 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. |
SubnetIds | array | The EC2 subnet IDs for the cache subnet group. |
Tags | array | A 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
- describe_cache_subnet_groups
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
- create_cache_subnet_group
- Manifest
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
;
# Description fields are for documentation purposes
- name: cache_subnet_groups
props:
- name: CacheSubnetGroupName
value: "{{ CacheSubnetGroupName }}"
description: Required parameter for the cache_subnet_groups resource.
- name: CacheSubnetGroupDescription
value: "{{ CacheSubnetGroupDescription }}"
description: Required parameter for the cache_subnet_groups resource.
- name: SubnetIds
value: "{{ SubnetIds }}"
description: Required parameter for the cache_subnet_groups resource.
- name: region
value: "{{ region }}"
description: Required parameter for the cache_subnet_groups resource.
- name: Tags
value: "{{ Tags }}"
description: A 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.
description: A 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.
UPDATE examples
- modify_cache_subnet_group
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
- delete_cache_subnet_group
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
;