I am able to spin-off an Amazon EC2 cluster with 5 nodes. Now I have to install some package on it. I have written a script which takes list of IP addresses and installs that package on those machines. The script to install the package is ready and working.
Right now I am creating the list of IP address manually, like going to the Amazon Management Console and click on each node and get the Public DNS Name/IP (duh!). I would like to automate this part as soon I will need to spin-off clusters of few hundred nodes and manually retrieving 100s IP address is painful.
So in short, is there a way by which I can get public IP address of all the nodes in my cluster? Some command-line script would be ideal I guess.
How can software determine the public and private IP addresses of the Amazon EC2 instance that it is running on? Query the appropriate Amazon CloudWatch metric. Use ipconfig or ifconfig command. Query the local instance userdata.
You should probably use AWS CLI:
aws ec2 describe-instances --query "Reservations[*].Instances[*].PublicIpAddress" --output text
This should give you a list of public IPs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With