TravisThomas
TravisThomas

Reputation: 631

What is EC2 previous-instance-id?

admin@ip-172-34-40-199:/var/lib/cloud/data> cat previous-instance-id
i-08070b6e274c5abc6
admin@ip-172-34-40-199:/var/lib/cloud/data> cat instance-id
i-0d865c5d95798349b

My understanding is that instance ids are supposed to be stable. I've found no reference to them changing. The instance that this is from, I just launched moments ago.

Upvotes: 1

Views: 167

Answers (2)

Sam Hartman
Sam Hartman

Reputation: 6489

Instance IDs are stable within the lifetime of an instance. However you can move a volume from one instance to another, or turn a volume into an AMI and launch it as a new instance. Cloud-init is keeping track of the previous instance ID (pnrobably from when this image was originally created) to know if it should run the firstboot and other tasks that are run once per instance.

Upvotes: 1

TravisThomas
TravisThomas

Reputation: 631

The AMI that was the source for these instances was generated from a different instance.

Ie. i-08070b6e274c5abc6 was used to generate ami-deadbeef, then i-0d865c5d95798349b was started from ami-deadbeef. All instances started from that AMI will share the same previous-instance-id.

Upvotes: 1

Related Questions