I have a group of EC2 instances in a security group. I am looking for a way to obtain a list of their public DNS address's from command line. I have a script that uses RSYNC to make sure a set of files is updated across these servers. They are in an elastic load balancer and the amount of servers in the group changes enough that I do not want to have to maintain the list by hand. I want to avoid using AWK or SED to pull information out of ec2-describes-instances, I'd prefer to use the API directly. Anybody have any great suggestions? :)
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
The command line output format is pretty static, and you can control when it might changed because the toolkit is your hands. I keep a copy of the api tools in a versioned repository along with whatever software I've written that uses it, this way they always work together at a given version. If you do decide to go this way, here is a simple grab to get the public DNS address of everything running. Obviously you could request this for a specific group too.
|
|||
|
|
Incase anybody is searching for a solution, I ended up using Amazon's PHP SDK. It allows you to filter results by many different criteria. I simply did a describe instance request, filtering by a specific security group (where security-group-name is the one you want to search for!)
|
|||||
|