EBS, EFS and instance store
Choose block, shared-file or temporary storage, then verify encryption, snapshots and cleanup with the AWS CLI.
By the end of this lesson you'll be able to
0 of 5 completeThe storage decision
Before choosing a disk, ask what the application needs to store and how it will access it. A database needs a block device with predictable latency; a shared web fleet may need many servers to see the same files; a cache may be disposable. Picking by product name alone can leave data unavailable after a failure or add unnecessary cost.
AWS offers three common shapes here: EBS is a persistent block device for one Availability Zone, EFS is a regional network file system that clients can share, and instance store is fast local scratch storage tied to the host. Their failure and recovery behavior differ, so storage is part of the architecture, not just a size field in the launch wizard.
- EBS is a persistent block device for one Availability Zone. A running EC2 instance can format and mount it like a disk.
- EFS is a regional NFS file system. Multiple instances can mount it at the same time when the network path and permissions are correct.
- Instance store is local scratch storage on the host. It is fast, but it is temporary.
The root EBS volume and an attached data volume are separate resources. A snapshot is separate again. Deleting the instance does not automatically mean every independently created volume or snapshot is gone.
Use EBS for a server's boot disk or application data that needs a block device. Use EFS when multiple Linux clients need shared file access over the network. Use instance store only for data you can rebuild. Before deleting an instance, inspect its termination behavior and list volumes and snapshots separately. A common mistake is assuming "delete server" means "delete all storage"; independent volumes and recovery copies can remain billable.
EBS volume types
gp3 is the normal starting point. It gives a general-purpose SSD baseline and lets you set IOPS and throughput independently. Use io2 when the workload needs higher durability and sustained provisioned IOPS. st1 is throughput-oriented HDD storage for large sequential workloads. sc1 is the lowest-cost HDD option for infrequently accessed sequential data.
Do not choose st1 or sc1 for a database. Do not choose io2 just because it sounds more enterprise. Measure latency, IOPS, throughput and the recovery requirement first.
The temporary lesson volume was a 1 GiB encrypted gp3 volume:
{ "VolumeId": "vol-0bae53dac6ff74161", "State": "creating", "Size": 1, "Type": "gp3", "Encrypted": true, "AZ": "ap-south-1b" }
Snapshots
An EBS snapshot is incremental after the first snapshot and is stored independently of the source volume. It is a recovery building block, not a complete backup policy. Test restoring a volume, protect snapshot permissions and define retention.
The captured snapshot was encrypted, linked to the 1 GiB volume and completed with no data blocks:
{ "SnapshotId": "snap-0ffc0b305cb37c638", "State": "pending", "Encrypted": true, "VolumeId": "vol-0bae53dac6ff74161", "Size": 1 }
Encryption
Without encryption, a copied disk or snapshot may expose data outside the running instance. EBS encryption protects volume data at rest and snapshots derived from it, using a KMS key. New volumes can use the account's default EBS encryption setting; teams may choose a customer-managed key when they need to control key policy, auditing or cross-account sharing.
For a production system, decide who can use the key, who can create snapshots and who can copy them to another Region. The lesson volume and snapshot used encryption at rest. Existing unencrypted data may require a snapshot and copy workflow to encrypt it; enabling the account default affects new volumes, not every old volume.
Encryption does not grant access. IAM, KMS key policy, snapshot sharing and the instance's operating-system permissions still matter.
Use the default AWS-managed key when the built-in ownership and policy are sufficient. Use a customer-managed key when a team must administer grants, rotation settings or access separately. Test restore permissions as well as create permissions. A common mistake is removing a key policy or scheduling key deletion while encrypted volumes or snapshots still depend on that key.
EFS: a shared file system
EFS is regional, but clients connect through mount targets in VPC subnets. The file system can exist without a mount target, as it did in this lesson:
{ "FileSystemId": "fs-0ef4ae49937fb9368", "State": "creating", "Encrypted": true, "PerformanceMode": "generalPurpose", "ThroughputMode": "bursting", "MountTargets": 0 }
Create mount targets in the subnets where clients run, use security groups that allow NFS over TCP 2049, and mount with the recommended EFS helper. Mount targets are network resources with their own cost and should not be created casually in a teaching exercise.
Instance store: temporary by design
Some EC2 types include an NVMe instance store device physically attached to the host. It can provide fast local I/O without a separate network volume, but it is not a persistent recovery disk. Data may be lost when the instance stops, hibernates, terminates or moves to replacement hardware; exact behavior depends on the instance type and lifecycle event.
Use instance store for caches, temporary shuffle data or scratch processing that can be recreated. Keep the source data on EBS, S3 or another durable system. Do not use it as the only copy of a database or user upload. A common mistake is to confuse "local NVMe" with durable SSD storage; verify the instance's storage behavior and make the workload tolerate its loss.
Tune gp3 for the workload
An EBS volume's capacity and performance affect both application behavior and cost. gp3 separates size from provisioned IOPS (input/output operations per second) and throughput, so you can tune those settings without choosing a larger volume just to get more performance. Start with the included baseline and measure actual latency, queue depth and throughput before increasing them.
The CLI command below requests new IOPS and throughput values. EBS applies a modification asynchronously; the second command checks its state and target values. Do not assume the change is complete as soon as the API accepts the request.
$ aws ec2 modify-volume --volume-id "$VOLUME_ID" --iops 6000 --throughput 250 $ aws ec2 describe-volumes-modifications --volume-ids "$VOLUME_ID" \ --query 'VolumesModifications[].{State:ModificationState,Progress:Progress,IOPS:TargetIops,Throughput:TargetThroughput}' --output table
aws ec2 modify-volume --volume-id "$VOLUME_ID" --iops 6000 --throughput 250awsthe AWS command line
Use gp3 as the general-purpose starting point. Consider io2 when measured I/O requirements and durability needs justify its price. Increasing IOPS or throughput without evidence can raise cost without improving the application. A common mistake is tuning the disk before checking whether the application, CPU or network is the actual bottleneck.
FSx is a specialised file system
Some applications require a file protocol or storage behavior that a general-purpose file system does not provide. FSx is a family of managed file systems: Windows File Server supports SMB, Lustre targets high-throughput compute, and NetApp ONTAP or OpenZFS provide their own storage features and operational semantics.
Choose a specific FSx system because the software or workload needs its protocol or performance model, not just because an EBS volume is full. First compare the application's client support, latency, throughput, availability and backup requirements. EFS is often simpler for shared Linux NFS access. A common mistake is treating FSx as one interchangeable product; each file system has different deployment and pricing choices.
DLM automates snapshot retention
Taking snapshots manually is easy to forget, and old snapshots can accumulate without a retention rule. Data Lifecycle Manager (DLM) applies schedules to tagged EBS volumes or instances and creates snapshots on their behalf. A policy can retain a defined number or age of recovery points, reducing manual work across a fleet.
The CLI command lists enabled policies. To use DLM, define the target tags, schedule, retention and execution role, then verify the policy creates usable snapshots and removes only the intended old ones. AWS Backup is a broader policy service for supported resources and cross-account recovery controls; DLM focuses on EBS lifecycle automation.
$ aws dlm get-lifecycle-policies --state ENABLED --region ap-south-1 \ --query 'Policies[].{Id:PolicyId,Description:Description,State:State}' --output table
aws dlm get-lifecycle-policies --state ENABLED --region ap-south-1 \awsthe AWS command line--regionwhich Region
Use DLM for repeatable EBS snapshot schedules based on tags. Use AWS Backup when a consistent central policy must cover several AWS services. Neither tool proves your recovery process works: restore a snapshot into a test environment and verify the data. A common mistake is setting retention without checking which tags match or whether the retention period meets the system's recovery objectives.
AWS Backup
When each service has a separate backup schedule, teams can miss resources or apply inconsistent retention. AWS Backup centralizes backup plans, schedules, lifecycle settings and recovery points for supported services. It can apply policy across accounts and Regions when configured with the required permissions and vaults.
A plan selects resources through assignments, creates recovery points on a schedule, and applies retention rules. The vault is where those recovery points are organized and protected. A hand-created EBS snapshot is still useful for a one-off test, but it does not provide those governance controls by itself. Before adopting a plan, check that each resource type and operation is supported in the target Region and account.
A snapshot does not become a mounted disk automatically. Restore it into a new EBS volume in the target Availability Zone, then attach and mount that volume with the correct operating-system steps.
Tag every volume and snapshot with owner, system and retention information. Encrypt by default. Use AWS Backup or an equivalent policy for important data, and regularly test restore instead of assuming a snapshot is usable.
Use AWS Backup when you need centrally governed backups across supported services and accounts. Use a one-off snapshot for a controlled experiment, not as the only recovery plan for production. Test restores on a schedule, measure how long they take, and confirm the restored application works. A common mistake is counting successful backup jobs as proof of recoverability without ever restoring the data.
Compare and clean up storage
Create a t3.micro, an encrypted gp3 volume, a snapshot and an encrypted EFS file system. Inspect their relationships, then remove every resource and verify that each identifier is gone.
A verified storage inventory and a clean account with no lesson resources left behindReveal one safe solution
$ export AWS_REGION=ap-south-1 $ export AMI_ID="$(aws ec2 describe-images --owners amazon \ --filters 'Name=name,Values=al2023-ami-2023.*-x86_64' 'Name=state,Values=available' \ --query 'sort_by(Images,&CreationDate)[-1].ImageId' --output text)" $ export INSTANCE_ID="$(aws ec2 run-instances --region "$AWS_REGION" --image-id "$AMI_ID" \ --instance-type t3.micro --count 1 \ --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=storage-types-mission}]' \ --query 'Instances[0].InstanceId' --output text)" $ export AZ="$(aws ec2 describe-instances --region "$AWS_REGION" --instance-ids "$INSTANCE_ID" \ --query 'Reservations[0].Instances[0].Placement.AvailabilityZone' --output text)" $ export VOLUME_ID="$(aws ec2 create-volume --region "$AWS_REGION" --availability-zone "$AZ" \ --size 1 --volume-type gp3 --encrypted \ --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=storage-types-volume}]' \ --query VolumeId --output text)" $ aws ec2 wait volume-available --region "$AWS_REGION" --volume-ids "$VOLUME_ID" $ export SNAPSHOT_ID="$(aws ec2 create-snapshot --region "$AWS_REGION" --volume-id "$VOLUME_ID" \ --description storage-types-mission --query SnapshotId --output text)" $ export FILE_SYSTEM_ID="$(aws efs create-file-system --region "$AWS_REGION" --encrypted \ --performance-mode generalPurpose --throughput-mode bursting \ --tags Key=Name,Value=storage-types-efs --query FileSystemId --output text)" $ aws ec2 describe-volumes --region "$AWS_REGION" --volume-ids "$VOLUME_ID" \ --query 'Volumes[0].{State:State,Type:VolumeType,Size:Size,Encrypted:Encrypted,AZ:AvailabilityZone}' --output table --------------------------------------------- | DescribeVolumes | +------------+------+-------+---------+------+ | Encrypted | Size | State | Type | AZ | +------------+------+-------+---------+------+ | True | 1 | avail | gp3 | AZ | +------------+------+-------+---------+------+ $ aws ec2 delete-snapshot --region "$AWS_REGION" --snapshot-id "$SNAPSHOT_ID" $ aws ec2 delete-volume --region "$AWS_REGION" --volume-id "$VOLUME_ID" $ aws efs delete-file-system --region "$AWS_REGION" --file-system-id "$FILE_SYSTEM_ID" $ aws ec2 terminate-instances --region "$AWS_REGION" --instance-ids "$INSTANCE_ID" $ aws ec2 wait instance-terminated --region "$AWS_REGION" --instance-ids "$INSTANCE_ID" $ aws ec2 describe-volumes --region "$AWS_REGION" --volume-ids "$VOLUME_ID" An error occurred (InvalidVolume.NotFound) when calling the DescribeVolumes operation $ aws ec2 describe-snapshots --region "$AWS_REGION" --snapshot-ids "$SNAPSHOT_ID" An error occurred (InvalidSnapshot.NotFound) when calling the DescribeSnapshots operation $ aws efs describe-file-systems --region "$AWS_REGION" --file-system-id "$FILE_SYSTEM_ID" An error occurred (FileSystemNotFound) when calling the DescribeFileSystems operation
aws ec2 wait volume-available --region "$AWS_REGION" --volume-ids "$VOLUME_ID"awsthe AWS command line--regionwhich Region
The instance check should also return a terminated state before you finish. If you attach a volume in your own experiment, unmount it before deleting it.
Try it yourself
0 of 5 steps doneRun each task in your own account or terminal, then tick it off.
Quick check
Which storage is a zonal block device that you attach to an EC2 instance?
Official reading for this lesson
Or get every quiz answer right and it completes itself.
Something unclear, wrong or out of date in this lesson? Tell me, and I'll fix it.