harshartz / AWS-S3

In the "Static website hosting using AWS S3" project, I created a secure and efficient hosting solution using Amazon S3, allowing users to host static websites with ease.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Static Website Hosting Using AWS S3

Step 1:

-Sign in to the AWS Management Console and navigate to the S3 service by searching for "S3" in the AWS Management Console search bar.

1ss

Step 2:

-Click on the "Create bucket" button to start the bucket creation process.

2ss

Step 3:

-Provide a unique name for your bucket. This name will be part of the website URL, so it should be globally unique.

-Choose the region where you want your bucket to be located.

3ss

-Leave all other settings as their default values and click on the "Create" button to create the bucket.

4ss

Step 4:

-Navigate to bucket "Properties"

5ss

-Under "Static website hosting," click on the "Edit" button.

6ss

-Select the option "Enable".

-In the "Index document" field, enter the name of your main HTML file (e.g., "index.html").

-Optionally, you can provide a custom error document for handling 404 errors.

-Click on the "Save changes" button.

7ss

Step 5:

Upload Website Files

Open Notepad or any text editor and create a new file.

Write the desired content that you want to display on the website.

8ss

Go to the "File" menu and click on "Save As".

Enter a file name for your webpage, ensuring that you include the ".html" extension, such as "index.html".

Click on the "Save" button to save the file.

9ss

-Navigate to bucket "Object"

-Go to the "Upload" button or and click on it

10ss

-Go to the "Add files" select the "index.html" file and then click on the "Upload" button

11ss

-Once the upload is complete, you will see a confirmation message indicating that the file has been successfully uploaded.

12ss

Step 6

-Enable Public Access

-Go to the bucket settings and select "Permissions."

-Locate the section titled "Block public access (bucket settings)" and click on "Edit."

13ss

-Uncheck the box labeled "Block all public access" to allow public access to the bucket.

14ss

-In the designated field, type "confirm" to confirm your changes.

-this will will effectively enable public access for the bucket

15ss

Step 7

-Go to the bucket settings and select "Permissions."

-Locate the section titled "Bucket policy" and click on "Edit."

16ss

-Click on "Policy Generator" it will open in a new window.

17ss

-Select the type of policy as "S3" and set the effect to "Allow."

-In the "Principal" field, enter "*" to allow all the resourses.

-In the "Action" field, select "GetObject" to grant read access to the objects in the bucket.

-Paste the ARN (Amazon Resource Name) from the earlier tab into the "ARN" field.

-Click on "Add Statement" to include the generated policy.

18ss

-Copy the generated policy and paste it into the policy editor tab.

19ss

-Add "/*" at the end of the resource to allow access to all files under the bucket.

-Click on "Save Changes" to apply the bucket policy.

20ss

-Navigate to the bucket's website endpoint and copy the provided link.

21ss

-Open the link in a browser to verify if the website is functioning correctly.

-You should now see your static website live and accessible through the provided URL.

22ss

That's it! You have successfully hosted a static website using AWS S3.

About

In the "Static website hosting using AWS S3" project, I created a secure and efficient hosting solution using Amazon S3, allowing users to host static websites with ease.