Home » Blog » Know Everything About the AWS EC2 Latest Update


AWS EC2 banner 1

Know Everything About the AWS EC2 Latest Update

Dev eWayCorp November 11, 2022 12 MIN READ


AWS EC2 banner 1

Amazon Web Services recently introduced the Replace Root Volume feature in AWS EC2 in June 2022. This feature allows replacing the root volume of the EBS for running instances. Basically, this feature can fix issues like root volume corruption and network configuration errors in the guest operating system. However, the data stored within the instance stores volume, and non-root Amazon EBS volume will be retained. Other things that will be retained are the network configuration and the IAM policies. 

Wondering how to replace the EBS root volume using AWS EC2? We can help you with that. 

One should remain familiarized with Amazon Elastic Compute Cloud and Amazon Elastic Block Store. However, this will help to meet the changing requirements of the root volume for a running instance.  

Once you are fully aware of AWS EC2 and EBS, navigating the entire process would be easy for you. 

Amazon Elastic Compute Cloud (AWS EC2) 

Elastic Compute Cloud or EC2 is a scalable computing service on the AWS cloud platform. It is a virtual computer on which multiple tasks can be carried out. Also, users get the authority to launch, configure, and even dissolve this virtual computer. 

In simple words, AWS EC2 is a secure web service that strives to offer scalable computing capacity within the cloud. With the help of AWS EC2, one can launch a virtual server on the AWS cloud. Thus, there will not be any further need to invest in the hardware front.  

AWS EC2 is a cloud computing platform that offers scalability options. Remember EC2 launches multiple virtual servers. Each virtual server is referred to as an ‘Instance’.  

Similarly, preconfigured templates, known as Amazon Machine Images (AMIs) are used for the instances. Each AMI contains information about the launch of an EC2 instance.  

The best thing about the Elastic Compute Cloud is that cloud computing professionals can take total control of the computing resources. For instance, an AWS user will be able to increase or decrease the capacity of any ‘instance’ by using the EC2 web interface.  

Also, to scale up and down any instance a developer can automatically code an application. But to do the job they will need to use AWS Auto Scaling. 

So, it will not be wrong to say that EC2 is an integral part of AWS as AWS is the most used cloud computation service. 

Creating An AWS EC2 Instance 

  1. Firstly, log in to your AWS account and tap on the “Services” section on the left side of the AWS management console. From the drop-down menu, click on “EC2”. 
  2. It will take some time for the EC2 console to get loaded on your screen. So, once it is loaded, tap on Instances present on the left side of the navigation pane. 
  3. Thirdly, a new fresh screen will get loaded. On the right corner of the screen, an orange box named “Launch Instance” will be displayed. Click the box and wait for some time. 
  4. Now, the process of the EC2 instance launch will kick off. On another screen, you will get many AMI options to choose from. Plus, users will get a detailed 7-step procedure for successfully launching an instance. Once the AMI is chosen, “Next” should be clicked. 
  5. As a part of the 7-step procedure, the following actions should be completed.  
    • Pick the Instance Type and click on Next. 
    • Confirming the Configurations for the EC2 before clicking on Next. 
    • Looking into the pre-defined storage configurations and modifying them in case they do not meet the requirements. Once done, Next should be clicked. 
    • Click on “Add Tags” and click on Next. 

A ‘Group Name,’ ‘Group Description,’ and the number and types of ports to open along with the source types must be provided. 

In this Review step, the instance is finally launched, and a new dialog box will appear. It asks for the “Key Pair” which is needed for user authentication while connecting to EC2. 

These are some steps that allow you to create an EC2 instance very easily. Once the instance is created, it can be used in any way a user wants. 

Amazon Elastic Block Store (EBS) 

AWS offers a vast range of storage services, which can be set up according to project requirements. AWS storage services are perfect for highly confidential or frequently accessed data. One can pick from different storage type options, such as object storage, block storage services, file storage, backups, and migration. Each option falls under AWS Storage Service List.  

For additional storage requirements, Elastic Block Storage (EBS) can be attached to EC2 instances. EBS is a raw block-type durable storage.  

Do remember that EBS volumes are usually specific to certain availability zones. This means they can only be attached to instances that come under the same availability zone. 

Basically, an Amazon Elastic Block Store (EBS) is a raw block-level storage device. One can connect these storage spaces to EC2 instances. The EBS volume will work like  other raw block storage devices once it’s mounted on the EC2 instance. 

The EBS device can be formatted or cloned like other physical hard drives. While formatting, a specific file system, operating system, and host application must be used. 

Types of EBS Volumes 

For Amazon EBS, one will get to see two types of volume categories. One is the SSD-backed volume, and the other one is the HDD-backed volume. 

  • For transactional workloads, the SSD-backed volume must be optimized. It is because the volume will carry out many but small read/write operations. IOPS (Input/Output Operations Per Second) measures the performance of the SSD volume. 
  • Similarly, the HDD-backed volumes are designed for large-scale workloads, as throughput is most crucial. The performance is always measured in MiB/s. 

For this type of volume, the performance is measured in MiB/s. 

Sub Types of Each EBS Volume 

There are two types of subsets for SSD EBS Volumes and HDD EBS Volumes. They are: 

Subtypes for SSD-based EBS Volumes 

  • General Purpose SSD 
  • Provisioned IOPS SSD 

Subtypes for HDD-based EBS Volumes 

  • Throughput Optimized HDD 
  • Cold HDD 

Now, let us go through the details of each subtype. 

What are the Subtypes of SSD EBS? 

General Purpose SSD (gp2) 

General Purpose SSD is recommended for most use cases. Known for its pricing and performance, this general-purpose SSD is an ideal choice for boot volumes, low-latency production apps, and for applications in development and testing environments. 

The performance of gp2 is directly correlated with the volume size,as a customer will get three IOPS per GB. Volumes also get I/O credits. The credit points out the available bandwidth which the volume can use for bursting up to a higher IOPS value over a certain time. 

Up to a maximum of 3000 IOPS credits can be saved. Amazon EBS will be able to use the saved credits at any time. Note that the EBS volume will bounce back to its initial performance rate as soon as credits are exhausted. Gp2 volumes can range from 1 GiB to 16 TiB. 

Provisioned IOPS SSD (io1) 

This type of SSD volume is ideal for critical production applications and databases that demand high-performance Amazon EBS storage. Instead of credits, io1 volumes provide a certain IOPS value, with a maximum ratio of 50:1. 

While setting up a 100 GiB volume, a performance rate of 5000 IOPS can be assigned. However, volumes that are bigger than 400 GiB can provide a maximum of 32,000 IOPS. The size of io1 volume can vary from 4 GiB to 16 TiB, but the throughput can be maxed at 500 MiB/s. 

What are the Subtypes of HDD EBS? 

Throughput Optimized HDD (st1) 

This type of HDD EBS volume is highly suitable for applications that need larger storage and bigger throughput. For instance, it is ideal for big data or data warehousing. Here, the IOPS need not be relevant. 

In fact, st1 volumes are like SSD gp2, since they use a burst model. Here, the initial baseline throughput is usually tied to the volume size, and over time the credit starts to accumulate. Bigger volumes will have a higher baseline throughput and will gather credits amazingly fast. 

The limit for maximum throughput is set at 500 MiB/s. However, the size of st1 might vary from 500 GiB to 16 TiB. Every TiB can hold around 1TiB in credit. 

Cold HDD (sc1) 

It is a magnetic storage format that is extremely suitable for cases where there is a need to store data at a low cost. The size of this kind of storage may vary from 500 GiB to 16 TiB, and the throughput can reach up to 250 MiB/s. As used in st1 volumes, a similar burst model is used. However, the credits get filled at a slow value. 

It must be remembered that both st1 and sc1 storage types cannot be used as a boot volume. So, for the boot volume, it is better to use gp2 volumes. 

Features of EBS 

Let us check some of the amazing features of EBS. 

  1. Scalability: As per the needs of the system, the EBS volume sizes and features can be scaled. This is done through any one of the ways. They are: 
    • Taking a snapshot of the present volume and creating a new volume using the same snapshot. 
    • Updating the existing EBS volume from the console. 
  1. Backup: Users can create snapshots of the EBS volume that serve as backups. For backups, certain things must be followed. 
    • Create snapshots manually any time or schedule them. 
    • Snapshots get stored in AWS S3 and are charged as per the S3 storage charges. 
    • Create new volumes across regions from the snapshots. 
  1. Encryption: It is a basic requirement of storage. This is because of the regulatory compliance of the government. EBS provides an AWS managed encryption feature. 
    • Users can enable the encryption while creating EBS volumes by clicking the checkbox. 
    • Key Management Service (KMS) manages the Encryption Keys.  
    • Encryption uses the AES-256 algorithm. 
    • Snapshots from encrypted volumes are also encrypted; volumes created from snapshots are encrypted. 
  1. Charges: Unlike AWS S3, EBS charges vary from one region to another. 

Now that you know about EC2 and EBS, get trained on how EC2 works or how an EBS volume can be attached to an EC2 instance. 

AWS EC2: Understanding It 

For newbies, understanding the working process of EC2 can be a bit hard. But for AWS professionals, working with EC2 is just like a cakewalk.  

One gets to choose from the pre-configured templates, often referred to as AMI. However, one can also create their own AMIs, but they must include all libraries, applications, data, and pertinent configuration settings.  

Usage spikes and drops can be addressed as the virtual server environment scales up and down. Plus, a user gets complete control over the resources used at any given point in time. 

Attaching an EBS Volume to an AWS EC2 Instance 

To attach an EBS volume to an Amazon EC2 instance, you should right-click it and choose ‘Attach’. Do note that the volume must be formatted within the operating system that is to be used. 

AWS EC2 Replacing the EBS Root Volume: What is it About 

The Replacement Root Volume feature allows restoring the root volume to the last known good snapshot while resuming operations with their instance and keeping the instance store data intact. Often customers dealing with Big Data workloads can use the Replace Root Volume to quickly restore the instance and avoid any replication of instance store data. 

AWS EC2 is going to support the replacement of root volume instances with the help of an updated API (Application Programming Interface). This means there will not be any need for the customers to stop their instances. However, changing the AMI of a running instance will result in updating the operating system and applications. 

The Replace Root Volume feature is ideal for patching any software without the need to carry out store data backups or even replication. Customers having stateful workloads will be able to use this feature to ensure their software is up to date. Plus, the security of the software can be improved by patching it often. 

The Replace Root Volume feature is available for all public AWS Regions and even for AWS GovCloud (US) regions. To know more about this feature, follow the rest of the blog post. 

Replacing a Root Volume 

If you are planning to replace the root volume of an instance, a root volume replacement task gets created. The root volume replacement task can monitor the progress and even the outcome of the replacement process. 

Steps Involved 

  1. To replace the root volume, open the Amazon EC2 Console .
  2. Go to the navigation panel and choose Instances .
  3. Pick the instance for which you want to replace the root volume. Once done choose Actions>Monitor>Troubleshoot> Replace Root Volume 
  4. When the Replace Root Volume screen opens, perform any one task: 
    • For restoring the instance’s root volume to its initial launch state: Choose the Create replacement task without the snapshot. 
    • To restore the replacement root volume to a specific snapshot, the snapshot to be used must be selected, and then select Create replacement task
    • For restoring the replacement root volume using an AMI, the AMI to be used should be selected, then Create replacement task should be chosen. 
  5. For deleting the original root volume after the replacement task gets completed, the Delete replaced root volume must be selected. 

Viewing Root Volume Replacement Tasks 

As you replace the root volume of an instance, a root volume replacement task gets created. The transition of the root volume replacement task will take place through the following states. They are: 

  • pending – the replacement volume is getting created 
  • in-progress – the original volume is going to be detached, and the replacement volume is getting attached. 
  • succeeded – the replacement volume has been attached successfully to the virtual server and the virtual server/instance is available. 
  • failing – the replacement task is on the verge of failing. 
  • failed – the replacement task has failed; however, the original root volume is still attached. 
  • failing-attached – the replacement task is failing, and the instance might not contain the attached root volume. 
  • failed-detached – the replacement task has failed, and the instance does not have an attached root volume. 

Now, if you are planning to view the root volume replacement tasks of an instance, the following method, i.e., using a new console can be used.  

  1. Open the Amazon EC2 console. 
  2. Choose Instances from the navigation pane. 
  3. Pick the instance for which you want to view the root volume replacement tasks. Then choose the Storage tab. 
  4. From the Storage tab, expand the Recent root volume replacement tasks. 

AWS EC2 Replacing the EBS Root Volume: How Does It Work? 

As you plan to replace the root volume of a virtual server or an instance, a new or replacement root volume is reinstated. In fact, the process of restoring a new root volume is carried out in any one of the following ways. They are: 

  1. From a Snapshot 
  2. To the Initial Launch Site 
  3. From an AMI 

From a Snapshot 

The snapshot should be from the same lineage as the present root volume. Doing so will allow users to fix certain issues, such as guest operating system network configuration errors or even root volume corruption. 

To the Initial Launch Site 

Here, the EBS volume gets restored back to its initial launch state. 

From an AMI 

An AMI usually contains the same key elements as the instance. This process will allow one to carry out the patching and even upgrade of the operating system and application. 

Popular Ways of Replacing the Root Volume 

Now, let us delve deep into the ways of replacing the root volume.  

Replacing the Root Volume with a Snapshot 

Root volume can be replaced using a snapshot.  

The replacement root volume will get the same elements as the original root volume.  

Considerations for Using a Snapshot  

There are certain considerations for using a snapshot. They are: 

  • One can use snapshots that are a part of the same lineage as the instance’s current root volume. 
  • You cannot use snapshot copies created from the root volume snapshot. 
  • Snapshots created from the original root volume can be used only after the new root volume is replaced. 

Replacing the Root Volume Using an AMI 

Root volume replacement can be carried out with the help of an AMI, which is either shared or owned by you. Even an AWS Marketplace AMI will suffice. However, the AMI should have the same product code, architecture type, billing information, and virtualization type as that of the virtual server or instance. 

If the instance is enabled for NitroTPM, ENA, or sriov-net, then an AMI that supports them must be used. Similarly, if the instance does not support ENA or NitroTPM, an AMI that doesn’t support them must be picked. 

An Important Reminder

However, AMI with different boot modes than the one used by the instance must be selected. It should be done if the instance supports the AMI’s boot mode. In case the instance does not support the boot mode, then the request fails.  

On the other hand, if the instance supports the boot mode, the new boot mode gets passed on to the instance and the UEFI data gets updated accordingly. In case the boot order is manually modified or added the UEFI Secure Boot key for loading private kernel modules, then the changes get lost during the root volume replacement. 

The replacement root volume will get the same volume type and even the delete on termination feature as the original root volume. It will receive the same size of the original root volume or just the size of the AMI’s block device mapping meant for the root volume. 

After the root volume replacement task is fulfilled, new and updated information will be reflected, but the instance that uses console AWS CLI or AWS SDKs must be described. Things to be described are: 

  • New AMI ID 
  • New volume ID for the root volume 
  • Updated NitroTPM configuration, if enabled by AMI 
  • Updated sriov-net configuration, if enabled by AMI 
  • Updated boot mode configuration, if enabled by the AMI 
  • Updated ENA configuration, if enabled by the AMI 

Considerations for Using an AMI  

There are certain considerations for using an AMI. They are: 

  • If the AMI has multiple block device mappings, only the root volume of the AMI must be used. Other non-root volumes must be ignored. 
  • Only the AMIs for accounts with launch permission can be used. 
  • An AMI without a product code can be used provided the instance does not have a product code. 
  • The encryption change cannot be changed. If the original root volume is encrypted, the new root volume is also encrypted. Similarly, when the original root volume is unencrypted and the selected AMI’s block device mapping for the root volume is encrypted, then the root volume will be encrypted. 
  • The instance identity documents for an instance get updated automatically. 
  • In case an instance supports NitroTPM, then the NitroTPM data for the instance must be reset and new keys should be generated. 

General Considerations for Root Volume Replacements 

Wondering about the considerations for the root volume replacements? Read on. 

  • The instance should be in the running state. 
  • The virtual server must automatically reboot during the process. The contents within the memory should be erased during the reboot. There should not be any room for manual reboots. 
  • Root volume within the instance store volume must not be replaced. Only virtual servers with Amazon EBS root volume will get replacement support. 
  • Only the root volume for all virtualized instance types and AWS EC2 Mac metal instances can be replaced. Other metal instances do not get support. 
  • Use a snapshot that belongs to the same lineage as the instance’s previous root volumes. 

Replacing Root EBS Volume With Another Root EBS Volume 

Technically speaking, replacing the root EBS volume with another root EBS volume is easy. All that one needs to do is: 

  • Stop the Instance 
  • Detach the current root EBS 
  • Attach the new EBS under /dev/sdai (Linux users) and /dev/xvda (Windows users) 
  • Start the Instance. 
  • In case the problem persists, it’s better to attach the EBS as a non-rooted EBS and then browse the files and fix the errors accordingly. 

However, one can also replace the EBS volume. The process is mentioned in this post. 

Replacing an Amazon EBS Volume 

On Amazon EC2, Amazon EBS snapshots are the most preferred backup tool. For creating a volume from a snapshot, its state for a specific point in time must be recreated while the date created for that specific time is saved. Next, a snapshot-generated volume should be attached to the instance, and the data can be duplicated across regions. Test environments can be created; damaged or corrupted production volume can be replaced completely; specific files and directories can be retrieved and transferred to another attached volume. 

Let us go through the steps involved in replacing the EBS volume 

Step 1 

Create a volume from the snapshot and note down the ID of the new volume. 

Step 2 

On the Instances page, select the Instance for which the volume must be replaced and note down the instance ID. 

(While keeping the Instance selected, click on the Storage tab. Go to the Block devices section and look out for the volume to be replaced. Once done, print the name of the device for the volume.) 

Step 3 

On the Volumes Screen, choose the volume and select Actions> Detach Volume> Detach. 

Step 4 

Select the new volume that was created in step 1 and again select Actions> Attach Volume. 

For the Instance and Device name, you will have to enter the Instance ID and device name that you noted down previously. After entering the ID, the Attach volume can be chosen. 

Step 5  

Connect to the Instance and set up the volume. 

Things to be Retained While Replacing a Root Volume for a Running Instance 

  • IAM policies and profiles associated with the instance. 
  • All network configurations.  
  • Data that is stored on instance store volumes. 
  • Data stored on non-root EBS volumes. 

Replace Root Volume is Highly Beneficial 

The Replace Root Volume feature will be helpful for customers who want to patch their software quickly without the need to meet the operational costs associated with instance store data backups or replications. Also, customers with huge workloads can use this feature for ensuring this software is up-to-date and for improving security by patching it frequently. 

Final Thoughts  

As per the AWS documentation, the AWS EC2 can replace the root EBS volume. But before replacing the root volume, several considerations must be made. For instance, some elements need to be retained, like the AWS EC2 must remain on the same physical host while retaining the public and private IP addresses and the DNS (Domain Name System) name.  

Similarly, each network interface should remain associated with the instance. Plus, the pending network traffic must be flushed out as soon as the instance is available.  

Once the root Amazon EBS volume gets replaced, it is easy to restore the root volume without stopping the instance. 

Do you need any kind of help with EBS root volume replacement? Contact us today!