Demystifying Amazon EC2 Instance States and Operations

all aws amazon ec2 aws compute Jan 21, 2024

Amazon EC2 (Elastic Compute Cloud) is a central part of AWS's cloud computing platform, and understanding its instance states and operations is crucial for anyone working with AWS. This blog post breaks down these concepts into easy-to-understand language, helping you get a clearer picture of what happens behind the scenes.

Understanding EC2 Instance States

1. Pending

  • What Happens?: This is the birth phase of an EC2 instance. After you hit 'Launch', AWS prepares the instance with the necessary configuration and software.
  • Behind the Scenes: AWS allocates resources like CPU, memory, and storage. The Amazon Machine Image (AMI) you selected is loaded, setting the stage for the instance to start.
  • Trigger: Initiated by the user's launch command.

2. Running

  • What Happens?: Your instance is now up and running, ready to be used just like any computer.
  • Behind the Scenes: The instance is fully operational, connected to the network, and starts incurring billing charges.
  • Trigger: Automatically follows the pending state.

3. Stopping/Stopped

  • What Happens?: When you stop an instance, it powers down. It's like putting your computer to sleep; you can wake it up later.
  • Behind the Scenes: The instance transitions to the stopping phase and then to stopped. While stopped, the instance doesn't incur compute charges, but storage charges for EBS volumes still apply.
  • Trigger: User command to stop the instance.

4. Shutting-down/Terminated

  • What Happens?: This is the end of the road for an instance. Termination is like throwing away your computer.
  • Behind the Scenes: In shutting-down, AWS cleans up resources, and then the instance moves to terminated where it's deleted and cannot be restarted.
  • Trigger: User command to terminate the instance.

5. Hibernating (Only for EBS-backed instances)

  • What Happens?: Hibernation saves the instance's state to disk, allowing it to resume later from the same state.
  • Behind the Scenes: RAM contents are saved to the EBS root volume. The instance enters stopping and then stopped. Billing is paused, but EBS volume storage charges still apply.
  • Trigger: User command to hibernate the instance.
  • Read more: cloudericks.com/blog/understanding-ec2-hibernate-state

EC2 Instance Change Operations

  1. Start: Wakes up a stopped instance. It's similar to turning on your computer.

  2. Stop: Powers down the instance. Use this when you want to pause your work and resume later.

  3. Terminate: Permanently deletes the instance. Once done, it can't be undone.

  4. Reboot: It's like restarting your computer. The instance stays on the same host and retains its configuration and IP addresses.

  5. Hibernate: Saves your instance's state to disk, including in-memory data. Useful for long-term pause without losing the current state.

Important notes

  • Elastic IP Addresses: If your instance has an Elastic IP, it retains this address across stop/start cycles, but not on termination.
  • Instance Store Volumes: These are temporary storage volumes that get deleted on stopping, hibernating, or terminating the instance.
  • Billing: Understand billing implications of each state. For example, you're not billed for a stopped instance, but you are billed for its attached EBS storage.

Conclusion

Understanding these states and operations is crucial for efficient and cost-effective management of AWS resources. Remember, each state and operation has specific implications on billing, data persistence, and network settings. Keeping these in mind helps in making informed decisions while working with AWS EC2.

Stay connected with news and updates!

Join our mailing list to receive the latest news and updates from our team.
Don't worry, your information will not be shared.

We hate SPAM. We will never sell your information, for any reason.