I am trying to make use of Amazon's elasticity and bring instances online and off using the AWS cli
. But as you know, every time you offline a system, and bring it back to life, it comes with a new IP address. I have AWS-cli
package installed on my Centos 6 server, located elsewhere. I have been researching this for days now and am not able to find a working command, that I can issue from my Centos box and get the IP address of the instance at Amazon EC2. EC2 instance is up and running.
Most relevant information I found was
aws ec2 describe-instances
but all I am getting back from this command is something like a usage syntax output. I also found (and promptly lost) a switch --query
followed by a set of keywords to extract this information. But that command gave me a response, saying --query
is not a recognized argument. I checked the Amazon's cli reference for this command and only parameter it seems to accept is --filter
and examples are way far from being helpful.
Does anyone know how to accomplish this ?
EDIT More on the issue I discovered over the weekend. Before my attempt to get the Public DNS info from the instance, I need a way to connect to this instance. I am unable to get information about the instances I have, no matter what I do:
$ ec2-describe-instances i-b78a096f
sanity-check: Your system clock is 50 seconds behind.
+----------------------------+---------------------------------------------+
| Code | Message |
+----------------------------+---------------------------------------------+
| InvalidInstanceID.NotFound | The instance ID 'i-b78a096f' does not exist |
+----------------------------+---------------------------------------------+
I know that my AWS_ACCESS_KEY
and AWS_SECRET_KEY
variables are correctly assigned to their proper variable names. The instance id has been copied and pasted from the AWS management console. To test, I spun up a new instance and tested the same command against it, with no different result. Although, when I run ec2-describe-regions
command, I can see the regions list available to me with no problems. I am dumbfounded right now.