TExcelTAD
Home › AWS Cloud › Amazon S3

Amazon S3

Amazon Simple Storage Service (S3) is object storage: you store files (objects) of any type, from a few bytes up to 5 TB each, in containers called buckets, and read them back over HTTPS. S3 is designed for 99.999999999% (eleven nines) durability by storing data redundantly across several Availability Zones. It hosts backups, data lakes, images for websites, logs and static websites.

Buckets, keys and objects

  • A bucket has a globally unique name (tad-media-eu) and lives in one Region.
  • An object is identified by its key, the full "path" inside the bucket: images/2026/logo.png.
  • S3 has no real folders. The console shows / as folders for convenience, but images/2026/logo.png is just a key that happens to contain slashes.
  • Each object has data, metadata (content type, custom headers) and optionally a version ID and tags.

Working with S3 from the CLI

bash
aws s3 mb s3://tad-media-eu --region eu-west-1
aws s3 cp logo.png s3://tad-media-eu/images/2026/logo.png
aws s3 sync ./site s3://tad-media-eu/site/ --delete
aws s3 ls s3://tad-media-eu/images/ --recursive --human-readable

Sample output of the last command:

text
2026-03-02 10:15:42   14.2 KiB images/2026/logo.png
2026-03-02 10:16:03  381.0 KiB images/2026/banner.jpg

And with boto3:

python
import boto3

s3 = boto3.client("s3")
s3.upload_file("logo.png", "tad-media-eu", "images/2026/logo.png",
               ExtraArgs={"ContentType": "image/png"})
for obj in s3.list_objects_v2(Bucket="tad-media-eu", Prefix="images/")["Contents"]:
    print(obj["Key"], obj["Size"])

Model: a bucket is a key-value store

Listing with a prefix and a delimiter is how S3 fakes folders. This model reproduces ListObjectsV2 behaviour on a dictionary:

python · try it yourself
bucket = {
    "index.html": 2048,
    "images/logo.png": 14540,
    "images/2026/banner.jpg": 390144,
    "images/2026/team.jpg": 220000,
    "docs/terms.pdf": 88000,
}

def list_objects(prefix="", delimiter=None):
    contents, common_prefixes = [], set()
    for key in sorted(bucket):
        if not key.startswith(prefix):
            continue
        rest = key[len(prefix):]
        if delimiter and delimiter in rest:
            common_prefixes.add(prefix + rest.split(delimiter)[0] + delimiter)
        else:
            contents.append(key)
    return contents, sorted(common_prefixes)

print(list_objects(delimiter="/"))
print(list_objects(prefix="images/", delimiter="/"))
print(list_objects(prefix="images/"))
print("total bytes under images/:", sum(bucket[k] for k in list_objects(prefix="images/")[0]))
(['index.html'], ['docs/', 'images/'])
(['images/logo.png'], ['images/2026/'])
(['images/2026/banner.jpg', 'images/2026/team.jpg', 'images/logo.png'], [])
total bytes under images/: 624684

Bucket names

Bucket names must be 3 to 63 characters, lowercase letters, digits, hyphens and dots, start and end with a letter or digit, and must not look like an IP address. A checker:

python · try it yourself
import re

def valid_bucket_name(name):
    if not 3 <= len(name) <= 63:
        return "length must be 3-63"
    if not re.fullmatch(r"[a-z0-9][a-z0-9.-]*[a-z0-9]", name):
        return "only lowercase letters, digits, '.', '-'; start/end with letter or digit"
    if ".." in name:
        return "no two adjacent periods"
    if re.fullmatch(r"\d+\.\d+\.\d+\.\d+", name):
        return "must not be formatted like an IP address"
    if name.startswith("xn--"):
        return "must not start with 'xn--'"
    return "ok"

for name in ["tad-media-eu", "TAD-Media", "ab", "my..bucket", "192.168.1.10", "logs-2026.example", "-start"]:
    print(f"{name:<18} {valid_bucket_name(name)}")
tad-media-eu       ok
TAD-Media          only lowercase letters, digits, '.', '-'; start/end with letter or digit
ab                 length must be 3-63
my..bucket         no two adjacent periods
192.168.1.10       must not be formatted like an IP address
logs-2026.example  ok
-start             only lowercase letters, digits, '.', '-'; start/end with letter or digit

Security: private by default

New buckets are private, and Block Public Access is on by default. Access is granted with IAM policies (for identities in your account) or bucket policies (resource-based, can grant other accounts or the public). For temporary sharing, generate a pre-signed URL:

bash
aws s3 presign s3://tad-media-eu/docs/terms.pdf --expires-in 600

Sample output:

text
https://tad-media-eu.s3.eu-west-1.amazonaws.com/docs/terms.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20260302%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20260302T101500Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=5d6f...

Objects are encrypted at rest by default (SSE-S3); you can choose SSE-KMS for keys you control.

Other features at a glance

Feature What it does
Static website hosting Serve index.html from a bucket (usually behind CloudFront)
Versioning Keep every version of every object (next lessons)
Lifecycle rules Move or delete objects automatically after N days
Replication Copy objects to another bucket/Region (CRR/SRR)
Event notifications Trigger Lambda/SQS/SNS/EventBridge on uploads
Multipart upload Upload big files in parallel parts (recommended above ~100 MB)
S3 Object Lock Write-once-read-many (WORM) retention

Go further: Object Storage Exposure and Block Public Access evaluates every way a bucket becomes readable by strangers.

Test yourself

What is an S3 object key?

  1. The encryption key
  2. The full name of the object inside the bucket, like images/logo.png
  3. An access key
  4. The bucket's Region

Which bucket name is valid?

  1. My_Bucket
  2. ab
  3. tad-reports-2026
  4. 192.168.0.1

How can you give someone temporary access to one private object without changing policies?

  1. Make the bucket public
  2. Generate a pre-signed URL
  3. Email them your access keys
  4. Enable versioning