How to delete a VPC using boto3

0 votes
I have created a VPC. But using same process I am not able to delete it. Can someone help me with the code?
Dec 4, 2018 in AWS by Kanishk
• 890 points
2,442 views

1 answer to this question.

0 votes

You can view this answer here :

https://www.edureka.co/community/32160/getting-error-while-deleting-my-vpc

Before deleting the VPC successfully you must delete all the dependencies related to the VPC. eg: Internet Gateway, Subnets, Route Tables, etc

The code I used is as follows:

import boto3
ec2 = boto3.resource('ec2')
ec2client = ec2.meta.client
ec2client.delete_vpc(VpcId = 'vpc-01fca2f1bae08f4be')

Once you are done with this, you can run the above code and it works fine

answered Dec 4, 2018 by Shuvodip Ghosh

Related Questions In AWS

0 votes
1 answer

How to create subnets in a vpc using boto3?

Here is the simple way of implementing ...READ MORE

answered Dec 5, 2018 in AWS by Shuvodip Ghosh
4,062 views
0 votes
1 answer

Unable to delete subnets in a VPC using boto3.

.terminate is used for instances and not ...READ MORE

answered Dec 5, 2018 in AWS by Shuvodip Ghosh
626 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Getting error while deleting my VPC.

This is the code to delete the ...READ MORE

answered Dec 4, 2018 in AWS by Shuvodip Ghosh
960 views
0 votes
1 answer

How to delete all the subnets from a VPC using boto3?

You can refer to this question here: https://www.edureka.co/community/32182/unable-to-delete-subnets-in-a-vpc-using-boto3 You ...READ MORE

answered Dec 5, 2018 in AWS by Shuvodip Ghosh
1,540 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP