AWS

How to Access AWS S3 Bucket

S3 buckets are created in AWS to store objects in the form of files and folders. The S3 buckets are usually accessed by other AWS services like AWS Glue and AWS Athena to perform their own tasks while using the bucket files stored in S3 as their data. Apart from these services, the S3 bucket can also be directly accessed and for that, the AWS CLI is used, which needs to be installed and configured first.

This post will demonstrate the process of accessing the S3 bucket with the help of the AWS CLI (Command Line Interface).

How to Access the S3 Bucket?

To access an S3 bucket, we must first create a new bucket and then store some files inside it. Only after that can it be accessed using the AWS CLI.

Create a new S3 Bucket
Go to the S3 service of AWS after logging in to the AWS console, and then click on the “Create bucket” option. To create the bucket, first, give a globally unique name to the bucket, select an AWS region in which the bucket should be created, and after configuring, select the “Create bucket” button:

After creating the bucket, the user can add objects to it. Simply click on the “Upload” button for that. And browse and select files from the system that are supposed to be uploaded to the newly created S3 bucket:

After uploading, the object displays in details of the bucket:

In this way, an S3 bucket is created and files are uploaded to it. Now that the S3 bucket has some files inside it, the user can access it using the AWS CLI.

Access the Created S3 Bucket Using AWS CLI
First, configure the AWS CLI using the AWS credentials (access and secret access key):

To view the list of all the S3 buckets created in the AWS account, simply type the command:

aws s3 ls

All the buckets created in the AWS account including the newly created bucket are displayed:

To view the files inside the S3 bucket that we have just created, type the “aws s3” command along with the name of the bucket:

aws s3 ls s3://s3bucketstorageaws

In the screenshot above, the uploaded file is displayed as the item of the bucket.

In this way, the AWS S3 bucket and its objects can be accessed.

Conclusion

Accessing the S3 buckets requires the user to first create a new S3 bucket and have some files inside it. After that, the user needs to ensure the installation and configuration of the AWS CLI. Once, all of that is done, the user can access the S3 bucket by using the “aws s3” command and following it up with the name of the S3 bucket to be accessed.

About the author

Hadia Atiq

A Software Engineer and Technical Writer passionate about learning and spreading knowledge of the latest technology. I utilize my writing skills to help readers understand the importance and usage of modern technology.