๐Ÿชฃ AWS S3 - Basics

Amazon S3 (Simple Storage Service) is a highly scalable, durable, and secure object storage service provided by AWS. You can store and retrieve any amount of data, from anywhere, at any time.

  • 99.999999999% (11 9โ€™s) durability
  • Scales automatically to petabytes
  • Accessible via web interface, SDKs, or APIs

๐Ÿ’ผ Use Cases

Use Case Description
๐ŸŒ Static Website Hosting Host static HTML/CSS/JS websites
๐Ÿ“‚ Backup and Archiving Long-term storage of data and snapshots
๐Ÿ“ˆ Big Data & Analytics Store data lakes for processing
๐Ÿ“ธ Media Hosting Image, video, and document storage
๐Ÿ” Software Distribution Deliver apps or files to users
๐Ÿงช Machine Learning Training Store datasets used by ML models


๐Ÿชฃย Buckets in S3

A bucket is a top-level container for storing objects (files).

  • Each bucket has a globally unique name
  • You define the region of the bucket
  • Permissions, policies, and lifecycle rules are set at the bucket level

๐Ÿ“ Example: certifikation-assets


๐Ÿ“ฆ Objects in S3

  • An object is a file and its metadata.
  • Stored inside a bucket
  • Identified by a unique key (like a file path)
  • Can include any file type: PDF, JPG, ZIP, etc.

๐Ÿงฉ Structure: Bucket โ†’ Object Key โ†’ Data + Metadata


๐Ÿ” Security in S3

Security Feature Description
IAM Policies Control access via users/roles
Bucket Policies Define who can do what at the bucket level
ACLs (Access Control Lists) Legacy way to set permissions (less used)
S3 Block Public Access Global setting to prevent public exposure
Server-side Encryption (SSE) Encrypt data using AWS-managed keys or KMS


๐Ÿ“œย Bucket Policies

  • Written in JSON
  • Define allow/deny rules for access
  • Example: Allow public read, deny delete, allow only a specific IP range

๐Ÿ”’ Example policy:

{
ย  "Effect": "Allow",
ย  "Principal": "*",
ย  "Action": "s3:GetObject",
ย  "Resource": "arn:aws:s3:::mybucket/*"
}


๐ŸŒ Static Website Hosting

S3 can host static websites:

  • Upload .html, .css, .js files
  • Enable "Static Website Hosting" in bucket properties
  • Set an index document and optionally an error page
  • URL: http://your-bucket.s3-website-<region>.amazonaws.com

โš ๏ธ Requires bucket policy to allow public read access


๐Ÿ“‚ Versioning

  • Allows multiple versions of the same object
  • Helps recover from accidental deletes or overwrites
  • Can be enabled per bucket
  • Each version gets a unique versionId

๐Ÿงฌ Example: resume.pdf has version v1, v2, v3...


๐Ÿ” Replication

Enables automatic copying of objects between buckets

Type Description
CRR (Cross-Region) Copy to a bucket in another AWS region
SRR (Same-Region) Copy to a different bucket in same region

ย 

Used for:

  • Disaster recovery
  • Compliance
  • Data localization

๐ŸงŠ Storage Classes

Class Use Case Cost
S3 Standard Frequently accessed data ๐Ÿ’ฐ๐Ÿ’ฐ๐Ÿ’ฐ
S3 Intelligent-Tiering Auto-moves data based on usage ๐Ÿ’ฐ๐Ÿ’ฐ
S3 Standard-IA Infrequent access, quick retrieval ๐Ÿ’ฐ
S3 One Zone-IA Infrequent access, one AZ ๐Ÿ’ฐ
S3 Glacier Archival, retrieval in minutes/hours ๐Ÿ’ต
S3 Glacier Deep Archive Long-term backup, slowest access ๐Ÿช™
S3 Reduced Redundancy (deprecated) Was used for non-critical data

โœ… Summary

Feature Purpose
Buckets Top-level containers for objects
Objects Files with metadata
Security IAM, policies, ACLs, encryption
Website Hosting Host static sites directly from S3
Versioning Preserve all object versions
Replication Automatic cross-bucket data copying
Storage Classes Cost-optimized data storage tiers
Back to blog

Leave a comment