Tech Interview RoomStudy guides

AWS

Explain S3 storage classes, consistency, presigned URLs and using CloudFront.

Intermediate · 2 min read · Lesson 3 of 7 in AWS

S3 fundamentals

  • Object storage: buckets and keys, objects up to 5 TB, 11 nines of durability (replicated across at least three AZs for standard classes).
  • Strong read-after-write consistency for all PUTs and DELETEs (since December 2020), including listing.
  • Versioning, lifecycle rules, Object Lock (WORM), replication (same- and cross-region), event notifications to SQS, SNS, Lambda or EventBridge.
  • Security: Block Public Access on, bucket policies, SSE-S3 or SSE-KMS encryption by default, access points.

Storage classes

Standard (hot), Intelligent-Tiering (automatic tiering for unknown access patterns), Standard-IA and One Zone-IA (infrequent access, retrieval fee), Glacier Instant Retrieval, Glacier Flexible Retrieval (minutes to hours) and Glacier Deep Archive (hours, cheapest). Lifecycle rules move objects between classes and expire them.

Presigned URLs

The backend signs a time-limited URL with its credentials so the client uploads or downloads directly to or from S3, without streaming large files through your service and without making the bucket public. Validate the object after upload (size, type, malware scan via an S3 event).

CloudFront

CDN in front of S3 or your ALB: edge caching, TLS, compression, HTTP/2 and HTTP/3, WAF integration. Use Origin Access Control so the bucket is private and only CloudFront can read it, and signed URLs or cookies for private content.

Example

java
S3Presigner presigner = S3Presigner.create();
PutObjectRequest put = PutObjectRequest.builder()
        .bucket("invoices-uploads").key("tenant-42/" + UUID.randomUUID() + ".pdf")
        .contentType("application/pdf").build();
URL uploadUrl = presigner.presignPutObject(r -> r
        .signatureDuration(Duration.ofMinutes(10))
        .putObjectRequest(put)).url();
// Return uploadUrl to the client; it PUTs the file directly to S3

Follow-up questions interviewers ask

Try answering each one before you open it.

How do you upload very large files reliably?

Use multipart upload: split the file into parts (5 MB to 5 GB each, up to 10,000 parts), upload them in parallel and retry individual parts, then complete the upload. Clients can do this directly with presigned URLs per part. Add a lifecycle rule to abort incomplete multipart uploads, which otherwise keep incurring storage costs. S3 Transfer Acceleration helps for distant clients.