When you need to store files on the cloud instead of on the internal server, Amazon S3 is a popular choice thanks to high reliability, fast speed, and flexible expansion.
In this article, I will guide you step by step to:
- Create S3 Bucket
- Get Access Key and Secret Key
- Basic right configuration for application can access S3
I. Login AWS and access S3 service
First, access https://aws.amazon.com/ And log in with your AWS account. From the management page, search “S3” and choose the S3 Service.
II. Create new bucket s3
Click the Create Bucket button

- Enter the bucket name, for example:
laravel-file-upload-series
. - In the Block Public Access section, if you want the file to be openly accessed:
- Select “Block All Public Access”
- Confirm by ticking into the confirmation box
- Click Create Bucket

The new Bucket has been successfully created. You need to save information bucket name laravel-file-upload-series
and AWS Region ap-southeast-1
To declare in applications need access to Amazon S3.

III. Create Access Key to connect from the application
1. Access IAM
From the service menu, find and choose IAM

2. Create a new user
Visit the Users, click on the Create User button to create a new account

Enter the name user and click Next

Select Attach Policies Directly, find S3 and tick to select Amazons3fullaccess (full access to S3 service). Click Next

Press the Create User button to complete the new user creation.

3. Create Access Key
After creating a new user, click the view button

Click Create Access Key

Select any Use case and tick the confirmation in the Confirmation section. Then click Next

Enter the caption (not required) and click Create Access Key.

Access Key with Secret Access Key will be displayed only once, you cannot review after exit. You need to save this parameter or click the download button .csv file to download. Click Done to complete.

Note: Absolutely do not share the Access Key / Serect Access Key publicly or commit on github.
IV. Information to remember
The information you need to keep in mind to configure in applications that need to be linked to S3
Item | Note |
---|---|
Name Bucket | laravel-file-upload-series |
Region | ap-southeast-1 |
Access Key ID | (Copy from IAM) |
Secret Access Key | (Copy from IAM) |
V. Connect with AWS CLI
I will test connection with S3 with Access Key just created through AWS Cli tool
Install AWS Cli by Homebrew (on MacOS)
brew install awscli
Code language: Nginx (nginx)
Or install by NPM
npm install awscli
Code language: Nginx (nginx)
Check the AWSCLI re -installed successfully not equal to the command
aws --version
Code language: Nginx (nginx)
The number configuration for AWSCLI
aws configure
Code language: Nginx (nginx)
Enter the necessary information: Access Key ID / Secret Access Key / Region Name
AWS Access Key ID (None): A*****************4
AWS Secret Access Key (None): X**************************r
Default region name (None): ap-southeast-1
Default output format (None):
Code language: Markdown (markdown)
See the list of s3 bucket
aws s3 ls
Code language: Nginx (nginx)
The list of S3 Bucket created will appear here.
Vi. Conclusion
In this article, I shared how:
- One S3 bucket On AWS to store files
- Basic access configuration to allow the application to use bucket
- Create Access Key and Secret Key For applications (like Laravel) can connect to Amazon S3 via API
These are the steps to set up the platform, extremely important before you deploy the function Upload files to Amazon S3 In any web or Mobile application.
Comment Policy: We truly value your comments and appreciate the time you take to share your thoughts and feedback with us.
Note: Comments that are identified as spam or purely promotional will be removed.
To enhance your commenting experience, consider creating a Gravatar account. By adding an avatar and using the same e-mail here, your comments will feature a unique and recognizable avatar, making it easier for other members to identify you.
Please use a valid e-mail address so you can receive notifications when your comments receive replies.