I'm writing a bash script that needs to use the instance's public dns name. What's the easiest way to obtain it from inside the running instance?
You can fetch data about the running instance from a little http API using curl like this:
Other values you can fetch include:
There are more but those are some of the most useful. Things like the SSH keys you specify at instance launch can also be retrieved from there.