AWS EC2 is an Infrastructure as a Service (IaaS). One of the common requirement that I get is to identify the creation time of an EC2 instance. On examining the AWS EC2 console, if we describe an EC2 instance, we can see a parameter launch time. People generally get confused with this parameter and consider this as the creation time of the EC2 instance. But in the reality, launch time is not the creation time of EC2 instance. This launch time gets updated every time when we stop and start the instance.
When an EC2 instance gets stopped, the compute engine / the real virtual machine behind the EC2 instance gets deallocated and only the persistent storage remains running. So every time when we stop and start an EC2 instance, internally it launches a new virtual machine and attaches the same storage and configuration. So the launch time gets updates with the time at which we start the instance after keeping the instance in the stopped state.
What is the way to figure out the creation time of the EC2 instance ?
The persistent volume in the EC2 instance is Elastic Block Storage (EBS). This storage gets provisioned and attached to the EC2 instance at the time of creation of the EC2 instance. The persistent volume will be running even if the instance is in the stopped. If you check the details of the persistent volume, we can see a parameter called Attachment Time. We can use this parameter to identify the creation time of the EC2 instance.
Refer to the below screenshot to get a proper understanding
I hope this explanation is helpful. Feel free to comment incase if you have any queries or feedback.