:doc:`EC2 <../../ec2>` / Client / delete_subnet

*************
delete_subnet
*************



.. py:method:: EC2.Client.delete_subnet(**kwargs)

  

  Deletes the specified subnet. You must terminate all running instances in the subnet before you can delete the subnet.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/DeleteSubnet>`_  


  **Request Syntax**
  ::

    response = client.delete_subnet(
        SubnetId='string',
        DryRun=True|False
    )
    
  :type SubnetId: string
  :param SubnetId: **[REQUIRED]** 

    The ID of the subnet.

    

  
  :type DryRun: boolean
  :param DryRun: 

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is ``DryRunOperation``. Otherwise, it is ``UnauthorizedOperation``.

    

  
  
  :returns: None

  **Examples**

  This example deletes the specified subnet.
  ::

    response = client.delete_subnet(
        SubnetId='subnet-9d4a7b6c',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  