Object Storage
Object Storage
Stores unstructured data as objects. S3, GCS. Virtually unlimited scalability.
Object Storage
Stores unstructured data as objects. S3, GCS. Virtually unlimited scalability.
Object Storage is a storage architecture that stores data in units called objects. Each object consists of the data itself, metadata, and a unique identifier (Key), and is managed in a flat address space. Unlike the hierarchical directory structure of a file system, it offers near-unlimited scalability.
Since the launch of AWS S3 in 2006, Object Storage has become the standard for cloud storage. The S3 API is the de facto industry standard, and most object storage systems, including Google Cloud Storage, Azure Blob Storage, MinIO, and Ceph, provide an S3-compatible API.
Object Storage is optimized for storing unstructured data such as images, videos, logs, backups, and big data. It provides 99.999999999% (11 9s) durability and is automatically replicated across multiple data centers. Cost and access speed can be adjusted according to the storage class (Standard, Infrequent Access, Glacier, etc.).
In practice, it is widely used for serving static files in combination with a CDN, building data lakes, application backups, and storing ML training data. You can grant temporary access permissions with a Presigned URL and automatically clean up old data with a Lifecycle Policy.
import boto3
from botocore.exceptions import ClientError
from datetime import datetime
# S3 클라이언트 생성
s3 = boto3.client('s3',
region_name='ap-northeast-2',
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY'
)
# 버킷 생성
s3.create_bucket(
Bucket='my-app-bucket',
CreateBucketConfiguration={'LocationConstraint': 'ap-northeast-2'}
)
# 파일 업로드
s3.upload_file(
'local_file.pdf',
'my-app-bucket',
'documents/2024/report.pdf',
ExtraArgs={
'ContentType': 'application/pdf',
'Metadata': {'author': 'kaitrust', 'version': '1.0'}
}
)
# Presigned URL 생성 (1시간 유효)
url = s3.generate_presigned_url(
'get_object',
Params={'Bucket': 'my-app-bucket', 'Key': 'documents/2024/report.pdf'},
ExpiresIn=3600
)
print(f"Download URL: {url}")
# 객체 목록 조회 (페이지네이션)
paginator = s3.get_paginator('list_objects_v2')
for page in paginator.paginate(Bucket='my-app-bucket', Prefix='documents/'):
for obj in page.get('Contents', []):
print(f"{obj['Key']} - {obj['Size']} bytes")
# 객체 삭제
s3.delete_object(Bucket='my-app-bucket', Key='documents/2024/report.pdf')
"User-uploaded images can be stored in S3 and served through CloudFront. If you upload directly with a Presigned URL, you can handle even large files without putting load on the server, and thumbnails can also be generated automatically with a Lambda trigger."
"Log data accumulates at 2TB every month, and if we apply S3 Intelligent-Tiering, it automatically analyzes access patterns and moves objects between storage classes. Let's also set a Lifecycle policy so that data not accessed for 90 days or more moves to Glacier."
"The difference between Object Storage and Block Storage is the access method. Object Storage is accessed through an HTTP API in units of whole objects, while Block Storage is mounted at the OS level and accessed in units of bytes. Block Storage is suitable for databases, and Object Storage is suitable for images and videos."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
If you accidentally open an S3 bucket to the public, a data breach can occur. Enable S3 Block Public Access and control access with IAM policies. You can automatically detect public buckets with AWS Config.
Sequential prefixes (2024-01-01/file1.jpg) cause hotspots and degrade performance. You can use a random hash as the prefix (abc123/2024-01-01/), or, since S3 now partitions automatically, date-based prefixes are also fine.
S3 pricing is storage capacity + number of requests + data transfer. If you have many small files, request costs go up, so store them bundled together. Clean up unnecessary versions with Lifecycle, and transfers within the same region are free.