How to Host an S3 Website With Cloud Front

Posted By :Kapil Soni |27th December 2022

How to Host an S3 Website With Cloud Front 


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Can you host a website on S3?

You may run a static website using Amazon S3. Individual webpages on a static website contain static material. Additionally, they might include client-side scripting. A dynamic website, on the other hand, is dependent on server-side processing, including server-side scriptings like PHP, JSP, or ASP.NET.

Can S3 host a WordPress site?

WordPress static site hosting is a good fit for AWS S3. It saves time that would otherwise be spent making sure plugins, themes, and security processes were properly configured and is secure and affordable.

 

1. Naming Your S3 Bucket

Your bucket name must be www.my-awesome-site.com if your website's domain is www.my-awesome-site.com.

2.2. Setting Up Your S3 Bucket for Static Website Hosting.
Okay, you have your bucket. It has the same name as your domain name, correct? It's time to configure the bucket for static website hosting.

* Navigate to S3 in the AWS Console.
* Click into your bucket.
* Click the “Properties” section.
* Click the “Static website hosting” option.
* Choose "Use this bucket to host a website" .
* Enter “index.html” as the Index document.

3. we need a public access bucket policy. To allow this you must complete the following steps before adding your bucket policy.

* Click into your bucket.
* Choose the "Permissions" tab at the top.
* Under “Public Access Settings” we want to click “Edit”.* Change to false and save the values for "Block new public bucket policies," "Block public and cross-account access if the bucket has public policies," and "Block new public ACLs and uploading public items."
* Before adding the bucket policy to your static website bucket, you must do this step.

 


4. Now you must update the Bucket Policy of your bucket to have public read access to anyone in the world. The steps for updating the policy of your bucket in the AWS Console are as follows:

* Navigate to S3 in the AWS Console.
* Click into your bucket.
* Click the “Permissions” section.
* Select “Bucket Policy”.
* Add the following Bucket Policy and then Save

Bucket Policy
###################################################################
****************************************************************
{
    "Version": "2008-10-17",
    "Id": "PolicyForPublicWebsiteContent",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::www.my-awesome-site.com/*"
        }
    ]
}
****************************************************************
###################################################################

In Static website hosting

How to host a Static Website on Amazon S3 - Publii

Static website hosting - Enabled
Hosting type - Bucket hosting
Bucket website endpoint - http://first-main.s3-website.ap-south-1.amazonaws.com


Then The S3 Website provides U A Endpoint With This End Point U Access Your Website


About Author

Kapil Soni

Kapil is an exceptionally skilled DevOps Engineer with a profound understanding and expertise in a wide range of cutting-edge technologies. His knowledge encompasses AWS, Azure, GCP, Kubernetes, Azure DevOps CI/CD, ELK, and more. He has a proven track record of successfully deploying and managing large-scale cloud infrastructures. He leverages automation tools and follows industry best practices to ensure optimal performance and scalability. Kapil's collaborative approach and unwavering commitment to continuous improvement make him an invaluable team member in dynamic environments. He has made significant contributions to numerous projects, including Kubernetes and AWS, Oneinfinity, Dunkan, SecureNow, Yogamu, and several others.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us