CL·88
Cloud Storage
Object, block and file storage in the cloud: how object stores work (buckets, keys, metadata, consistency, multipart uploads, presigned URLs, conditional writes, events), storage classes and lifecycle policies, versioning and object lock, replication, encryption (SSE, KMS, envelope encryption, client-side), access control and public-access protection; block storage (EBS, Azure Managed Disks, Persistent Disk: types, IOPS and throughput, snapshots); file storage (EFS, Azure Files, Filestore, FSx); durability versus availability; backups; and choosing, with SDK code in Java, Go, Python, Rust and TypeScript.
Start here: three ways to store bytes
Object, block and file
Cloud storage comes in three shapes, and choosing the wrong one is a common, expensive mistake:
| Object storage | Block storage | File storage | |
|---|---|---|---|
| What you get | Buckets of objects, each a whole blob with a key and metadata | A raw virtual disk attached to one instance | A shared filesystem mounted by many machines |
| Access | HTTP API (PUT, GET, LIST, DELETE) | The OS formats and mounts it (ext4, XFS) | NFS or SMB |
| Update model | Replace whole objects (no append or in-place edit) | Read and write any block | POSIX files: open, seek, write, lock |
| Scale | Practically unlimited; very high aggregate throughput | One volume, sized and provisioned (IOPS, MB/s) | Elastic, shared, higher latency than block |
| Examples | S3, Azure Blob, Cloud Storage | EBS, Azure Managed Disks, Persistent Disk | EFS, FSx, Azure Files, Filestore |
| Typical use | Uploads, media, backups, logs, data lakes, static sites | Databases, boot disks, anything needing a filesystem on one host | Shared content, home directories, legacy apps |
Object storage is not a filesystem
1) list with prefix 'orders/' and delimiter '/': ['orders/2026-10-29/', 'orders/2026-10-30/']
list with prefix 'orders/2026-10-30/': ['orders/2026-10-30/order-0.json', 'orders/2026-10-30/order-1.json']
head_object: {'ContentLength': 12, 'ContentType': 'application/json', 'ETag': '"549f43409a214c5a2b1d4ef2915927cc"', 'Metadata': {'source': 'app'}}
2) after two PUTs to log.txt, its content is: 'line 2\n'
a byte range of a larger object: '{"order": '
There are no directories: orders/2026-10-30/order-0.json is one key, and "folders" are just shared prefixes that a LIST with a delimiter groups for display. Each object carries its own metadata and an ETag (here an MD5 of the content). A second PUT to log.txt replaced it: there's no append, so a log written line by line to object storage needs one object per batch, not one growing file. You can read a byte range, which is how analytics engines read just the columns they need from large Parquet files. Since December 2020, S3 has been strongly consistent: a read after a successful write or delete sees the new state, including in listings.
Block storage is a disk, with a performance budget
A block volume behaves like a local disk, but its performance is provisioned and billed. On this VM's own virtual disk:
randread bs=4k depth=32: 128,016 IOPS, 500 MiB/s, p50 175 µs, p99 741 µs
randwrite bs=4k depth=1: 10,567 IOPS, 41 MiB/s, p50 63 µs, p99 297 µs
read bs=1M depth=4: 2,279 IOPS, 2,279 MiB/s
Two numbers describe a disk: IOPS (operations per second, what small random reads and writes need: databases) and throughput (MB/s, what large sequential reads need: analytics, backups). A cloud volume type sets both: AWS's general-purpose gp3, for example, starts at a baseline of 3,000 IOPS and 125 MB/s whatever its size, and you pay to provision more; io2 volumes provision up to 256,000 IOPS with sub-millisecond latency. A volume lives in one availability zone and attaches to one instance at a time (with niche exceptions), so its data survives the instance but not the zone: snapshots (stored in object storage) are how you protect and copy it.
How deep to go in cloud storage
Volume 17 defines six mastery levels. For this chapter they look like this; the chapter aims at L3 everywhere, and its lab at L4.
| Level | What you can do |
|---|---|
| L1 | Explain object, block and file storage and when each fits |
| L2 | Use buckets with versioning, lifecycle, encryption and presigned URLs; size volumes |
| L3 | Explain consistency, multipart uploads, storage classes, envelope encryption and snapshots |
| L4 | Diagnose slow volumes, request-cost explosions, access-denied errors and lost-data incidents |
| L5 | Design data layout, retention, protection and replication for an organisation's data |
| L6 | Operate petabyte-scale storage with governance, cost controls and recovery testing |
Three kinds of storage
| Object | Block | File | |
|---|---|---|---|
| Interface | HTTP API: PUT, GET, LIST, DELETE whole objects |
Raw device; the OS formats and mounts it | POSIX filesystem over NFS / SMB |
| Unit | Object (bytes + metadata), up to 5 TB (S3) | Block (fixed-size sectors) | File and directory |
| Sharing | Any number of clients concurrently | One instance (multi-attach is limited and needs cluster-aware filesystems) | Many clients |
| Scope | Regional (data spread over AZs) | Zonal | Regional or zonal |
| Latency | Tens of ms first byte (S3 Express One Zone: single-digit ms) | Sub-millisecond to ~1 ms | Low ms |
| Scale | Practically unlimited | Up to 64 TiB per volume (io2 Block Express) | Petabytes, elastic |
| Price | Lowest per GB, plus per-request charges | Medium, pay for provisioned size | Highest per GB |
| Typical use | Media, backups, data lakes, static websites, logs, ML datasets, artefacts | Boot disks, databases on VMs, Kafka brokers | Shared content, legacy apps, home directories, ML training data needing POSIX |
Object storage
The model
Amazon S3 (2006) defined the model; Azure Blob Storage, Google Cloud Storage and many S3-compatible systems (Cloudflare R2, Backblaze B2, MinIO, Ceph RGW, Wasabi) follow it.
- A bucket (Azure: storage account → container) is a named, regional container with a globally unique name (S3) and configuration: versioning, encryption, lifecycle, replication, access policies.
- An object is a key (string, up to 1,024 bytes), data, metadata (system metadata like
Content-Typeplus user metadata) and tags (key-value pairs for lifecycle, access and cost allocation). - The namespace is flat:
invoices/2026/10/inv-981.pdfis just a key. "Folders" are a UI convention built from key prefixes and the/delimiter inLISTrequests. - Objects are immutable as a whole: to change one byte you upload a new version of the entire object (no in-place edits or appends in standard S3; S3 Express One Zone supports appends).
Consistency
- S3 has offered strong read-after-write consistency for all PUTs, DELETEs and LISTs since December 2020: after a successful write, any subsequent read or list sees it.
- Conditional writes:
If-None-Match: *(create only if the key doesn't exist) andIf-Match: <etag>(update only if unchanged) since 2024, enabling compare-and-set on objects: safe leader election files, optimistic concurrency, and lock-free table formats. - Azure Blob and GCS are also strongly consistent, with ETags and generation preconditions.
- No multi-object transactions: table formats such as Apache Iceberg, Delta Lake and Hudi build ACID tables on top of object stores (Vol. 4 ch. 63); S3 Tables offers managed Iceberg.
Uploads, downloads and performance
- Multipart upload: split large objects into parts (5 MB–5 GB each, up to 10,000 parts), upload in parallel, retry individual parts, then complete. SDK "transfer managers" do this automatically. Configure lifecycle rules to abort incomplete multipart uploads (orphaned parts are billed).
- Byte-range GETs for parallel downloads and reading parts of files (Parquet footers).
- Request rates: S3 scales to at least 3,500 writes and 5,500 reads per second per prefix, and partitions automatically as load grows; spreading hot data across prefixes and retrying 503 "SlowDown" responses with backoff handles bursts.
- Presigned URLs: time-limited URLs signed with your credentials that let a browser or third party
GETorPUTone object directly, without proxying bytes through your servers and without giving them credentials. The standard pattern for user uploads. - Transfer Acceleration, CloudFront in front of buckets, and same-region access (avoid cross-region data transfer charges).
- Event notifications: object created/deleted events to Lambda, SQS, SNS or EventBridge (Azure Event Grid, GCS Pub/Sub notifications): the basis of event-driven pipelines (upload → thumbnail → index).
// Java: S3 presigned PUT URL for direct browser upload, and a conditional "create if absent"
try (S3Presigner presigner = S3Presigner.create()) {
PutObjectRequest put = PutObjectRequest.builder()
.bucket("acme-uploads").key("users/42/avatar.png").contentType("image/png").build();
PresignedPutObjectRequest p = presigner.presignPutObject(r -> r
.signatureDuration(Duration.ofMinutes(10)).putObjectRequest(put));
System.out.println(p.url()); // hand this to the client
}
try (S3Client s3 = S3Client.create()) {
s3.putObject(b -> b.bucket("acme-locks").key("jobs/nightly-2026-10-24").ifNoneMatch("*"),
RequestBody.fromString("owner=worker-7")); // 412 PreconditionFailed if it exists
}
// Go: streaming multipart upload with the transfer manager
uploader := manager.NewUploader(s3.NewFromConfig(cfg), func(u *manager.Uploader) {
u.PartSize = 64 * 1024 * 1024
u.Concurrency = 8
})
f, _ := os.Open("backup.tar.zst")
defer f.Close()
_, err := uploader.Upload(ctx, &s3.PutObjectInput{
Bucket: aws.String("acme-backups"),
Key: aws.String("db/2026-10-24/backup.tar.zst"),
Body: f,
ServerSideEncryption: types.ServerSideEncryptionAwsKms,
SSEKMSKeyId: aws.String("alias/backups"),
})
# Python: list with prefix/delimiter ("folders") and download a byte range
import boto3
s3 = boto3.client("s3")
pages = s3.get_paginator("list_objects_v2").paginate(Bucket="acme-lake", Prefix="events/2026/10/", Delimiter="/")
for page in pages:
for cp in page.get("CommonPrefixes", []):
print("dir ", cp["Prefix"])
for obj in page.get("Contents", []):
print("file", obj["Key"], obj["Size"])
tail = s3.get_object(Bucket="acme-lake", Key="events/2026/10/part-0001.parquet", Range="bytes=-65536")
footer = tail["Body"].read() # last 64 KiB: Parquet metadata
// Rust: aws-sdk-s3 get object, streaming the body
let resp = s3.get_object().bucket("acme-media").key("videos/intro.mp4").send().await?;
let mut body = resp.body.into_async_read();
let mut file = tokio::fs::File::create("intro.mp4").await?;
tokio::io::copy(&mut body, &mut file).await?;
// TypeScript: presigned GET URL valid for 5 minutes
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
const url = await getSignedUrl(new S3Client({}),
new GetObjectCommand({ Bucket: "acme-invoices", Key: "2026/10/inv-981.pdf" }), { expiresIn: 300 });
Storage classes
Object stores price by access pattern: cheaper storage costs more (or takes longer) to retrieve.
| Class (S3 / Azure / GCS) | Retrieval | Minimum storage duration | Use |
|---|---|---|---|
| Standard / Hot / Standard | Immediate | — | Frequently accessed data |
| Intelligent-Tiering (S3) / Smart tier / Autoclass (GCS) | Immediate (archive tiers optional) | — | Unknown or changing access patterns: moves objects automatically for a small monitoring fee |
| Standard-IA, One Zone-IA / Cool / Nearline | Immediate, per-GB retrieval fee | 30 days | Infrequent access: backups, older logs. One Zone-IA stores in one AZ (re-creatable data only) |
| Glacier Instant Retrieval / Cold / Coldline | Milliseconds, higher retrieval fee | 90 days | Rarely accessed but needed quickly (medical images, old user uploads) |
| Glacier Flexible Retrieval / — / Archive | Minutes to hours | 90 days | Archives |
| Glacier Deep Archive / Archive / Archive | Hours (up to ~12–48 h) | 180 days (365 on GCS Archive) | Compliance retention for years; tape replacement |
| S3 Express One Zone | Single-digit ms, one AZ | — | High-performance, latency-sensitive data near compute (ML training, analytics scratch) |
Watch the per-request and minimum-duration charges: millions of tiny objects in IA classes can cost more than Standard (S3 IA bills small objects as 128 KB minimum).
Lifecycle policies
Lifecycle rules transition or expire objects automatically by age, prefix, tags, size or version status:
{
"Rules": [
{
"ID": "logs-tiering",
"Filter": { "Prefix": "logs/" },
"Status": "Enabled",
"Transitions": [
{ "Days": 30, "StorageClass": "STANDARD_IA" },
{ "Days": 180, "StorageClass": "GLACIER_IR" },
{ "Days": 365, "StorageClass": "DEEP_ARCHIVE" }
],
"Expiration": { "Days": 2555 }
},
{
"ID": "versions-and-uploads-cleanup",
"Filter": {},
"Status": "Enabled",
"NoncurrentVersionExpiration": { "NoncurrentDays": 90, "NewerNoncurrentVersions": 5 },
"AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 },
"Expiration": { "ExpiredObjectDeleteMarker": true }
}
]
}
Versioning and object lock
- Versioning keeps every version of every object. Overwrites create new versions; a
DELETEwithout a version ID only adds a delete marker (the object "disappears" but older versions remain and can be restored). It protects against accidental overwrites and deletes, and many application bugs. Pair it with lifecycle rules for non-current versions, or storage grows forever. - MFA delete requires multi-factor authentication to permanently delete versions.
- Object Lock (S3; Azure immutable blob storage; GCS bucket lock / object retention) gives WORM (write once, read many):
- Governance mode: protected unless a user has a special permission to bypass.
- Compliance mode: nobody, including the root account, can delete or shorten retention until it expires. Meets regulatory retention (SEC 17a-4, FINRA) and defeats ransomware.
- Legal holds: indefinite protection until removed.
Replication
- Cross-Region Replication (CRR) and Same-Region Replication (SRR) in S3 copy new objects (and optionally deletes, metadata, tags, and existing objects via batch replication) to another bucket, possibly in another account (protecting against account compromise). Replication Time Control offers a 15-minute SLA.
- Azure: geo-redundant storage (GRS: async copy to the paired region, read access with RA-GRS), zone-redundant (ZRS: synchronous across 3 AZs), GZRS (both); object replication between accounts.
- GCS: dual-region and multi-region buckets (with optional turbo replication, 15-minute RPO for dual-region).
- Replication is not a backup: deletes and corruption replicate too (unless excluded), so combine replication with versioning, object lock, or separate backups.
Access control
Object storage is the single most common source of cloud data leaks. Layers of control:
- Block Public Access at account and bucket level (S3; on by default for new buckets since 2023); Azure "allow blob public access = false"; GCS public access prevention and uniform bucket-level access.
- IAM policies on principals (chapter 89) and bucket policies on the resource (e.g. deny any request not using TLS, allow only a specific VPC endpoint or organisation).
- Object ownership: bucket owner enforced (ACLs disabled), so the bucket owner owns every object and access is policy-only.
- Presigned URLs or CloudFront signed URLs/cookies for temporary, scoped access, rather than public objects.
- Access points (named endpoints with their own policies) for large shared buckets; S3 Access Grants map corporate identities to prefixes.
- Detection: IAM Access Analyzer flags buckets shared outside your organisation; Macie (AWS), Purview (Azure), Sensitive Data Protection (GCP) find personal data.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyInsecureTransport",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": ["arn:aws:s3:::acme-invoices", "arn:aws:s3:::acme-invoices/*"],
"Condition": { "Bool": { "aws:SecureTransport": "false" } }
},
{
"Sid": "OnlyFromOurVpcEndpoint",
"Effect": "Deny",
"Principal": "*",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": "arn:aws:s3:::acme-invoices/*",
"Condition": { "StringNotEquals": { "aws:SourceVpce": "vpce-0a1b2c3d4e5f" } }
}
]
}
Encryption
At rest
All three hyperscalers now encrypt object storage at rest by default (S3 since January 2023 with SSE-S3). Options:
| Option | Keys managed by | Control and audit |
|---|---|---|
| SSE-S3 / Microsoft-managed / Google-managed | The provider, transparently | Least effort; no per-key access control |
| SSE-KMS / customer-managed keys (CMK) in Key Vault / Cloud KMS (CMEK) | You, in the provider's KMS | Key policies decide who can decrypt; every use is logged; you can disable or rotate the key (crypto-shredding) |
| DSSE-KMS (S3) | Two layers of encryption | Compliance requirements for dual-layer encryption |
| SSE-C / customer-provided keys | You supply the key with each request | Provider never stores the key; you must manage it perfectly |
| Client-side encryption | You encrypt before upload (AWS Encryption SDK, Tink) | Provider never sees plaintext; you lose server-side features (search, some analytics) |
| External keys (BYOK/HYOK: AWS KMS External Key Store, Azure Managed HSM, Google Cloud EKM) | Keys in your own HSM outside the provider | Sovereignty requirements; availability depends on your key service |
Envelope encryption
KMS services don't encrypt your large data directly (KMS requests are limited to small payloads, about 4 KB). They use envelope encryption:
- Ask KMS for a data key (
GenerateDataKey): KMS returns the data key in plaintext and encrypted under your KMS key (the "wrapped" key). - Encrypt the data locally with the plaintext data key (AES-256-GCM), then discard the plaintext key from memory.
- Store the encrypted data with the encrypted data key next to it.
- To decrypt, send the encrypted data key to KMS (
Decrypt, checked by key policy and logged), get the plaintext key back, decrypt the data locally.
Why: bulk data never travels to KMS; the master key never leaves the HSM; revoking access to one KMS key makes all its data unreadable (crypto-shredding: delete or disable the key to "erase" data); and every decryption is audited (CloudTrail). S3 SSE-KMS does this for you per object (S3 Bucket Keys reduce KMS request costs).
In transit
Enforce TLS (bucket policy aws:SecureTransport), use private endpoints, and remember that TLS between your service and the storage API is separate from encryption at rest.
Block storage
Volumes
Block storage provides network-attached virtual disks (not physically local, despite appearances): EBS (AWS), Azure Managed Disks, Persistent Disk and Hyperdisk (GCP).
| Type (AWS / Azure / GCP) | Performance model | Use |
|---|---|---|
| gp3 / Premium SSD v2 / Hyperdisk Balanced, pd-balanced | Baseline 3,000 IOPS + 125 MB/s, IOPS and throughput provisioned independently of size | Default for most workloads |
| io2 Block Express / Ultra Disk / Hyperdisk Extreme | Up to 256,000 IOPS, sub-ms latency, higher durability (io2: 99.999%) | Large databases, latency-critical I/O |
| st1 / sc1 (throughput HDD) / Standard HDD | MB/s-oriented, low IOPS | Big sequential scans, logs, cold data |
| Instance store / local SSD | Physically attached NVMe, very fast | Caches, scratch, replicated stores (Kafka, Cassandra); data lost when the instance stops or fails |
Key facts:
- Volumes live in one AZ and attach to instances in that AZ (relevant to Kubernetes scheduling, chapter 83 of Vol. 6).
- Performance is provisioned: IOPS (I/O operations per second), throughput (MB/s), and the instance's own EBS bandwidth limit, whichever is lowest. A large
io2volume on a small instance is limited by the instance. - I/O size matters: IOPS × I/O size = throughput. Databases doing 8–16 KiB random I/O are IOPS-bound; streaming is throughput-bound.
- Encrypt volumes (account-level default encryption with KMS), resize online (
aws ec2 modify-volume, then grow the filesystem), and change type without detaching.
Snapshots
Snapshots are point-in-time, incremental copies of a volume stored regionally (on S3 for EBS). Use them for backups, for creating new volumes in other AZs (the way to "move" a disk across zones), for golden images, and for copying across regions and accounts. Crash-consistent by default; for application consistency, quiesce or use database-native backup tools, or multi-volume crash-consistent snapshot sets. Fast snapshot restore avoids the lazy-loading latency of new volumes created from snapshots. Snapshots of deleted volumes keep costing money: apply lifecycle policies (Data Lifecycle Manager, AWS Backup).
File storage
| Service | Protocol | Notes |
|---|---|---|
| Amazon EFS | NFSv4.1 | Elastic, regional (multi-AZ), pay per GB used; elastic throughput; lifecycle to IA tiers; mount from EC2, ECS, EKS, Lambda |
| Amazon FSx | Windows (SMB), Lustre (HPC/ML), NetApp ONTAP, OpenZFS | Purpose-built file systems |
| Azure Files | SMB and NFS | Premium (SSD) and standard tiers; Azure File Sync for hybrid |
| Azure NetApp Files | NFS/SMB | Enterprise performance |
| Google Filestore | NFS | Basic, zonal, regional tiers |
| Mountpoint for S3, gcsfuse, BlobFuse | FUSE adapters | Present object storage as files for read-heavy workloads; not full POSIX (no in-place edits, limited rename semantics) |
Use file storage when applications need shared POSIX semantics (CMSs with shared uploads, legacy apps, ML training reading many files, home directories). Prefer object storage for new designs that can use an API: it's cheaper, scales further and integrates with events and analytics. Watch NFS performance characteristics: metadata-heavy workloads (many small files, ls on huge directories) are slow; latency is higher than local disk.
Durability versus availability
| Storage | Durability (designed) | Availability (designed / SLA) | Survives AZ loss? |
|---|---|---|---|
| S3 Standard | 11 nines | 99.99% (SLA 99.9%) | Yes (≥ 3 AZs) |
| S3 One Zone-IA / Express One Zone | 11 nines within one AZ | 99.5% / 99.95% | No |
| EBS gp3 | 99.8–99.9% annual (AFR 0.1–0.2%) | 99.99% | No: snapshot or replicate |
| EBS io2 | 99.999% | 99.99% | No |
| EFS Regional | 11 nines | 99.99% | Yes |
| Azure LRS / ZRS / GRS | 11 / 12 / 16 nines | depends | LRS no; ZRS yes; GRS survives region loss (async) |
| Instance store | Lost on stop or host failure | — | No |
The lessons:
- Durability is about losing data permanently; availability is about reaching it now. A regional outage can make durable data unavailable for hours.
- Designed durability says nothing about logical loss: deletes, overwrites, corruption by bugs, ransomware, compromised credentials. That's what versioning, object lock, point-in-time recovery and isolated backups are for.
- Backups: follow 3-2-1 (3 copies, 2 media/services, 1 off-site), adapted for cloud: copies in a separate account (with restrictive access, ideally a vault with object lock), in a separate region, with immutability. AWS Backup (with Vault Lock), Azure Backup, Google Backup and DR centralise this.
- Test restores regularly and measure RPO (how much data you can lose) and RTO (how long recovery takes). Untested backups are hopes, not backups.
Choosing storage
| Need | Choose |
|---|---|
| User uploads, media, static assets, documents | Object storage + CDN + presigned URLs |
| Data lake, analytics, ML datasets | Object storage with Parquet/Iceberg; Express One Zone for hot training data |
| Database on a VM, broker logs | Block storage (gp3, io2 for demanding), snapshots + native backups |
| Temporary scratch, caches | Instance store / local SSD |
| Shared files across many instances or pods | EFS / Azure Files / Filestore (or redesign to object storage) |
| Long-term compliance archives | Archive classes + object lock (compliance mode) + lifecycle |
| Ransomware-resistant backups | Separate account + object lock / vault lock + cross-region copy |
Lab: versions, parts, keys, classes and IOPS
The AWS SDK for Python against moto 5.2 (an S3 API emulator), Python's cryptography library for envelope encryption, fio on the VM's virtual disk, and AWS us-east-1 list prices for October 2026 (S3 Standard $0.023/GB-month, Standard-IA $0.0125, Glacier Instant Retrieval $0.004, Glacier Deep Archive $0.00099; PUT $0.005 per 1,000).
Experiment 1: versioning, delete markers and undelete
after DELETE, GET menu.json → NoSuchKey
delete marker 751799b1… (latest: True)
version 379294f4… {"dosa": 95}
version 2395bfc3… {"dosa": 80}
after deleting the delete marker, GET → {"dosa": 95}
With versioning on, a DELETE didn't delete anything: it added a delete marker as the latest version, so ordinary reads saw "no such key" while both earlier versions stayed intact. Removing the marker restored the object. That's the protection against accidental deletes and overwrites that durability figures can't give you. Two cautions: old versions cost storage until a lifecycle rule expires them (NoncurrentVersionExpiration), and anyone with permission to delete specific versions can still destroy data, which is what Object Lock (write-once retention) and MFA delete prevent.
Experiment 2: multipart uploads
25 MiB uploaded as 4 parts of ≤8 MiB; ETag "6ce29a7c340b0444d1e2526dbf539191-4" (an MD5 of the parts' MD5s, with '-4': not the file's MD5)
file MD5 aeb88bb5bbf255ed6797251e01dd273b
Large objects are uploaded in parts (5 MiB to 5 GiB each, up to 10,000 parts, objects up to 50 TB since December 2025), which lets uploads run in parallel and resume after failures. Two consequences: the ETag of a multipart object isn't the file's MD5, so don't compare them for integrity (use the additional checksum algorithms, CRC64NVME by default for new uploads); and incomplete uploads keep their parts, billed, until you abort them, so every bucket should have a lifecycle rule AbortIncompleteMultipartUpload.
Experiment 3: envelope encryption
envelope: 58-byte ciphertext + 60-byte wrapped data key stored together
decrypt with the master key: {"customer": "asha", "card_last4": "4242"}
decrypt with any other key: InvalidTag
key rotation re-wrapped only the 60-byte data key; the data itself was untouched: {"customer": "asha",…
This is how KMS-backed encryption works (S3 with SSE-KMS, EBS, RDS, and the AWS Encryption SDK): each object gets its own data key, the data is encrypted with it (AES-256-GCM), and the data key is stored next to the data, wrapped (encrypted) by a master key that never leaves the key service. Decrypting means asking the key service to unwrap the data key, which is a permission check and an audit log entry, so controlling and logging access to the master key controls all the data. Rotating the master key only re-wraps data keys. Server-side encryption is now on by default everywhere; the real decisions are who can use the key (KMS key policies) and whether you need your own key for that control.
Experiment 4: storage classes and lifecycle
2 TB of order logs written per month, each month's batch kept for 3 years:
all Standard $30,636; lifecycle (IA after 1 month, Glacier IR after 3, Deep Archive after 12) $6,063
1 million 1 KB objects: PUT requests cost $5.00 once, storage $0.0219/month — requests, not bytes, dominate small objects
Moving data down the classes as it cools cut the 3-year storage bill by 80%. Colder classes charge for retrieval and have minimum storage durations (30 days for Standard-IA, 90 for Glacier Instant Retrieval, 180 for Deep Archive), and Deep Archive takes hours to restore, so match the rule to how the data is really used (S3 Intelligent-Tiering does it automatically for unknown patterns). For tiny objects, request charges dwarf storage: batch small records into larger objects.
Experiment 5: what a block volume can do
fio with direct I/O against a 1 GB file on the VM's virtual disk, 8 seconds each:
randread bs=4k depth=32: 128,016 IOPS, 500 MiB/s, p50 175 µs, p99 741 µs
randwrite bs=4k depth=32: 18,041 IOPS, 70 MiB/s, p50 995 µs, p99 20,054 µs
read bs=1M depth=4: 2,279 IOPS, 2,279 MiB/s, p50 1,614 µs
randwrite bs=4k depth=1: 10,567 IOPS, 41 MiB/s, p50 63 µs, p99 297 µs
The same disk gave very different answers depending on block size and queue depth: small random I/O is measured in IOPS, large sequential I/O in MB/s, and deep queues raise throughput at the cost of latency (random writes at depth 32 had a 20 ms p99 on this disk). Cloud volumes add a provisioned ceiling on top: a database doing 18,000 random writes per second would be throttled to 3,000 IOPS on a default gp3 volume, with latency rising as requests queue. Measure your workload's IOPS and throughput (CloudWatch VolumeReadOps, iostat), provision for it, and remember that many instance types also have their own EBS bandwidth limits.
Try it yourself
- Add a lifecycle configuration to the bucket in experiment 1 that expires noncurrent versions after 30 days and aborts incomplete multipart uploads after 7 days.
- Upload a 1 GB file with
boto3'sTransferConfig(multipart_chunksize=…, max_concurrency=…)against real S3 and find the fastest settings from your network. - Implement envelope encryption with the AWS Encryption SDK and a real KMS key (or LocalStack), and check CloudTrail for the
Decryptcalls. - Run experiment 5 on a gp3 volume with the defaults, then provisioned to 10,000 IOPS, and compare p99 latency.
Revision sheet: cloud storage
Key ideas
- Object storage: buckets, keys and prefixes, metadata, strong consistency, versioning and delete markers, lifecycle rules, storage classes, multipart uploads, byte ranges, presigned URLs, event notifications, replication (same/cross-region), Object Lock, static website hosting behind a CDN.
- Encryption: SSE-S3, SSE-KMS (envelope encryption, key policies, bucket keys), client-side encryption, TLS in transit, default encryption.
- Block storage: volume types (gp3, io2, st1/sc1, Premium SSD v2, Hyperdisk), IOPS, throughput, latency, queue depth, snapshots, multi-attach limits, instance store (ephemeral, fast).
- File storage: EFS, FSx (Windows, Lustre, NetApp ONTAP, OpenZFS), Azure Files, Filestore; throughput modes; POSIX semantics.
- Durability vs availability: 11 nines durability, SLA availability, zonal vs regional services, backup and restore testing.
- Choosing: access pattern, sharing, latency, cost per GB vs per request, retention.
Numbers to remember
- S3 objects up to 50 TB (since December 2025), parts 5 MiB–5 GiB, 10,000 parts.
- gp3 baseline 3,000 IOPS and 125 MB/s; io2 up to 256,000 IOPS.
- Storage minimums: Standard-IA 30 days, Glacier IR 90, Deep Archive 180.
- Lab: a delete marker hid both versions until removed; lifecycle cut a 3-year log bill from $30,636 to $6,063; 1 M tiny objects cost $5 in PUTs vs $0.02/month storage; 4K random reads 128k IOPS vs 1M reads 2.3 GiB/s on the same disk.
Pitfalls
- Treating S3 like a filesystem (appends, renames of millions of keys, small files).
- No versioning or Object Lock on critical buckets; unlimited noncurrent versions.
- Incomplete multipart uploads never aborted.
- Comparing multipart ETags with MD5s.
- Default volume IOPS for busy databases.
- Public buckets (keep Block Public Access on).
Glossary
- Delete marker: placeholder version that hides an object in a versioned bucket.
- Lifecycle rule: automatic transition or expiry of objects.
- Envelope encryption: data keys encrypting data, wrapped by a master key.
- IOPS: input/output operations per second.
- Snapshot: point-in-time copy of a volume, stored in object storage.
- Object Lock: write-once-read-many retention.