Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (790 points)
I am not able to figure out the code

1 Answer

0 votes
by (1.4k points)

You will require a list of the instances you want to delete and then pass it as an argument in your code.

I will provide the syntax for the code bit for this purpose :

import boto3
ids = ['i-1','i-2','i-3','i-4','i-5']
ec2 = boto3.resource('ec2')
ec2.instances.filter(InstanceIds = ids).terminate()


Hope this helps!

You can learn more about EC2 instances through this video :

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...