AWS EBS Interview Questions
1. What is Elastic Block Store?
Amazon Elastic Block Store (EBS) is a block storage system used to store persistent data. Amazon EBS is suitable for EC2 instances by providing highly available block-level storage volumes.
It has three types of volumes, i.e. General Purpose (SSD), Provisioned IOPS (SSD), and Magnetic. These three volume types differ in performance, characteristics, and cost. Amazon Elastic Block Store (EBS) provides block-level storage volumes for use with Amazon EC2 instances. Amazon EBS volumes are off-instance storage that persists independently from the life of an instance.
Amazon Elastic Block Store (EBS) is an easy-to-use, high-performance, block-storage service designed for use with Amazon Elastic Compute Cloud (EC2) for both throughput and transaction-intensive workloads at any scale.
Amazon EBS is used to provide block-level storage volumes for use with AWS EC2 instances, EBS volumes are off-instance storage that persists independently from the life of an instance.
It is easy to use and gives high performance, blocks storage service designed in use with AWS EC2 for throughput and transaction-intensive workloads at any scale. Elastic Block Store is used for storing persistent data and providing highly available block-level storage volumes. It has three types of volume:
General Purpose (SSD)
Provisioned IOPS (SSD)
Magnetic
2. Why is Amazon EBS Useful?
Amazon Elastic Block Store offers raw block-level storage that could be attached to Amazon EC2 instances which are used by Amazon Relational Database Service. Amazon EBS offers a variety of storage performance and cost options.
Amazon EBS is like a cloud-based hard drive that gives persistent block storage volumes to be used with Amazon EC2 instances.
3. What are the benefits of Amazon EBS?
Reliable and secure storage – Each of the EBS volumes will automatically respond to its Availability Zone to protect from component failure. Secure – Amazon’s flexible access control policies allow one to specify who can access which EBS volumes. Access control plus encryption offers a strong defense-in-depth security strategy for data. Higher performance – Amazon EBS uses SSD technology to deliver data results with consistent I/O performance of the application. Easy data backup – Data backup can be saved by taking point-in-time snapshots of Amazon EBS volumes. The benefits of Amazon EBS are as follows:
- Reliable and Secure Storage – It automatically responds to its availability zone protecting it from component failure.
- Secure – It allows us to specify access to EBS volumes.
- Higher Performance – Delivers data results with consistent performance.
- Easy Data Backup – Takes taking point-in-time snapshots of Amazon EBS volumes.
4. What are the various types of EBS volumes?
There are five types of EBS volumes available as below:
- General Purpose SSD (gp2)
- SSD (Solid State Drive) is the volume with which EC2 chooses as the root volume of your instance by default. For small input/output operations, SSD is many times faster than HDD (Hard Disk Drive). It gives a balance between price and performance (measured in IOPS – Input-Output Operations per second).
- Provisioned IOPS SSD (io1)
- This is the most expensive and fastest EBS volume. They are intended for I/O-intensive applications like large Relational or NoSQL databases.
- Throughput Optimized HDD (st1)
- These are low-cost magnetic storage volumes whose performance is measured in terms of throughput.
- Cold HDD (sc1)
- These are even less expensive magnetic storage options than Throughput Optimized. They are intended for large, sequential cold workloads, such as those found on a file server.
- Magnetic (standard)
- These are older-generation magnetic drives that are best suited for workloads with infrequent data access.
5. What can I expect from Amazon EBS volumes in terms of performance?
Provisioned IOPS SSD (io2 Block Express, io2, and io1), General Purpose SSD (gp3 and gp2), Throughput Optimized HDD (st1), and Cold HDD are the seven-volume types offered by Amazon EBS (sc1). These volume kinds differ in terms of performance and cost, allowing you to adjust your storage performance and cost to your applications’ requirements. Between EC2 instances and EBS, the typical latency is in the single-digit milliseconds.
6. What is a block storage volume?
A block storage volume operates in the same way that a hard drive does. It can be used to store any type of file or even to install an entire operating system.
EBS volumes are placed in an availability zone and automatically replicated to protect against data loss in the event of a single component failure.
However, because they are only replicated across a single availability zone, you may lose data if the entire availability zone fails, which is extremely unlikely.
7. How do allow an EBS volume available with no downtime and attach it to an EC2 instance when the EBS volume fails?
You can add a load balancer and auto-scaling, which will allow an EBS volume available with no downtime, and if the ec2 instance goes down due to autoscaling, a new instance will be created, and you can add commands to map to the EBS in the shell script. And when the EBS volume fails, we can take regular backups and replace the EBS with the most recent backup or snapshot if it fails.
8. What is the maximum size of an EBS storage device?
16 TiB
The maximum volume size supported by EBS at the moment is 16 TiB. This implies how you can create an EBS volume with a capacity of up to 16 TiB, but whether the OS recognizes all of that capacity is dependent on the OS’s own design characteristics and how the volume is partitioned.
9. What is Amazon Machine Images (AMI) in AWS?
Amazon Machine Images (AMIs) are pre-configured virtual machine templates that are used to create and launch Amazon Elastic Compute Cloud (EC2) instances. An AMI contains the necessary information to launch an EC2 instance, including the operating system (OS), application software, and any other required configuration settings.
There are two types of AMIs:
- EBS-backed AMIs: These AMIs use Amazon Elastic Block Store (EBS) to store the root device volume, which contains the image used to boot the instance. EBS-backed AMIs are more flexible and scalable than instance store-backed AMIs, as they can be stopped and restarted, and the root device volume can be resized or replaced.
- Instance store-backed AMIs: These AMIs use instance store volumes, which are physically attached to the host computer, to store the root device volume. Instance store-backed AMIs cannot be stopped and must be terminated when you no longer need them.
You can create your own AMIs by customizing an existing AMI or by creating a new AMI from scratch. You can also use pre-built AMIs provided by AWS or third-party vendors
AWS EBS Interview Questions
10. What are the different kinds of EBS Volumes?
General Purpose EBS (SSD) This volume type is appropriate for small and medium workloads, such as root disc EC2 volumes, small and medium database workloads, and workloads that access logs regularly. By default, SSDs support 3 IOPS/GB, which means that a 1 GB volume will provide 3 IOPS, and a 10 GB volume will provide 30 IOPS. One volume’s storage size ranges from 1 GB to 1 TB. For one month, each volume costs $0.10 per GB.
IOPS provisioned (SSD) This volume type is best for transactional workloads that require a lot of I/O, as well as large relational, EMR, and Hadoop workloads. IOPS SSDs support 30 IOPS/GB by default, so a 10GB volume will provide 300 IOPS. One volume’s storage size ranges from 10GB to 1TB. For supplied storage, one volume costs $0.125 per GB per month and $0.10 per provisioned IOPS per month.
Magnetic Volumes from EBS Previously, it was known as standard volumes. This volume type is suited for workloads that require infrequent data access, such as data backups for recovery, log storage, and so on. One volume’s storage size ranges from 10GB to 1TB. For provisioned storage, one volume costs $0.05 per GB per month and $0.05 per million I/O requests. There are 3 types of EBS Volume:
- The EBS General Purpose (SSD) volume is suitable for small and medium workloads, such as those on the Root Disc EC2.
- Provisioned IOPS (SSD) volume is ideal for most I/O heavy and big workloads, such as Hadoop.
- EBS Magnetic Volumes, also known as standard volumes, are a type of magnetic volume. It is appropriate for tasks such as data backups and log storage.
11. Is it necessary to unmount volumes before taking a snapshot?
No, while the volume is mounted and in use, snapshots can be taken in real-time. Snapshots, on the other hand, only capture data that has been written to your Amazon EBS volume, so any data that has been cached locally by your application or OS may be missed. We recommend removing the volume cleanly, issuing the snapshot command, and then reattaching the volume to ensure consistent snapshots on volumes associated with an instance. Shutting down the computer to take a clean snapshot of Amazon EBS volumes that function as root devices are recommended.
12. How do I transfer files from one EBS to another?
We need to attach to an instance for copying files from one EBS to another EBS, and we can store the contents on a third storage option if the volumes aren’t attached to instances. Follow the following steps for doing the same:
- Start a temporary instance.
- Use a larger size for higher IO bandwidth.
- Attach both EBS volumes to the instance and mount them as, say, /vol1 and /vol2.
- Copy the files from /vol1 to /vol2.
- Unmount the volumes, detach the EBS volumes, and terminate the temporary instance.
13. What is the maximum storage capacity of an EBS device?
At the moment, EBS supports a maximum volume size of 16 TiB. This suggests that you can construct an EBS volume with a capacity of up to 16 TiB, but whether the OS recognizes all of that capacity is dependent on the OS’s own design characteristics and the partitioning of the volume.
14. When an Amazon EC2 instance is terminated, what happens to my data?
Data stored on an Amazon EBS volume, unlike data stored on a local instance store (which persists just as long as the instance is alive), can persist regardless of the instance’s lifetime. As a result, we suggest that you only use the local instance storage for transient data. We recommend using Amazon EBS volumes or backing up data to Amazon S3 for data that requires a higher level of durability. If you’re using an Amazon EBS volume as a root partition, make sure the Delete on termination flag is set to “No” if you want the Amazon EBS volume to survive the instance’s life.
AWS interview questions for experienced professionals
15. How to list information about AWS volumes?
You can use the below command to list information about AWS volumes
aws ec2 describe-volumes --query "Volumes[*].Tags[?Key=='Name'].Value"
16. When an EBS volume fails, how do you make it available with no downtime and link it to an EC2 instance?
You can use a load balancer and auto-scaling to make an EBS volume available with no downtime. If the ec2 instance goes down due to autoscaling, a new instance will be launched, and you can use the shell script to add commands to map to the EBS. We can also take frequent backups and replace the EBS volume with the most recent backup or snapshot if the EBS fails.
17. How to attach the external disk to AWS cluster Kubernetes?
- VolumeID: This is the identifier for the AWS volume that will be used.
- Obtain the volume ID assigned to our instance using the AWS CLI.
- Command:
aws ec2 describe-volumes
- If the pod creation with the volume attached was successful (the state of the ebs volume will change from “available” to “in-use” in the AWS console), we could simply run
kubectl describe pod
and it should appear in Volumes with a VolumeID similar to what you have in AWS.
Example:
apiVersion: "v1" kind: "PersistentVolume" metadata: name: "pv0001" spec: capacity: storage: "5Gi" accessModes:- "ReadWriteOnce" awsElasticBlockStore: fsType: "ext4" volumeID: "vol-f37a03aa"
18. What is an EBS block device?
An Amazon Elastic Block Store (EBS) block device is a block-level storage device that is used to store persistent data for Amazon Elastic Compute Cloud (EC2) instances. EBS block devices are attached to EC2 instances as virtual devices and are accessed like physical hard drives. EBS block devices are stored on Amazon’s infrastructure and are designed to be highly available and durable, with a 99.999999999% durability rate. EBS block devices can be used to store a variety of data types, including operating system files, application data, and database data. They are also configurable in terms of performance, allowing you to choose the I/O performance and capacity that best meets the needs of your application
19. When would I want to use FSR (Fast Snapshot Restore)?
If you are concerned about data access latency when restoring data from a snapshot to a volume and wish to prevent the first performance hit during initialization, you should enable FSR on snapshots. Virtual desktop infrastructure (VDI), backup and restore, test/dev volume copies, and booting from custom AMIs are all examples of use cases for FSR. When you enable FSR on your snapshot, you’ll get better and more predictable results anytime you need to restore data from it.
20. How can we change the default root EBS size in cloud formation?
To change the default root EBS size in a CloudFormation template, you can specify the desired size in the BlockDeviceMappings
property of the AWS::EC2::Instance
resource.
For example:
Resources:
MyInstance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-12345678
InstanceType: t2.micro
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeSize: 20
DeleteOnTermination: true
This will create an EC2 instance with a root EBS volume of size 20 GiB. The DeleteOnTermination
property specifies whether the volume should be deleted when the instance is terminated.
You can also specify the root EBS volume size as a parameter in your CloudFormation template, and pass in the desired size when you create or update the stack. This allows you to change the root EBS size without modifying the template itself.
AWS Tough Interview Questions
21. How can we transfer data from an EBS volume to an S3 bucket?
To transfer data from an Amazon Elastic Block Store (EBS) volume to an Amazon Simple Storage Service (S3) bucket, you can use the AWS Management Console, the AWS Command Line Interface (CLI), or the AWS SDKs.
Here’s an example of how you can use the AWS CLI to transfer data from an EBS volume to an S3 bucket:
- First, create a snapshot of the EBS volume using the
aws ec2 create-snapshot
command:
aws ec2 create-snapshot --volume-id vol-01234567890 --description "Snapshot of my EBS volume" --tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=MySnapshot}]'
This will create a snapshot of the EBS volume with the ID vol-01234567890
and add a tag with the key Name
and value MySnapshot
to the snapshot.
- Next, use the
aws s3api put-object
command to transfer the data from the snapshot to the S3 bucket:
aws s3api put-object --bucket my-bucket --key my-object --body snapshot://MySnapshot
This will transfer the data from the snapshot with the tag Name=MySnapshot
to the S3 bucket with the name my-bucket
, and create an object with the key my-object
.
22. How can we change the default root EBS size in cloud formation?
To change the default root EBS size in a CloudFormation template, you can specify the desired size in the BlockDeviceMappings
property of the AWS::EC2::Instance
resource. This property allows you to specify the block device mappings for an Amazon Elastic Compute Cloud (EC2) instance, including the root Amazon Elastic Block Store (EBS) volume.
Here’s an example of how you can use the BlockDeviceMappings
property to change the default root EBS size in a CloudFormation template:
"BlockDeviceMappings": [ { "DeviceName": "/dev/xvda", "Ebs": { "VolumeType": "io1", "Iops": "300", "DeleteOnTermination": "false", "VolumeSize": "30" } } ],
23. How to Set Up Amazon EBS?
Use the following steps for setting up Amazon EBS:
STEP 1 – Create Amazon EBS volume.
STEP 2 – Store EBS Volume from a snapshot.
STEP 3 – Attach EBS Volume to an Instance.
STEP 4 – Detach a volume from the Instance.
24. How to Copy files from one EBS to Another EBS?
For copying files from one EBS to another EBS, we need to attach to an instance and allow storing the files on a third storage option by assuming the volumes not attaching to instances.
Follow the following steps for doing the same:
Start a temporary instance.
Use a larger size for higher IO bandwidth.
Attach both EBS volumes to the instance and mount them as, say, /vol1 and /vol2.
Copy the files from /vol1 to /vol2.
Unmount the volumes, detach the EBS volumes, and terminate the temporary instance.
25. What is EBS Block Express, and how does it work?
EBS Block Express is the next version of Amazon EBS storage server architecture, designed to provide the highest levels of performance for block storage at a cloud scale with sub-millisecond latency. Block Express accomplishes this by communicating with Nitro System-based EC2 instances via Scalable Reliable Datagrams (SRD), a high-performance, low-latency network protocol. This is the same high-performance, low-latency network interface used in Elastic Fabric Adapter (EFA) for High-Performance Computing (HPC) and Machine Learning (ML) applications for inter-instance communication. Block Express also provides modular software and hardware building blocks that can be built in a variety of ways, allowing us to design and deliver greater performance and new features more quickly.
26. What are the advantages of using Amazon EBS?
Storage that is both reliable and secure – Each EBS volume will automatically respond to its Availability Zone in order to protect against component failure. Secure – You may decide who has access to which EBS volumes using Amazon’s flexible access control policies. Access control combined with encryption provides a robust data defense-in-depth security technique. Higher performance – Amazon EBS makes advantage of SSD technology to deliver data results with consistent application I/O performance. Simple data backup – Take point-in-time snapshots of Amazon EBS volumes to save data backup. The benefits of Amazon EBS are as follows:
Reliable and Secure Storage – It automatically responds to its availability zone protecting it from component failure.
Secure – It allows us to specify access to EBS volumes.
Higher Performance – Delivers data results with consistent performance.
Easy Data Backup – Takes taking point-in-time snapshots of Amazon EBS volumes.
27. What is Elastic Block Store, and how does it work?
Amazon Elastic Block Store (EBS) is a high-performance, easy-to-use block storage service designed for use with Amazon Elastic Compute Cloud (EC2) for both throughput and transaction-intensive workloads at any scale. Amazon EBS is a storage service that provides block-level storage volumes for AWS EC2 instances. EBS volumes are off-instance storage that lasts indefinitely. It’s a simple-to-use block storage service designed to integrate with AWS EC2 for high-throughput and transaction-intensive operations at any scale.
28. How can I change an existing EBS volume’s capacity, performance, or type?
To change the capacity, performance, or type of an existing Amazon Elastic Block Store (EBS) volume, you can use the following steps:
- First, you need to stop the Amazon Elastic Compute Cloud (EC2) instance that the EBS volume is attached to. You cannot modify an EBS volume while it is in use.
- Detach the EBS volume from the EC2 instance. You can do this by right-clicking on the volume in the Amazon EC2 console and selecting “Detach Volume”, or by using the
aws ec2 detach-volume
command. - Change the volume’s capacity, performance, or type. You can do this by right-clicking on the volume in the Amazon EC2 console and selecting “Modify Volume”, or by using the
aws ec2 modify-volume
command. - Attach the modified EBS volume to the EC2 instance. You can do this by right-clicking on the volume in the Amazon EC2 console and selecting “Attach Volume”, or by using the
aws ec2 attach-volume
command. - Start the EC2 instance.
It’s important to note that some changes to an EBS volume, such as changing the volume type, may result in data loss or the need to reformat the volume. It’s always a good idea to take a snapshot of your EBS volume before making any changes, so you can restore the volume if needed.
29. What is the Amazon Web Services (AWS) Key Management Service (KMS)?
AWS KMS is a managed service that allows you to easily produce and maintain the encryption keys that are used to encrypt your data. AWS Key Management Service works with other AWS services like Amazon EBS, Amazon S3, and Amazon Redshift to make it simple to encrypt your data with encryption keys you control. AWS Key Management Service and AWS CloudTrail are connected to provide you with logs of all key usage to help you satisfy your regulatory and compliance requirements.