:doc:`MemoryDB <../../memorydb>` / Client / create_subnet_group

*******************
create_subnet_group
*******************



.. py:method:: MemoryDB.Client.create_subnet_group(**kwargs)

  

  Creates a subnet group. A subnet group is a collection of subnets (typically private) that you can designate for your clusters running in an Amazon Virtual Private Cloud (VPC) environment. When you create a cluster in an Amazon VPC, you must specify a subnet group. MemoryDB uses that subnet group to choose a subnet and IP addresses within that subnet to associate with your nodes. For more information, see `Subnets and subnet groups <https://docs.aws.amazon.com/MemoryDB/latest/devguide/subnetgroups.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/memorydb-2021-01-01/CreateSubnetGroup>`_  


  **Request Syntax**
  ::

    response = client.create_subnet_group(
        SubnetGroupName='string',
        Description='string',
        SubnetIds=[
            'string',
        ],
        Tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type SubnetGroupName: string
  :param SubnetGroupName: **[REQUIRED]** 

    The name of the subnet group.

    

  
  :type Description: string
  :param Description: 

    A description for the subnet group.

    

  
  :type SubnetIds: list
  :param SubnetIds: **[REQUIRED]** 

    A list of VPC subnet IDs for the subnet group.

    

  
    - *(string) --* 

    

  :type Tags: list
  :param Tags: 

    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.

    

  
    - *(dict) --* 

      A tag that can be added to an MemoryDB resource. Tags are composed of a Key/Value pair. You can use tags to categorize and track all your MemoryDB resources. When you add or remove tags on clusters, those actions will be replicated to all nodes in the cluster. A tag with a null Value is permitted. For more information, see `Tagging your MemoryDB resources <https://docs.aws.amazon.com/MemoryDB/latest/devguide/tagging-resources.html>`__

      

    
      - **Key** *(string) --* 

        The key for the tag. May not be null.

        

      
      - **Value** *(string) --* 

        The tag's value. May be null.

        

      
    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'SubnetGroup': {
              'Name': 'string',
              'Description': 'string',
              'VpcId': 'string',
              'Subnets': [
                  {
                      'Identifier': 'string',
                      'AvailabilityZone': {
                          'Name': 'string'
                      },
                      'SupportedNetworkTypes': [
                          'ipv4'|'ipv6'|'dual_stack',
                      ]
                  },
              ],
              'ARN': 'string',
              'SupportedNetworkTypes': [
                  'ipv4'|'ipv6'|'dual_stack',
              ]
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **SubnetGroup** *(dict) --* 

        The newly-created subnet group.

        
        

        - **Name** *(string) --* 

          The name of the subnet group

          
        

        - **Description** *(string) --* 

          A description of the subnet group

          
        

        - **VpcId** *(string) --* 

          The Amazon Virtual Private Cloud identifier (VPC ID) of the subnet group.

          
        

        - **Subnets** *(list) --* 

          A list of subnets associated with the 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 MemoryDB.

            
            

            - **Identifier** *(string) --* 

              The unique identifier for the subnet.

              
            

            - **AvailabilityZone** *(dict) --* 

              The Availability Zone where the subnet resides

              
              

              - **Name** *(string) --* 

                The name of the Availability Zone.

                
          
            

            - **SupportedNetworkTypes** *(list) --* 

              The network types supported by this subnet. Returns an array of strings that can include 'ipv4', 'ipv6', or both, indicating whether the subnet supports IPv4 only, IPv6 only, or dual-stack deployments.

              
              

              - *(string) --* 
          
        
      
        

        - **ARN** *(string) --* 

          The ARN (Amazon Resource Name) of the subnet group.

          
        

        - **SupportedNetworkTypes** *(list) --* 

          The network types supported by this subnet group. Returns an array of strings that can include 'ipv4', 'ipv6', or both, indicating the IP address types that can be used for clusters deployed in this subnet group.

          
          

          - *(string) --* 
      
    
  
  **Exceptions**
  
  *   :py:class:`MemoryDB.Client.exceptions.SubnetGroupAlreadyExistsFault`

  
  *   :py:class:`MemoryDB.Client.exceptions.SubnetGroupQuotaExceededFault`

  
  *   :py:class:`MemoryDB.Client.exceptions.SubnetQuotaExceededFault`

  
  *   :py:class:`MemoryDB.Client.exceptions.InvalidSubnet`

  
  *   :py:class:`MemoryDB.Client.exceptions.ServiceLinkedRoleNotFoundFault`

  
  *   :py:class:`MemoryDB.Client.exceptions.SubnetNotAllowedFault`

  
  *   :py:class:`MemoryDB.Client.exceptions.TagQuotaPerResourceExceeded`

  