21

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?

1
  • I think @jedberg's answer is the right one. However, I would also point you to this article: web.archive.org/web/20160407141803/http://… 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. Sep 29, 2009 at 20:47

2 Answers 2

27

This has been asked on the Amazon Forum, and this was their answer:

Instance IDs are uniquely generated globally, which means for every region and for every account, and are unable to be reused again.

8
  • 1
    And if you get a duplicate instance ID, it is a bug and you should report it to Amazon immediately.
    – jtimberman
    Sep 9, 2009 at 7:21
  • I don't know what they're actually doing, but this would fit the current 32-bit version: preshing.com/20121224/… (see section "A Non-Repeating Pseudo-Random Number Generator"). Then, when they get to the end, they can shift to something else (more bits, different digits ([g-v] instead of [0-9a-f], for example), something).
    – lindes
    May 6, 2015 at 23:53
  • 1
    @lindes: I would guess 32 bit is a bit more of instances than ANY customer can launch in their life. You probably missed the second sentence of the amazon answer. They reuse instance ids immediately on other accounts. So if you have two accounts and use both you can actually get duplicates.
    – John
    Sep 25, 2016 at 22:01
  • @john: Ahh. That seems maybe-implied in the quoted section from Amazon, and it is stated in the next paragraph from jedberg... Is that confirmed, though? I could easily read the from-Amazon text as implying globally-unique, as well; it's not explicit on that point.
    – lindes
    Sep 30, 2016 at 17:37
  • 1
    @lindes: The ID is definitely not globally unique. Amazon has told me they are not globally unique and I've personally seen duplicates in different accounts. The new IDs may be globally unique for now, but I wouldn't depend on that to always be the case.
    – jedberg
    Oct 1, 2016 at 21:28
-1

I couldn't find anything online, but I wouldn't count on guaranteed uniqueness, even if the current format would accommodate >4 billion IDs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .