Skip to content

EC2  >  Operations  >  delete_vpc

delete_vpc

Operation

delete_vpc async

delete_vpc(input: DeleteVpcInput, plugins: list[Plugin] | None = None) -> DeleteVpcOutput

Deletes the specified VPC. You must detach or delete all gateways and resources that are associated with the VPC before you can delete it. For example, you must terminate all instances running in the VPC, delete all security groups associated with the VPC (except the default one), delete all route tables associated with the VPC (except the default one), and so on. When you delete the VPC, it deletes the default security group, network ACL, and route table for the VPC.

If you created a flow log for the VPC that you are deleting, note that flow logs for deleted VPCs are eventually automatically removed.

Parameters:

Name Type Description Default
input DeleteVpcInput

An instance of DeleteVpcInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
DeleteVpcOutput

An instance of DeleteVpcOutput.

Input

DeleteVpcInput dataclass

Bases: _SerdeShape

Dataclass for DeleteVpcInput structure.

Attributes

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

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.

vpc_id class-attribute instance-attribute
vpc_id: str | None = ...

The ID of the VPC.

Output

DeleteVpcOutput dataclass

Bases: _SerdeShape

Dataclass for DeleteVpcOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.