A bucket is a fundamental concept in AWS S3. To store anything in S3, you have to do so via a bucket. In this short blog, we will guide you on how you can create an S3 bucket in AWS.
However, before we move to the meat of the matter, some basics first. Let’s start!
What Is an AWS S3 Bucket?
It is a container for storing images, files, documents, etc. In AWS, a bucket cannot exist inside another bucket. Also, a bucket has no limit to the number of objects it can hold. Bucket ownership is not transferable, and only the bucket owner can delete it.
On this note, let’s create an S3 bucket in AWS Console followed by the CLI.
Creating, Configuring, And Working With Amazon S3 Buckets
- Create an S3 Bucket in the AWS Console
Here’s how to create an S3 bucket in AWS Console.
Step 1: Login to AWS Console > S3 > Create Bucket
Step 2: Give the bucket name
Step 3: Select Region
Step 4: Block all Public Access
Step 5: Fill in the rest of the necessary details and create a Bucket.
- From the CLI
Here’s how to create a bucket from the Command Line Interface.
aws s3 mb s3://yourbucketname |
You can see the bucket in the AWS S3 console.
Upload and Manage Objects in S3 Bucket
Now that we have created a bucket, it’s time to know how to manage it and upload objects to it.
- From the Console
Here’s how to upload a bucket.
Step 1: Open the bucket and Click Upload.
Step 2: Make directories if needed.
To delete an object, follow this step:
Step 1:Select the object and click Delete.
- From the CLI
- List buckets to see the buckets. Sometimes, the bucket permissions may be restricted.
aws s3 ls s3://yourbucketname aws s3 ls s3://yourbucketname/<DIRECTORY> |
- Operations on Files/Directories
- Here’s how to copy a file
aws s3 cp /backup/backup1.tar.gz s3://mybackupbucket/backup |
- Here’s how to synchronise files/folders
aws s3 sync /backup/ s3://mybackupbucket/ # Synchronise all the directory/files to the remote bucket location. aws s3 sync /backup/ s3://mybackupbucket/ –delete # Synchronise all the directories and files, but DELETES files in the remote that are not present in local |
- Here’s how to remove files remotely
aws s3 rm s3://myfirsts3bucket1990/ |
Wrapping Up
Creating an S3 bucket in AWS simplifies the management of objects.
At SysAlly, we experiment with Cloud and the most useful information is passed on to the world as blogs. Signup for the updates.
Until later, here’s SysAlly signing off!