ElastiCache / Client / describe_cache_subnet_groups

describe_cache_subnet_groups#

ElastiCache.Client.describe_cache_subnet_groups(**kwargs)#

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.

See also: AWS API Documentation

Request Syntax

response = client.describe_cache_subnet_groups(
    CacheSubnetGroupName='string',
    MaxRecords=123,
    Marker='string'
)
Parameters:
  • CacheSubnetGroupName (string) – The name of the cache subnet group to return details for.

  • 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.

  • 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.

Return type:

dict

Returns:

Response Syntax

{
    'Marker': 'string',
    'CacheSubnetGroups': [
        {
            '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) –

    Represents the output of a DescribeCacheSubnetGroups operation.

    • Marker (string) –

      Provides an identifier to allow retrieval of paginated results.

    • CacheSubnetGroups (list) –

      A list of cache subnet groups. Each element in the list contains detailed information about one group.

      • (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.

              • (string) –

        • 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.

          • (string) –

Exceptions

  • ElastiCache.Client.exceptions.CacheSubnetGroupNotFoundFault

Examples

Describes up to 25 cache subnet groups.

response = client.describe_cache_subnet_groups(
    MaxRecords=25,
)

print(response)

Expected Output:

{
    'CacheSubnetGroups': [
        {
            'CacheSubnetGroupDescription': 'Default CacheSubnetGroup',
            'CacheSubnetGroupName': 'default',
            'Subnets': [
                {
                    'SubnetAvailabilityZone': {
                        'Name': 'us-east-1a',
                    },
                    'SubnetIdentifier': 'subnet-1a2b3c4d',
                },
                {
                    'SubnetAvailabilityZone': {
                        'Name': 'us-east-1c',
                    },
                    'SubnetIdentifier': 'subnet-a1b2c3d4',
                },
                {
                    'SubnetAvailabilityZone': {
                        'Name': 'us-east-1e',
                    },
                    'SubnetIdentifier': 'subnet-abcd1234',
                },
                {
                    'SubnetAvailabilityZone': {
                        'Name': 'us-east-1b',
                    },
                    'SubnetIdentifier': 'subnet-1234abcd',
                },
            ],
            'VpcId': 'vpc-91280df6',
        },
    ],
    'Marker': '',
    'ResponseMetadata': {
        '...': '...',
    },
}