EC2 Core Concepts

EC2 Core Concepts

In this tutorial, we are going to explore about the EC2 Core Concepts. Amazon Elastic Compute Cloud EC2 core concepts revolve around the fundamentals of deploying, configuring, and managing compute resources in the cloud.

Lets explore some core concepts of Elastic Compute Cloud (EC2) such as Amazon Machine Image (AMI), its lifecycle, and billing. Then, we will look at different types of instances offered by EC2 and learn about their use cases.

EC2 Core Concepts
Amazon Machine Image (AMI)

An Amazon Machine Image is a pre-configured image provided by AWS that contains the necessary information required to launch an instance. AMI serves as a template for the root volume that includes information regarding the operating system, application server, and applications.

An AMI must be specified to launch an instance; multiple instances can be launched from a single AMI. We can also create our AMIs, and we can copy an AMI from one region to another and deregister an AMI when no longer needed. There are multiple types of AMIs based on the

  • Operating system: For example, Amazon Linux 2 AMI and Microsoft Windows Server 2019 Base AMI are two different AMIs based on different operating systems.
  • Regions: AWS offers different AMIs based on the region; AMIs can be transferred from one region to another. It is important to note that transfer between distant regions would take more time. Hence, it would take a long time to launch the EC2 instance.
  • Architecture (32-bit or 64-bit): AWS offers various AMIs for different types of architecture, such as Ubuntu 20.40 LTS for 64-bit architecture and Amazon Linux for 32-bit architecture. It is important to note that AWS also offers Amazon Linux AMI for 64-bit architecture as well.
  • Launch permissions: Each AMI has predefined launch permissions set by its owner. It is used to determine the availability of that AMI. There are three types of launch permissions
    • Public: Available to all the AWS accounts.
    • Explicit: Available to specific AWS accounts, organizations, or organization units.     
    • Implicit: Available only to the owner.
  • Storage for the root device: AMIs are also categorized based on the root storage for the instance. Each instance either has an Amazon EBS or an Amazon instance store as a root device. The root device, for instance, is Amazon EBS, when the volume created is from an Amazon EBS snapshot. Similarly, the instance launched from an AMI has an instance store volume created from a template stored in Amazon S3.

AMI lifecycle

We can create, manage, or delete our own AMIs. We can create different types of AMI, as we discussed above, such as Amazon EBS or instance store-backed. We can also modify the AWS marketplace AMI to our needs and register it to launch multiple instances from it. There are six stages of the AMI lifecycle, from creation to depreciation, lets take a look at them in the illustration below.

After creation, an AMI’s description and sharing properties can be modified, but core content like volume and binary data cannot be modified.

AMI lifecycle

An AMI can be marked as deprecated to warn users and prevent launching new instances. Existing instances based on deprecated AMIs are unaffected and can run normally. Finally, AMIs can be deregistered to remove them completely, but running instances will continue to be charged.

AMI billing

AWS offers multiple AMIs to launch different instances; these AMIs support various operating systems architectures and offer different features. It is important to understand their effect on the AWS bill. AMI cost depends upon the OS and different features offered by the respective AMI. It is important to understand the cost of AMIs before launching instances.

Key Components of an AMI

1. Root Volume

  • Each AMI includes one or more root device volumes. These volumes are templates for the root storage attached to the instance when it launches, containing the operating system, applications, and any other data you choose to pre-load.

2. Launch Permissions

  • AMIs have permissions that define which AWS accounts can use them to launch instances. AMIs can be private, shared with specific accounts, or made public.

3. Block Device Mapping

  • Defines the block devices (storage volumes) to attach to the instance when launched. You can map additional EBS (Elastic Block Store) volumes or instance stores as part of the AMI.

Types of AMIs

1. Amazon-provided AMIs

  • AWS offers several base AMIs, including popular operating systems like Amazon Linux, Ubuntu, Windows Server, and more. These are regularly updated and maintained by AWS.

2. Marketplace AMIs

  • AWS Marketplace offers pre-configured AMIs from third-party vendors. These AMIs may come with specialized software, such as database solutions, web servers, or application development tools.

3. Community AMIs

  • Community AMIs are AMIs that have been shared publicly by other AWS users. They may contain specific configurations for niche use cases but may lack official support or updates.

4. Custom AMIs

  • Users can create their own custom AMIs by configuring an instance, installing software, setting up configurations, and then creating an AMI from the instance. This is useful for deploying a standardized configuration across multiple instances or environments.

Common Use Cases for AMIs

  • Creating Dev/Test Environments: AMIs make it easy to replicate development, staging, or production environments.
  • Standardizing Infrastructure: AMIs provide a uniform, pre-configured environment across instances, improving maintainability.
  • Scaling Applications: AMIs allow fast creation of new instances in auto-scaling groups, ensuring consistent application setup.
  • Backup and Disaster Recovery: Custom AMIs can be used as backups, enabling rapid recovery if instances fail or need to be redeployed.
Instances

An instance is a virtual server configured using an AMI used to launch the instance. It can run different operating systems, including Linux, Windows, and CentOS. Multiple instances can be launched from a single AMI. AWS offers different types of instances based on the requirements. Users can select an instance type based on the need for computing power or amount of memory.

Instance types

Instances are categorized based on their computing power, memory, and networking capabilities. We select any instance type based on our requirements. When launching an instance, the instance type specifies the hardware of the server. Each type offers different computing power, amount of memory, and networking capabilities. Let’s look at the different types of instances below:

  • General purpose: These instances offer a balance of compute, memory, and networking capabilities that can be used for a wide range of workloads.
  • Compute optimized: These instances offer high compute power, making them ideal for intense applications that require intense processing.
  • Memory optimized: These instances offer fast memory performance, specially designed for workloads that require large datasets in memory.
  • Storage optimized: These instances are designed to offer high sequential read and write capabilities on local storage.
  • Accelerated computing: These instances use hardware accelerators to offer complex calculations in a more efficient manner. They offer more parallelism for intensive workloads.
  • High-performance computing: These instances are built to offer the best price-performance for high-performing compute instances. They are normally used to solve complex computational problems.
  • Mac instances: These instances are used to build, develop, and test Apple applications.

It is important to identify different types of instances from each other. Instances types are named after family, generation, processor family, additional capabilities, and size. Let’s understand the nomenclature of instance types with an example. Consider an instance r7gd.16xlarge:

  • The first position in the instance type name is used to refer to the instance family.
  • The second position is used to represent the instance generation.
  • The third position is used to represent the processor family in the instance.
  • The last position before the period (.) i.e., the fourth position is used to highlight additional capabilities of the instance. After the period (.), the instance size is represented such as small, xlarge and etc.
Nomenclature of instance type

Each instance has a root volume attached to boot the instance. After launching, an instance works similarly to a server, and it keeps running until stopped, hibernated, terminated, or failed.

Instance lifecycle

The lifecycle of EC2 transits through different states from creation to termination. It’s important to understand the behavior of instances to fully understand how EC2 works. An instance is a server in the cloud; naturally, it can be launched and terminated like a local server. However, EC2 instances can also be stopped, hibernated, rebooted, and retired. Let’s take a deeper look into the different states of EC2 instances.

Launch: When an instance is launched from a selected instance type, its state is updated from pending to running. When the instance state is changed to “Running,” the instance has started booting. There might be a slight delay before we can do anything with our instance.

Instance lifecycle
  • Stop: Once the instance is running, we can stop and start the instance again anytime. It is important to note when an instance is stopped, the data stored in the RAM is lost and the instance may not have the same public IP but the private IP stays the same. The instance store volumes are also lost; AWS offers an alternative to preserve the data stored in the RAM using Hibernation.
    • Hibernation saves the content of RAM to the EBS root volume. It also preserves the other EBS volumes attached. During reboot, the contents of RAM saved earlier are again loaded into the memory.
  • Termination: Once the work is done and we no longer require the instance, we can terminate the instance. Terminating an instance changes the state of the instance from “Running” to “Shutting down.” The instance can not be started again after it has been terminated.

Together, these AWS EC2 core concepts enable Amazon EC2 users to configure highly customized, scalable, and secure cloud environments suited for a wide range of applications, from development and testing to enterprise-level, high-performance computing.

    That’s all about AWS EC2 Core Concepts. If you have any queries or feedback, please write us at contact@waytoeasylearn.com. Enjoy learning, Enjoy AWS Tutorials.!!

    EC2 Core Concepts
    Scroll to top