Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

Exploring AWS S3

Posted in AWS Tutorial
Updated on Sep 22, 2024
By Mari Selvan
👁️ 36 - Views
⏳ 4 mins
💬 1 Comment
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:

  1. An AWS account with access to S3.
  2. 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.

  1. Open the AWS Management Console.
  2. Navigate to the S3 service and click on the Create Bucket button.

    Create S3 Bucket

    Photo Credit to CodeToFun

  3. Select a distinct bucket name in the general configuration section.

    S3 general configuration

    Photo Credit to CodeToFun

  4. Choose ACLs disabled (recommended) from the Object Ownership section.

    S3 Object Ownership

    Photo Credit to CodeToFun

  5. Please deselect the Block all public access checkbox and confirm the changes. This will make the images uploaded to this bucket publicly accessible.

    S3 black public access settings for this bucket

    Photo Credit to CodeToFun

  6. Keep everything else unchanged and click on the Create Bucket.
  7. Next, open the bucket and click the upload button.

    S3 upload image

    Photo Credit to CodeToFun

  8. Keep everything else unchanged and select the upload button located at the bottom of the page.

    S3 upload files and folders

    Photo Credit to CodeToFun

🛠️ Configure S3 Bucket Policy

  1. Open the S3 bucket.
  2. Navigate to the Permissions tab.
  3. Click on Bucket Policy.
  4. Add a bucket policy allowing public read access. Replace your-bucket-name with your actual bucket name.
    S3 Bucket Policy
    Copied
    Copy To Clipboard
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": "*",
          "Action": "s3:GetObject",
          "Resource": "arn:aws:s3:::your-bucket-name/*"
        }
      ]
    }
  5. Save the changes.

🕵️‍♂️ Testing the S3

  1. Navigate to the S3 bucket you wish to inspect for public access.

  2. Select any image within that bucket by clicking on it.

  3. Next, select the link located beneath Object URL.

    S3 Object URL

    Photo Credit to CodeToFun

  4. Great news! The bucket is now publicly accessible. You can use the image URL to display it on your website.

    S3 image displayed publicly

    Photo Credit to CodeToFun

🌐 Explore Additional S3 Features

  1. Versioning: Enable versioning in your S3 bucket to keep track of different versions of objects.
  2. Logging: Configure logging to track access requests to your S3 bucket.
  3. Static Website Hosting: Host a static website directly from your S3 bucket.
  4. 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:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

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

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mari Selvan
Mari Selvan
7 months ago

If you have any doubts regarding this article (Exploring AWS S3), please comment here. I will help you immediately.

We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy