We're working on setting up an auto-scalable web service on AWS. One of our requirements is that we can reload the web server configuration via SSH. Usually, this isn't very hard, as it's only a matter of executing

ssh user@webserver "service apache2 reload"

The problem is that, when you auto-scale the web servers, you don't know how many servers are up and, most importantly, what the IP addresses are. So we need a way of getting a list of IP addresses currently spun up in the auto-scaling group.

I've checked out AWS CLI's describe-auto-scaling-instances command, but that only gives me the instance IDs. AFAIK, there is no way of getting the IP associated with that ID.

I tried searching the AWS API docs for clues, but to no avail.

Is there anyone here who knows of a clean way to do this? The alternative would be that the servers check themselves in at a central server when they boot up, and check themselves out when they spin down. However, this is error-prone, and requires a central server which isn't highly available and frankly a bit of wasteful to use for only this purpose...


Apparently I was being blind. The AWS API for EC2 instances does list the IP address when issued the describe-instances command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.