EduFlow
AWS Cloud Foundations
0%

Section 3 · Core Services

Storage: Amazon S3, EBS and EFS

17 min4 min readFill in the blanks

Lesson at a glance

Store Lantern’s posters and backups in Amazon S3 with the right storage class, versioning and Block Public Access, and know when an EC2 workload needs EBS or EFS instead.

  1. 1Amazon S3: objects in buckets
  2. 2Disks for servers: EBS and EFS

No video here — just the real thing: a written lesson, runnable examples, a quiz and practice.

On Lantern’s old server, “storage” was one disk that filled up. On AWS you get three different kinds, each shaped for a different job: objects in Amazon S3, block disks in Amazon EBS, and shared files in Amazon EFS. Most of Lantern’s data belongs in the first.

Amazon S3: objects in buckets

S3 stores objects (any bytes, up to 50 TB each) in buckets. An object is addressed by its key, such as posters/2026/street-food-festival.jpg. The slashes look like folders, and the console draws them as folders, but S3 has no directories: the key is one string, and posters/2026/ is a prefix. Bucket names are unique across all of AWS; the bucket itself lives in the Region you choose.

Terminal
aws s3 mb s3://lantern-posters --region eu-west-1
aws s3 cp ./posters/ s3://lantern-posters/posters/ --recursive
aws s3 ls s3://lantern-posters/posters/2026/

Safe by default, and keep it that way

New buckets come with three protections switched on: Block Public Access (all four settings on), Object Ownership set to bucket owner enforced (access control lists disabled, so only policies grant access), and default encryption with S3-managed keys. You change access with bucket policies, as you did in section two.

Leave Block Public Access on for every bucket that isn’t deliberately public, and set it at the account level too, so a single mistaken bucket can’t become public:

Terminal
aws s3control put-public-access-block --account-id 111122223333 \
  --public-access-block-configuration \
  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

In section four Lantern’s website is served to the public without making any bucket public: CloudFront reads the bucket privately on visitors’ behalf.

Storage classes: same API, different price shape

Every object has a storage class. They are all designed for the same eleven nines (99.999999999%) of durability; they differ in how you pay.

Class Best for The catch
S3 Standard (default) Frequently read data Highest storage price
S3 Intelligent-Tiering Unknown or changing access Small per-object monitoring fee
S3 Standard-IA Read about monthly, needs millisecond access Retrieval fee, 30-day minimum
S3 One Zone-IA Re-creatable copies One AZ only
S3 Glacier Instant Retrieval Read about quarterly, millisecond access Higher retrieval fee, 90-day minimum
S3 Glacier Flexible Retrieval Archives, minutes to hours to restore Restore before reading
S3 Glacier Deep Archive Rarely touched, hours to restore 180-day minimum

The price model has three parts: per GB stored per month, per request, and, for the infrequent and archive classes, per GB retrieved. A cheaper storage class with frequent reads can cost more than Standard. Small objects are also a trap: the IA classes bill each object as at least 128 KB.

For Lantern: current posters stay in Standard, posters older than a year move to Glacier Instant Retrieval (they still appear on old event pages), and monthly database exports go to Deep Archive.

Versioning: an undo button with a price

With versioning on, overwriting or deleting an object keeps the old version. A delete adds a delete marker instead of destroying data, so an accidental aws s3 rm is recoverable. Once enabled, versioning can only be suspended, never fully removed.

Terminal
aws s3api put-bucket-versioning --bucket lantern-posters \
  --versioning-configuration Status=Enabled

Every version is billed as a full object, so pair versioning with a lifecycle rule that moves and expires data automatically:

lifecycle.json
{
  "Rules": [
    {
      "ID": "age-out-posters",
      "Filter": { "Prefix": "posters/" },
      "Status": "Enabled",
      "Transitions": [{ "Days": 365, "StorageClass": "GLACIER_IR" }],
      "NoncurrentVersionExpiration": { "NoncurrentDays": 30 }
    }
  ]
}
Terminal
aws s3api put-bucket-lifecycle-configuration --bucket lantern-posters \
  --lifecycle-configuration file://lifecycle.json

Disks for servers: EBS and EFS

Some software needs a real file system. That is where the other two services come in.

S3 is accessed by any client over HTTPS. An EBS volume attaches to a single EC2 instance inside one Availability Zone. An EFS file system is mounted by instances in two Availability Zones at once. Amazon S3 objects via API browsers, Lambda, CLI AZ a EC2 instance EBS volume AZ b EC2 instance Amazon EFS
S3 is reached over HTTPS, EBS attaches to one instance, EFS is shared

Amazon EBS (Elastic Block Store) is a network disk for one EC2 instance, in one Availability Zone. Almost every instance boots from one. gp3 is the general-purpose SSD type to start with. You pay for the provisioned size, not what you fill, so a 500 GB volume holding 20 GB costs the same as a full one. Snapshots back volumes up incrementally to storage that survives the loss of the AZ.

Amazon EFS (Elastic File System) is a managed NFS file system that many instances, across AZs, mount at the same time. It grows and shrinks with your files and bills per gigabyte actually stored, at a higher rate per gigabyte than EBS. Use it when several servers must share one directory tree.

For Lantern, the answer is mostly “neither”: posters live in S3, where Lambda and CloudFront can reach them. The temporary migration server gets one small gp3 volume, and no EFS at all.

Files are settled. Next: the data that changes every second, in a database.

Key takeaways

  • Amazon S3 stores objects under keys in buckets, and new buckets block public access, disable ACLs and encrypt objects by default.
  • Storage classes trade storage price against retrieval cost, retrieval speed and minimum storage duration; S3 Standard is the default.
  • Versioning keeps every version of every object, which protects against overwrites and deletes but bills for each stored version until a lifecycle rule expires it.
  • Amazon EBS is a block disk for one EC2 instance in one Availability Zone, billed per provisioned gigabyte.
  • Amazon EFS is a shared file system that many instances across AZs can mount at once, billed per gigabyte actually stored.

Further reading

Check your understanding

3 questions

Question 1 of 3

Lantern keeps monthly database exports for seven years and expects to restore one perhaps once a year, with a few hours’ wait acceptable. Which storage class fits?

Question 2 of 3

Versioning is on for the posters bucket. An organiser re-uploads the same poster 40 times while tweaking it. What happens to storage costs?

Question 3 of 3

Three EC2 instances in different Availability Zones must read and write the same set of uploaded files through a normal file system path. What do you use?

Practice

Fill in the blanks

Upload, protect and archive

Finish three commands for Lantern’s storage. Step 1 copies the local posters/ folder and all its subfolders into the bucket with the copy command. Step 2 turns on versioning. Step 3 uploads a database export that must be kept for seven years at the lowest storage price, where waiting hours for a restore is acceptable. Use the storage class’s API name, in capitals.

# 1. Upload the whole local posters folder, including subfolders aws s3 ./posters/ s3://lantern-posters/posters/ -- # 2. Keep old versions when posters are overwritten or deleted aws s3api put-bucket-versioning --bucket lantern-posters \ --versioning-configuration Status= # 3. Store this month's export in the cheapest archive class aws s3 cp ./exports/2026-09.sql.gz s3://lantern-backups/exports/ \ --storage-class