AWS S3 Bucket – A Complete guide to create and access
This tutorial will explain you ,How to create AWS s3 bucket and access it from Windows and Linux hosts.
What is S3 Bucket ?
Amazon S3 Stands for Amazon Simple Storage Service, which provides Object-Based Storage for uploading or downloading your flat files(Images, Videos, Documents, etc) using a secure web service Interface.
Files are stored in S3 Buckets. S3 Buckets are nothing but a folder that keeps your files.
Files in Amazon S3 can be of 0 Byte to 5 TB of size and S3 has unlimited Storage.
Also Read : 21 Important AWS Services that you must know
How to Create S3 Bucket and Access it ?
Step 1 – Create S3 Bucket
Login to your AWS account and navigate to Services ——-> S3 and click on Create Bucket
Enter the name of Bucket that you want to Create and Click on Next
Make sure you enter a Unique Bucket name as S3 bucket name is globally unique otherwise you may get error stating ” Bucket name already exists”
Click on Next
Let everything as it is and click on Next
Click on Next
AWS S3 Make Public Access denied by default. This means no body can access you S3 Bucket over the internet until you allow public access (By unchecking Block all public access in below screenshot ) or provide him IAM user Credentials.
Let all public access blocked here and click on Next
Note: You will able to access Private S3 Bucket using IAM user/ Role.
Review and Click on Create Bucket
Create an IAM User and grant IAM user access to s3 bucket
Step 2- Create an IAM user and grant access to S3 Bucket
In your AWS Account navigate to Services –—-> IAM under Security, Identity, & Compliance Service—-> Users ——-> Add User
Enter User name and select AWS access Type
Programmatic Access – Provide this access if you want user to access S3 bucket from Command line or using an application.
Console Access – Provide this access if you want user to access S3 bucket from AWS Management Console
You can set permission to user for accessing S3 bucket in many ways like
Add user to Group ——-> Add user to a group that already has defined access S3.
Copy permission from existing user —-> Copy permission from existing user that already has defined permission to access S3.
Attach existing policies directly – Attached AWS managed predefined policy or costumer managed policies.
Create policy — Create a custom bucket policy using JSON Script
Here I am using existing AWS Managed policy with Full Access on S3
Select the appropriate policy and Click on Next
Enter Name as Key and any value as Value ( However this is optional you can skip Add Tags option)
Review your User Permission
Download the credentials that will contain Access Key ID and Secret Access Key
how to access s3 bucket ?
In Step 3 and step 4 we will learn to access AWS S3 Bucket from Linux and Windows Instance respectively.
Step 3 -Access s3 bucket from ec2 Linux instance or your local Linux Machine
SSH to the EC2 Linux Instance from where you want to access S3 Bucket and install AWSCLI or Install at your Local System.
For Centos/RHEL/Amazon Linux
$ yum install awscli -y
$ sudo apt-get install awscli -y
Check if AWS CLI is installed by checking AWS CLI Version
$ aws – – version
aws-cli/1.14.44 Python/3.6.9 Linux/5.3.0-42-generic botocore/1.8.48
Use AWS Configure command to access Amazon s3 bucket from your local System or an EC2 Linux Instance.Put the Access Key ID and AWS Secret Access Key that you get from Credentials file downloaded in Step 2
$ aws configure
AWS Access Key ID [None]: AKIA5W7LIMQID4F6B7N
AWS Secret Access Key [None]: 5jxai34uiJEzbLXYhPznjklmn3FwvuwQH0sz3Efj
Default region name [None]: ——————————-> Press Enter
Default output format [None]: —————————> Press Enter
Use following command to list Amazon S3 Bucket.It will list you the all S3 buckets available in the AWS account.
$ aws s3 ls
Use below command to list all files/folder inside particular Bucket
$ aws s3 ls bucketname
Use following command to upload data in S3 bucket
$aws s3 cp path-of-data-to-be-copied s3://bucketname
Use following command to download data from S3 Bucket
$aws s3 cp s3://bucketname/file-name-to-be-copied folder-path-on-local-where-data-to-be -copied
Step 4- Access s3 bucket from ec2 windows instance or Your Local Windows Machine
You can download and install AWS CLI or S3 Browser to access S3 bucket from Windows Instance.
Here we will use S3 Browser to access S3 Bucket.
Download S3 Browser for Windows and Install. Installation is as easy as Next to Finish.
Once Installed open S3 Browser . As soon as you open it the following screen will appear stating Add New Account.
Enter Account Name, Access Key ID and Secret Access Key and Click on Add New Account. You can get the access Key ID and Secret Access Key from the Credentials file downloaded in Step 2.
You can download ,Upload and create New Folder in your S3 Bucket here.
Click to tweet this tip !
I hope you enjoyed this tutorial and learned about How to create and access S3 Bucket . If you think this is really helpful, please do share this article with others as well. Please also share your valuable feedback, comment, or any query in the comment box. I will really happy to resolve your all queries any.