ElastiCache.Client.
create_cache_subnet_group
(**kwargs)¶Creates a new cache subnet group.
Use this parameter only when you are creating a cluster in an Amazon Virtual Private Cloud (Amazon VPC).
See also: AWS API Documentation
Request Syntax
response = client.create_cache_subnet_group(
CacheSubnetGroupName='string',
CacheSubnetGroupDescription='string',
SubnetIds=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
[REQUIRED]
A name for the cache subnet group. This value is stored as a lowercase string.
Constraints: Must contain no more than 255 alphanumeric characters or hyphens.
Example: mysubnetgroup
[REQUIRED]
A description for the cache subnet group.
[REQUIRED]
A list of VPC subnet IDs for the cache subnet group.
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.
A tag that can be added to an ElastiCache cluster or replication group. Tags are composed of a Key/Value pair. You can use tags to categorize and track all your ElastiCache resources, with the exception of global replication group. When you add or remove tags on replication groups, those actions will be replicated to all nodes in the replication group. A tag with a null Value is permitted.
The key for the tag. May not be null.
The tag's value. May be null.
dict
Response Syntax
{
'CacheSubnetGroup': {
'CacheSubnetGroupName': 'string',
'CacheSubnetGroupDescription': 'string',
'VpcId': 'string',
'Subnets': [
{
'SubnetIdentifier': 'string',
'SubnetAvailabilityZone': {
'Name': 'string'
},
'SubnetOutpost': {
'SubnetOutpostArn': 'string'
},
'SupportedNetworkTypes': [
'ipv4'|'ipv6'|'dual_stack',
]
},
],
'ARN': 'string',
'SupportedNetworkTypes': [
'ipv4'|'ipv6'|'dual_stack',
]
}
}
Response Structure
(dict) --
CacheSubnetGroup (dict) --
Represents the output of one of the following operations:
CreateCacheSubnetGroup
ModifyCacheSubnetGroup
CacheSubnetGroupName (string) --
The name of the cache subnet group.
CacheSubnetGroupDescription (string) --
The description of the cache subnet group.
VpcId (string) --
The Amazon Virtual Private Cloud identifier (VPC ID) of the cache subnet group.
Subnets (list) --
A list of subnets associated with the cache subnet group.
(dict) --
Represents the subnet associated with a cluster. This parameter refers to subnets defined in Amazon Virtual Private Cloud (Amazon VPC) and used with ElastiCache.
SubnetIdentifier (string) --
The unique identifier for the subnet.
SubnetAvailabilityZone (dict) --
The Availability Zone associated with the subnet.
Name (string) --
The name of the Availability Zone.
SubnetOutpost (dict) --
The outpost ARN of the subnet.
SubnetOutpostArn (string) --
The outpost ARN of the subnet.
SupportedNetworkTypes (list) --
Either ipv4
| ipv6
| dual_stack
. IPv6 is supported for workloads using Redis engine version 6.2 onward or Memcached engine version 1.6.6 on all instances built on the Nitro system.
ARN (string) --
The ARN (Amazon Resource Name) of the cache subnet group.
SupportedNetworkTypes (list) --
Either ipv4
| ipv6
| dual_stack
. IPv6 is supported for workloads using Redis engine version 6.2 onward or Memcached engine version 1.6.6 on all instances built on the Nitro system.
Exceptions
ElastiCache.Client.exceptions.CacheSubnetGroupAlreadyExistsFault
ElastiCache.Client.exceptions.CacheSubnetGroupQuotaExceededFault
ElastiCache.Client.exceptions.CacheSubnetQuotaExceededFault
ElastiCache.Client.exceptions.TagQuotaPerResourceExceeded
ElastiCache.Client.exceptions.InvalidSubnet
ElastiCache.Client.exceptions.SubnetNotAllowedFault
Examples
Creates a new cache subnet group.
response = client.create_cache_subnet_group(
CacheSubnetGroupDescription='Sample subnet group',
CacheSubnetGroupName='my-sn-grp2',
SubnetIds=[
'subnet-6f28c982',
'subnet-bcd382f3',
'subnet-845b3e7c0',
],
)
print(response)
Expected Output:
{
'CacheSubnetGroup': {
'CacheSubnetGroupDescription': 'My subnet group.',
'CacheSubnetGroupName': 'my-sn-grp',
'Subnets': [
{
'SubnetAvailabilityZone': {
'Name': 'us-east-1a',
},
'SubnetIdentifier': 'subnet-6f28c982',
},
{
'SubnetAvailabilityZone': {
'Name': 'us-east-1c',
},
'SubnetIdentifier': 'subnet-bcd382f3',
},
{
'SubnetAvailabilityZone': {
'Name': 'us-east-1b',
},
'SubnetIdentifier': 'subnet-845b3e7c0',
},
],
'VpcId': 'vpc-91280df6',
},
'ResponseMetadata': {
'...': '...',
},
}