DEV Community

El Morjani Mohamed
El Morjani Mohamed

Posted on

3 1

🚀 Mastering AWS S3 with the CLI: A Simple Guide to Creating & Managing Buckets 💻

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:

  1. 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
Enter fullscreen mode Exit fullscreen mode
  1. List your buckets to ensure it's created successfully:
   aws s3 ls
Enter fullscreen mode Exit fullscreen mode
  1. 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"
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode
  1. 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
Enter fullscreen mode Exit fullscreen mode

đź’ˇ 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! 🔥

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Retry later