Dmitriy Samovskiy discovered that the startup time of an EC2 instance (not the latest boot time) is hidden in the “Last-Modified” header of the EC2 meta-data response. You can only query this from the instance itself, but this should perform better than querying the EC2 API, especially if you tend to use Amazon’s Java command line tools.
HEAD http://169.254.169.254/latest/meta-data/local-ipv4 | egrep ^Last-Modified: | cut -f2- -d' '
Dmitriy has published a short bash script to calculate the instance run time using this trick:
As he points out, this is not documented by AWS, so be careful assuming it will always behave this way.