Day 14: AWS - S3


S3 Meets My Terminal – CLI & Versioning Experiments
This ‘day 14’ is almost a week later, reason being I was stuck with some critical projects assigned by my great manager which took me away from practicing the AWS. Got time today and did hands dirty on AWS S3.
After a full day of clicking around the S3 console, I figured it was time to stop being a tourist and actually get comfortable with the AWS CLI.
I mean, real engineers use the terminal, right? 😅
So today was all about interacting with S3 using the CLI and then diving into one of its coolest features: versioning.
🔧 Setting Up the CLI (If You Haven’t Already)
First, I checked if I had the AWS CLI installed:
aws --version
If you don't have it yet, install it using:
# On Ubuntu/Debian
sudo apt install awscli
# On macOS (with Homebrew)
brew install awscli
Then I configured it with my IAM credentials:
aws configure
It asked for:
AWS Access Key ID
AWS Secret Access Key
Region (I used
us-east-1
)Output format (I chose
json
)
Boom. CLI ready.
🪣 Creating a Bucket from Terminal
I wanted to do everything via CLI today, so I started by creating a new S3 bucket:
aws s3 mb s3://cli-demo-bucket-username
✅ Success.
Then I listed all my buckets:
aws s3 ls
Seeing your bucket show up in the list? That’s when you know it worked.
Uploading Files via CLI
I created a simple text file:
echo "First version of this file" > notes.txt
And uploaded it:
aws s3 cp notes.txt s3://cli-demo-bucket-username
Then updated the file:
echo "Second version – updated content" > notes.txt
aws s3 cp notes.txt s3://cli-demo-bucket-username
At this point, I had overwritten the file in S3 — and that's where versioning comes into play.
Enabling Versioning on a Bucket
I wanted to keep track of every version of notes.txt
. So I turned on versioning:
aws s3api put-bucket-versioning --bucket cli-demo-bucket-username \
--versioning-configuration Status=Enabled
To verify:
aws s3api get-bucket-versioning --bucket cli-demo-bucket-username
Now, every time I upload a file with the same name, S3 keeps the older versions. No more overwriting and losing changes.
Seeing All Versions of an Object
After modifying notes.txt
a couple of times, I ran:
aws s3api list-object-versions --bucket cli-demo-bucket-username
And yup — I could see multiple VersionId
s for notes.txt
.
Each upload has its own unique ID, and I can retrieve or delete a specific version whenever I want.
Fun Experiment: Restore an Old Version
Just to try it out, I downloaded an older version like this:
aws s3api get-object --bucket cli-demo-bucket-username \
--key notes.txt \
--version-id <OLD_VERSION_ID> \
restored.txt
It worked like a charm. My terminal became a time machine for files.
🧠 What I Learned Today
Using S3 from the CLI feels powerful — way faster than clicking through the console
Versioning is a lifesaver — especially when you’re dealing with frequent updates
AWS CLI responses are super detailed — helpful for debugging and scripting later
Every new feature I touch in AWS seems simple at first, but always has depth if you look closer
Up Next
I’m thinking of continuing the S3 journey with:
Lifecycle rules (automatically moving or deleting old versions)
Trying public vs private uploads via CLI
Maybe even setting up a basic backup system using S3 and versioning
This storage service is turning out to be way more than a file bucket.
Hopefully, I am not caught with some “critical company work…..”
Subscribe to my newsletter
Read articles from satyam mishra directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
