Dawny33
Dawny33

Reputation: 11081

AWS EC2 terminate command giving "Service ec2 not available" error from Ansible

I am running this command aws ec2 terminate-instances --instance-ids $(ec2metadata --instance-id) in Ubuntu via Ansible as root.

And I'm getting this error:

"stderr": "Service ec2 not available in region aws-east-1"

What does this mean? Does it mean that I can't terminate instances in the region aws-east-1?

But, when I run that command manually in the cmd, it terminates well! How do I solve this?

Upvotes: 1

Views: 209

Answers (1)

E.J. Brennan
E.J. Brennan

Reputation: 46869

In the credentials/config file on your ubuntu instance, do you have the region set to aws-east-1 instead of us-east-1? aws-east-1 is not a valid region.

Upvotes: 3

Related Questions