Problem scenario
You are trying to terminate some EC-2 instances. But you see a message like this:
"AttributeError: 'ec2.ServiceResource' object has no attribute 'terminate_instances'"
"AttributeError: 'ec2.ServiceResource' object has no attribute 'destroy_instances'"
"AttributeError: 'ec2.ServiceResource' object has no attribute 'delete_instances'"
What should you do?
Solution
Rewrite the terminate portion to look like this:
ec2.instances.filter(InstanceIds=['i-0abcd1234', 'i-0wxyz9999']).terminate()