Skip to main content
Cloud basicsLesson 8 of 17

How Object Storage Works

A shop app saves product photos to object storage and shows them to users. This lesson uses Amazon S3 as the example. Google Cloud Storage, Azure Blob Storage and MinIO work the same way under different names. Follow one photo from upload to archive, and see who is allowed to read it at each step.

RequestPUT photos/123.jpg
Response—
Versions—
Storage class—
Object storage serviceShop appIAM roleBrowserShop visitorIAM / STSTemporary keysS3 APIHTTPS endpointBucket policyBlock Public AccessBucketshop-imagesObjectphotos/123.jpgOld versionnoncurrentArchive classCheaper, slowerPUT
RequestResponse / reportWatchAppears in a later step

What you will learn

  • A bucket holds objects under flat keys, and folders are only prefixes
  • Every request is signed and checked against IAM and the bucket policy
  • Why a 403 is safer than an accidentally public bucket
  • Presigned URLs give temporary access without making anything public
  • Versioning, lifecycle rules and multipart upload

Block, file and object storage​

Block storageFile storageObject storage
ExamplesAmazon EBS, Persistent Disk, Azure DiskAmazon EFS, Filestore, Azure Files, NFSAmazon S3, Cloud Storage, Azure Blob, MinIO
How you use itMounted as a disk on one server, with a file system on topMounted as a shared folder by many serversHTTP API (PUT, GET, DELETE, LIST)
UnitBlocksFiles in directoriesWhole objects under flat keys
Change part of the dataYesYesNo, replace the whole object
Shared by many clientsUsually one node at a timeYesYes, over the network from anywhere
In KubernetesPersistentVolume (ReadWriteOnce)PersistentVolume (ReadWriteMany)Called from the app, or mounted through a CSI driver with limits
Good forDatabases, boot disksShared files for legacy appsImages, backups, logs, data sets, model files

Try it yourself​

aws s3 ls s3://shop-images/photos/ # List a prefix (a "folder")
aws s3 cp ./123.jpg s3://shop-images/photos/123.jpg # Upload (multipart is used automatically for big files)
aws s3api head-object --bucket shop-images --key photos/123.jpg # Size, ETag, storage class, VersionId
aws s3 presign s3://shop-images/photos/123.jpg --expires-in 600 # Temporary URL, valid 10 minutes
aws s3api get-public-access-block --bucket shop-images # Is public access blocked?
aws s3api get-bucket-versioning --bucket shop-images # Enabled / Suspended / (empty = never enabled)
aws s3api list-object-versions --bucket shop-images --prefix photos/123.jpg # Versions and delete markers
aws s3api list-multipart-uploads --bucket shop-images # Unfinished uploads you are still paying for

Check yourself

  1. The product page puts a private S3 object URL straight into an img tag, and the browser gets 403. What is the safe fix?
  2. Versioning is on. Someone sends DELETE for photos/123.jpg without a version ID. What happens?
  3. Two writers PUT the same key at the same moment. What does object storage do?

Further reading: What is Amazon S3? · Blocking public access · Presigned URLs · Versioning · Lifecycle · Multipart upload · Permission Checks on One API Request (IAM) · How Storage Gets Attached (PVC·PV)