/// <summary> /// Initializes the Amazon EC2 client object and then calls the /// DeleteVpcAsync method to delete the VPC. /// </summary> public static async Task Main() { string vpcId = "vpc-0e304cc1627062b88"; // If your Amazon EC2 VPC is not defined in the same AWS Region as // the default AWS user on your system, you need to supply the AWS // Region as a parameter to the client constructor. var client = new AmazonEC2Client(); var request = new DeleteVpcRequest { VpcId = vpcId, }; var response = await client.DeleteVpcAsync(request); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine($"Successfully deleted VPC with ID: {vpcId}."); } }
/** * Deletes VPC by VPC Id * * @param vpcId * VPC id */ public Task deleteVpcAsync(String vpcId) { return(_ec2Client.DeleteVpcAsync(new DeleteVpcRequest { VpcId = vpcId })); }