🚀 Mastering AWS S3 with the CLI: A Simple Guide to Creating & Managing Buckets 💻
El Morjani Mohamed
Posted on September 29, 2024
As developers, we often find ourselves managing cloud storage. AWS S3 is a popular choice due to its flexibility, scalability, and security. Here's a quick breakdown of how to create, configure, and manage an S3 bucket using AWS CLI! 👇
🛠️ Steps to Create and Manage a Bucket:
- Create a new S3 bucket in your desired region:
aws s3api create-bucket --bucket devops22-cli-bucket --region eu-north-1 --create-bucket-configuration LocationConstraint=eu-north-1
- List your buckets to ensure it's created successfully:
aws s3 ls
- Secure your bucket by blocking all public access:
aws s3api put-public-access-block --bucket devops22-cli-bucket --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
- Upload files into your S3 bucket (like images or documents):
aws s3api put-object --bucket devops22-cli-bucket --content-type image/jpeg --key s3Devops22.jpg --body /path/to/your/image.jpg
- Manage permissions to control public or private access to your files. For instance, making an object publicly readable:
aws s3api put-object-acl --bucket devops22-cli-bucket --key s3Devops22.jpg --acl public-read
- Delete files or buckets when no longer needed:
aws s3api delete-object --bucket devops22-cli-bucket --key s3Devops22.jpg
aws s3api delete-bucket --bucket devops22-cli-bucket --region eu-north-1
đź’ˇ Why use AWS CLI for S3?
The AWS CLI provides a fast, scriptable interface for managing your resources efficiently—whether you're creating, securing, or optimizing your buckets. It's ideal for developers who want control and automation in their cloud workflows.
Let’s keep sharing tips and improving our DevOps skills! 🔥
đź’– đź’Ş đź™… đźš©
El Morjani Mohamed
Posted on September 29, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
aws 🚀 Mastering AWS S3 with the CLI: A Simple Guide to Creating & Managing Buckets 💻
September 29, 2024