Introduction to Amazon S3: Object Storage for Developers
Learn the fundamentals of Amazon S3, from creating buckets to managing permissions. Master object storage for your static application assets today.
Previously in this course, we initialized our backend infrastructure using Project Setup: Initializing the Web App Backend with AWS CDK. Now that our compute layer is ready, we need a place to store our application’s assets—like images, CSS, and client-side JavaScript. This lesson introduces Amazon S3, the industry-standard service for object storage.
Understanding S3 and Object Storage
Amazon S3 (Simple Storage Service) is not a file system in the traditional sense; it is Object Storage. Unlike a block storage volume attached to a server, an object consists of the data itself, metadata, and a unique identifier.
In S3, you store data in Buckets—flat containers that act as the top-level namespace. Because S3 is a globally accessible service, every bucket name must be globally unique across all AWS accounts.
Creating Your First S3 Bucket
Before we can store files, we need a bucket. While we will eventually manage this via Introduction to Infrastructure as Code with AWS CloudFormation, it is important to understand the CLI commands first.
Ensure you have your credentials configured as shown in Configuring the AWS CLI. Run the following command to create a bucket:
Bash# Replace 'my-unique-bucket-name-2023' with a globally unique name aws s3 mb s3://my-unique-bucket-name-2023
The mb command stands for "make bucket." If the command succeeds, you will see a confirmation message indicating the bucket was created.
Managing Bucket Permissions
By default, all S3 buckets are private. AWS enforces a "Block Public Access" setting on all new buckets. This is a critical security feature that prevents accidental data exposure.
To verify your current settings, use:
Bashaws s3api get-public-access-block --bucket my-unique-bucket-name-2023
If you ever need to inspect the contents of your bucket, use the ls command:
Bashaws s3 ls s3://my-unique-bucket-name-2023
Uploading Files via the CLI
To add files to your bucket, use the cp (copy) or sync commands. Let’s upload a local file to your new bucket:
Bash# Create a dummy file echo "Hello, S3!" > index.html # Upload it to the bucket aws s3 cp index.html s3://my-unique-bucket-name-2023/
The cp command uploads the file. If you wanted to upload an entire folder of static assets (like a frontend build directory), you would use aws s3 sync ./dist s3://my-unique-bucket-name-2023/.
Hands-on Exercise
- Create a new bucket with a globally unique name (e.g.,
my-app-assets-[your-name]). - Create a simple
test.txtfile on your machine. - Upload the file to your bucket using the CLI.
- Verify the upload by listing the bucket contents.
- Delete the file from the bucket using
aws s3 rm s3://[bucket-name]/test.txtto keep your environment clean.
Common Pitfalls
- Global Uniqueness: If you get an "Access Denied" or "BucketAlreadyExists" error, it’s likely because the name is taken. Try adding a random string or date to the bucket name.
- Region Confusion: S3 buckets are global resources, but the data resides in a specific region. While you don't always need to specify a region for the command to work, it is good practice to be aware of where your data lives for latency and compliance reasons.
- Public Access: Do not disable "Block Public Access" unless you have a specific requirement (like hosting a public website). We will cover how to safely host static content in a later lesson.
FAQ
Q: Is S3 a database? A: No. S3 is for storing files (objects). While it has high durability, it is not optimized for transactional queries like DynamoDB Data Modeling for Developers.
Q: Can I put folders in S3?
A: S3 is a flat structure. While the console shows "folders," these are actually just prefixes in the object key (e.g., images/logo.png).
Recap
We have successfully created an S3 bucket, verified its private status, and uploaded a file using the AWS CLI. This bucket will eventually host the frontend of our serverless application.
Up next: We will dive deeper into Managing S3 Bucket Policies to control exactly who can read and write to your storage containers.
Work with me

Custom Email & File Storage System on Cloudflare (Google Workspace Alternative)
Your own private email + file storage suite on your domain — unlimited mailboxes, no per-seat fees. A self-owned Google Workspace alternative for a flat ~$5/month.

CI/CD Pipeline & Docker Containerization
Ship with confidence: automated CI/CD pipelines and Docker setups so every push is tested and deployed — no more manual, error-prone releases.
