Skip to main content

Command Palette

Search for a command to run...

AWS S3 (Simple Storage Service

Published
7 min readView as Markdown

What is AWS S3?

Amazon S3 (Simple Storage Service) is an object storage service provided by Amazon Web Services.
It is used to store, retrieve, and manage data like files, images, videos, backups, logs, and static website content.

Think of S3 like:

A very large, secure, and durable online storage where you keep files and access them anytime.


Why S3 is used

S3 is used because it provides:

  • Very high durability (99.999999999%)

  • Unlimited storage

  • High availability

  • Strong security

  • Low cost

  • Easy integration with other AWS services


Where S3 is used

S3 is commonly used in:

  • Static website hosting

  • Backup and restore

  • Application assets (images, videos, PDFs)

  • Logs storage

  • Data lakes

  • CI/CD artifacts

  • Big data and analytics

  • Media hosting


When to use S3

Use S3 when:

  • You need to store files, not OS disks

  • You want scalable storage

  • You need high durability

  • Data does not need low-latency block access

  • You want simple storage management

Do NOT use S3 when:

  • You need OS-level storage → use EBS

  • You need shared file system → use EFS


Core Concepts of S3 (Very Important)

1. Bucket

A bucket is a container for storing objects.

  • Bucket name must be globally unique

  • Bucket is created in a region

  • Example:

      my-app-assets-bucket
    

2. Object

An object is the actual file stored in S3.

Each object has:

  • File (data)

  • Key (file name/path)

  • Metadata

Example:

images/logo.png

3. Key

Key is the full path of the object inside the bucket.

S3 does not have real folders, only keys that look like folders.


4. Region

  • Bucket belongs to one region

  • Data stays in that region unless replicated


S3 Storage Classes

S3 offers different storage classes based on usage:

Storage ClassUse Case
StandardFrequently used data
Intelligent-TieringUnknown access pattern
Standard-IAInfrequent access
One Zone-IAInfrequent + single AZ
Glacier InstantArchive with fast access
Glacier FlexibleArchive, slower
Glacier Deep ArchiveLong-term archive

S3 Security

1. Bucket Policy

JSON-based policy to control access.

Example:

  • Allow public read

  • Restrict access to specific users


2. IAM Policies

Control who can access S3 and what actions they can perform.


3. ACL (Access Control List)

Older method, mostly avoided now.


4. Encryption

S3 supports encryption:

  • SSE-S3 (AWS managed)

  • SSE-KMS

  • Client-side encryption


S3 Versioning

  • Keeps multiple versions of the same file

  • Protects against accidental delete or overwrite

  • Very useful for backups


S3 Lifecycle Rules

Lifecycle rules help to:

  • Move objects to cheaper storage

  • Delete old objects automatically

Example:

  • After 30 days → Standard-IA

  • After 90 days → Glacier


S3 Replication

  • Copy data automatically to another bucket

  • Same region or cross region

  • Used for disaster recovery


S3 Static Website Hosting

S3 can host static websites:

  • HTML

  • CSS

  • JavaScript

No backend code.


S3 Pricing (Basic idea)

You pay for:

  • Storage used

  • Requests

  • Data transfer out

No charge for uploading data.


How to Create S3 Bucket (Step by Step)

Step 1: Open AWS Console

Go to:

Services → S3

Step 2: Click “Create bucket”


Step 3: Bucket name

Enter unique name:

my-first-s3-bucket-123

Choose region.


Step 4: Object Ownership

Keep default:

ACLs disabled (recommended)

Step 5: Block Public Access

  • Keep enabled for private data

  • Disable only if hosting website


Step 6: Bucket Versioning

Optional but recommended:

Enable

Step 7: Encryption

Enable default encryption.


Step 8: Create bucket

Click Create bucket


Upload Files to S3

Using Console

  • Open bucket

  • Click Upload

  • Select file

  • Upload


Using AWS CLI

aws s3 cp file.txt s3://my-first-s3-bucket-123/

How to Make S3 Public (Static Website)

  1. Disable Block Public Access

  2. Add bucket policy

  3. Enable static website hosting

  4. Access using S3 website URL


S3 in DevOps

S3 is used in DevOps for:

  • CI/CD build artifacts

  • Terraform state files

  • Application logs

  • Backup storage

  • Static frontend hosting

  • Data pipelines


S3 vs EBS vs EFS

FeatureS3EBSEFS
Storage typeObjectBlockFile
SharedYesNoYes
OS mountNoYesYes
Use caseFilesOS, DBShared files

Interview Ready Points

  • S3 is object storage

  • Buckets are global

  • Highly durable

  • Multiple storage classes

  • Versioning supported

  • Lifecycle rules supported

  • Used for static websites


Final Summary

Amazon S3 is one of the most important AWS services.
If you are learning DevOps, S3 is mandatory because it is used everywhere: backups, CI/CD, hosting, logs, and data storage.

Interview Question

Basic S3 Questions

1. What is Amazon S3?

Amazon S3 is an object storage service used to store and retrieve files like images, videos, backups, logs, and static website content with high durability and scalability.


2. What type of storage is S3?

S3 is object-based storage, not block or file storage.


3. What is a bucket in S3?

A bucket is a container that holds objects (files).
Bucket names must be globally unique.


4. What is an object in S3?

An object is a file stored in S3 along with metadata and a unique key.


5. What is an S3 key?

A key is the full path and name of the object inside a bucket.

Example:

images/logo.png

6. Is S3 global or regional?

S3 buckets are region specific, but bucket names are global.


Durability & Availability

7. What is S3 durability?

S3 provides 99.999999999% (11 nines) durability, meaning data loss is extremely unlikely.


8. How does S3 achieve high durability?

By replicating data across multiple Availability Zones automatically.


Storage Classes

9. What are S3 storage classes?

They define cost and access frequency of data.

Common classes:

  • Standard

  • Intelligent-Tiering

  • Standard-IA

  • One Zone-IA

  • Glacier

  • Glacier Deep Archive


10. When do you use Glacier?

For long-term archival data that is rarely accessed.


Security

11. How do you secure S3?

Using:

  • IAM policies

  • Bucket policies

  • Encryption

  • Block Public Access


12. What is a bucket policy?

A JSON-based policy that controls access at the bucket level.


13. Does S3 support encryption?

Yes.

  • At rest (SSE-S3, SSE-KMS)

  • In transit (HTTPS)


Versioning & Lifecycle

14. What is S3 versioning?

It keeps multiple versions of the same object to prevent accidental delete or overwrite.


15. What are lifecycle rules?

Rules that automatically move or delete objects based on time.

Example:

  • After 30 days → Standard-IA

  • After 90 days → Glacier


Replication & Backup

16. What is S3 replication?

Automatic copying of objects to another bucket.

Types:

  • Same-Region Replication

  • Cross-Region Replication


17. Why use Cross-Region Replication?

For disaster recovery and compliance.


Access & Public Data

18. Can S3 host a website?

Yes, S3 can host static websites (HTML, CSS, JS).


19. How do you make an S3 bucket public?

  • Disable Block Public Access

  • Add bucket policy

  • Make objects public


DevOps & Practical

20. How is S3 used in DevOps?

  • CI/CD artifacts

  • Terraform state files

  • Application logs

  • Backup storage

  • Static frontend hosting


21. Can EC2 directly mount S3?

No. S3 is not mountable like EBS or EFS.


22. Difference between S3 and EBS?

S3EBS
Object storageBlock storage
Unlimited sizeFixed size
Not mountableMountable

23. What happens if you delete a versioned object?

Only the latest version is deleted, older versions remain.


24. How is S3 priced?

You pay for:

  • Storage used

  • Requests

  • Data transfer out


Scenario Based Questions

25. Where will you store application logs?

Amazon S3 because it is cheap, durable, and scalable.


26. Where will you store OS files?

Amazon EBS, not S3.


27. Best storage for static frontend?

Amazon S3 + CloudFront.


One-Line Interview Facts

  • S3 is object storage

  • Bucket names are global

  • Data is replicated across AZs

  • Supports versioning

  • Supports lifecycle rules

  • Used heavily in DevOps

More from this blog

T

The DevOps Journal

23 posts