deleteVpc

inline suspend fun Ec2Client.deleteVpc(crossinline block: DeleteVpcRequest.Builder.() -> Unit): DeleteVpcResponse

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 VPC's default security group, network ACL, and route table.

Samples


fun main() { 
   //sampleStart 
   // This example deletes the specified VPC.
ec2Client.deleteVpc {
    vpcId = "vpc-a01106c2"
} 
   //sampleEnd
}