We're using amazon EC2 and we want to keep track of instaces. Is the Amazon EC2 instance-id unique forever? i.e. If a VM has an instance id of i-12345678 is there a guarantee that when that instance terminates, that instance id won't ever be used again?
I asked Amazon, and this was their answer:
"Instance ids are unique. You'll never receive a duplicate id. However, the current format of the instance id is an implementation detail that is subject to change. If you use the instance id as a string, you should be fine."
It's important to note that you will never receive the same ID twice. However, since you can't connect to other people's instances, this will probably be sufficient.
I think @jedberg's answer is the right one. However, I would also point you to this article: https://web.archive.org/web/20160407141803/http://www.jackofallclouds.com/2009/09/anatomy-of-an-amazon-ec2-resource-id/
which has a very in-depth analysis (albeit with some guesswork) of how Amazon ID's are constructed. The guy who wrote it doesn't work for Amazon, but you can tell he did his homework :-). IMO it's worth the read just for informational purposes.