Getting error while deleting my VPC.

0 votes
AttributeError: 'ec2.ServiceResource' object has no attribute 'delete_vpc'

This is the error I am getting.

I am using the following code:

import boto3
ec2 = boto3.resource('ec2')
ec2client.delete_vpc(VpcId = 'vpc-id')

Can someone help me with this?

Dec 4, 2018 in AWS by Kanishk
• 850 points
32 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

This is the code to delete the VPC. Make sure you don't delete the default VPC as it is created by Amazon and can't be recreated by you.

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

This way you can delete the vpc. Hope this helps

answered Dec 4, 2018 by Shuvodip Ghosh

Related Questions In AWS

0 votes
1 answer

Getting Error 503 when I using my site via DNS

add the server_name directive to your Nginx ...READ MORE

answered Apr 25, 2018 in AWS by Cloud gunner
• 4,240 points
55 views
0 votes
1 answer
0 votes
1 answer

AWS S3 CLI : error while trying to copy files locally using terminal

For the first error you should add ...READ MORE

answered Aug 3, 2018 in AWS by Archana
• 3,770 points
609 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to delete a VPC using boto3?

You can view this answer here : https://www.edureka.co/community/32160/getting-error-while-deleting-my-vpc Before ...READ MORE

answered Dec 4, 2018 in AWS by Shuvodip Ghosh
162 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.