AWS Topics
- AWS Intro
- AWS Launch EC2 Instance
- AWS Elastic IP
- AWS Target Group
- AWS Application Load Balancer
- AWS Route53
- AWS Amazon Certificate Manager
- AWS Redirect HTTP to HTTPs
- AWS Redirect WWW to Non WWW
- AWS Cloudfront
- AWS Download S3 to Local
- AWS Install Node.js & NPM in EC2
- AWS EC2 Connect PuTTY
- AWS EC2 Connect FileZilla
- AWS All-in-One WP Migration
- AWS Deploy Node.js
- AWS Deploy Express.js
- AWS Deploy ReactJS
- AWS Deploy NextJS
- AWS Deploy NextJS with Express.js
- AWS Deploy Wordpress
Exploring AWS S3
Photo Credit to CodeToFun
🙋 Introduction
Amazon Simple Storage Service (S3) is a scalable object storage service that allows you to store and retrieve any amount of data from anywhere on the web.
In this tutorial, we'll explore how to leverage AWS S3 to enhance your web application hosted on an Application Load Balancer (ALB).
📚 Prerequisites
Before you begin, make sure you have the following:
- An AWS account with access to S3.
- A web application running on an Application Load Balancer (ALB) with a domain served via a hosted zone in Route 53.
✏️ Create an S3 Bucket
Follow the steps below to create an AWS S3 Bucket.
- Open the AWS Management Console.
Navigate to the S3 service and click on the Create Bucket button.
Photo Credit to CodeToFun
Select a distinct bucket name in the general configuration section.
Photo Credit to CodeToFun
Choose ACLs disabled (recommended) from the Object Ownership section.
Photo Credit to CodeToFun
Please deselect the Block all public access checkbox and confirm the changes. This will make the images uploaded to this bucket publicly accessible.
Photo Credit to CodeToFun
- Keep everything else unchanged and click on the Create Bucket.
Next, open the bucket and click the upload button.
Photo Credit to CodeToFun
Keep everything else unchanged and select the upload button located at the bottom of the page.
Photo Credit to CodeToFun
🛠️ Configure S3 Bucket Policy
- Open the S3 bucket.
- Navigate to the Permissions tab.
- Click on Bucket Policy.
- Add a bucket policy allowing public read access. Replace your-bucket-name with your actual bucket name.
S3 Bucket PolicyCopied
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::your-bucket-name/*" } ] }
- Save the changes.
🕵️♂️ Testing the S3
Navigate to the S3 bucket you wish to inspect for public access.
Select any image within that bucket by clicking on it.
Next, select the link located beneath Object URL.
Photo Credit to CodeToFun
Great news! The bucket is now publicly accessible. You can use the image URL to display it on your website.
Photo Credit to CodeToFun
🌐 Explore Additional S3 Features
- Versioning: Enable versioning in your S3 bucket to keep track of different versions of objects.
- Logging: Configure logging to track access requests to your S3 bucket.
- Static Website Hosting: Host a static website directly from your S3 bucket.
- Lifecycle Policies: Define rules to automatically transition or delete objects based on their age.
🎉 Conclusion
Congratulations! You've successfully explored AWS S3 and integrated it with your web application served through an Application Load Balancer. S3 provides a reliable and scalable solution for storing and delivering content, reducing the load on your web servers and improving overall performance.
As you continue to develop and enhance your application, consider leveraging more advanced features of S3 to meet your specific needs.
👨💻 Join our Community:
Author
For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.
Buy me a coffee to make codetofun.com free for everyone.
Buy me a Coffee
If you have any doubts regarding this article (Exploring AWS S3), please comment here. I will help you immediately.