Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Keeping files in object storage

After this lesson: I can choose object storage for files.

45 min lessonNo commands

Ten thousand photos a day

A delivery firm asks drivers to take a photo at every door. That is ten thousand photos a day.

The photos are kept for a year, in case a customer complains. They will not fit on a laptop, and a server’s disk would fill in a week. Where should they go?

By the end of this lesson

Note

I can choose object storage for files.

Key words

WordWhat it meansExample
Object storagea service that keeps whole files
Bucketa named container for objectsacme-delivery-photos
Objectone stored file and its details
Keythe full name of an objectphotos/2026/10/order-1042.jpg
Prefixthe start of a keyphotos/2026/
Block storagea disk for one server

The cells students fill in are left blank in this preview.

A bucket holds objects by key

Object storage keeps whole files. You make a bucket, then put files into it. Each file is an object, and you find it by its key.

A key looks like a path with slashes. But there are no real folders. The slashes are just part of the name. The provider’s screens show each prefix as a folder, so it is easier to read.

What a bucket of delivery photos holds

KeySizeUploaded
photos/2026/10/order-1042.jpg2 MB21 Oct, 09:14
photos/2026/10/order-1043.jpg3 MB21 Oct, 09:20
photos/2026/09/order-0977.jpg2 MB30 Sep, 17:02
invoices/2026/10/order-1042.pdf80 KB21 Oct, 09:15

The cells students fill in are left blank in this preview.

Try it: a bucket as a dictionary

Code: python
# A tiny pretend bucket: each key points to a file's contents.
bucket = {}

def put(key, data):
    bucket[key] = data

def list_keys(prefix):
    # Object storage lists the keys that start with a prefix.
    found = []
    for key in bucket:
        if key.startswith(prefix):
            found.append(key)
    return found

put("photos/2026/10/order-1042.jpg", "photo bytes")
put("photos/2026/09/order-0977.jpg", "photo bytes")
put("invoices/2026/10/order-1042.pdf", "invoice bytes")

print(list_keys("photos/"))
print(list_keys("photos/2026/10/"))

# Put an invoice for order 1043, then list the prefix "invoices/".

Choose the storage that fits the job

There are three common places to keep data in the cloud.

Object storage suits whole files that are written once and read many times: photos, PDFs, backups, logs. It grows as far as you need.

Block storage is a disk for one server. It suits a program that changes small parts of a file all the time.

A database suits records you search and update, such as orders.

Worked example: where each thing goes

JobBest fitWhy
Drivers’ doorstep photosObject storageWhole files, kept a long time
Monthly payslip PDFsObject storageWritten once, read now and then
The disk a server starts fromBlock storageThe server changes it all the time
Customer orders and stockA databaseRecords you search and update
Nightly backup filesObject storageLarge, and cheap to keep

The cells students fill in are left blank in this preview.

A common mistake

Warning

Many people think a bucket is a disk, like the one in their laptop. You cannot change a few bytes in the middle of an object. You upload a new whole object instead. If a program edits a file all the time, give it block storage or a database.

You pay for what you keep and send

Object storage is priced in a few parts. You pay for each gigabyte you keep, each month. You pay a little for each request, such as an upload. You often pay for data sent out to the internet.

Old files that nobody opens can move to a cheaper, slower storage class (a price level for rarely used files). Many teams set a rule that does this after 90 days.

Worked example: a month of delivery photos

ItemAmountExample priceCost
Photos kept300 GB2p per GB£6.00
Uploads300,000£1 per 100,000 requests£3.00
Data sent out10 GB5p per GB£0.50
Total£9.50

The cells students fill in are left blank in this preview.

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.