Logo

dev-resources.site

for different kinds of informations.

Hosting a Static Website On S3 bucket With CloudFront.

Published at
9/27/2024
Categories
aws
s3
cloudfront
website
Author
stefanie-a
Categories
4 categories in total
aws
open
s3
open
cloudfront
open
website
open
Author
10 person written this
stefanie-a
open
Hosting a Static Website On S3 bucket With CloudFront.

Image description

Overview

In this article, you will learn how to deploy a simple website using HTML, CSS, and JavaScript using Amazon CloudFront and S3.

Amazon Simple Storage Service (S3) allows you to host static websites by providing object level storage. It stores and retrives data as objects iwithin buckets, making it perfect for static website hosting.

Amazon CLoudFront is a Content Delivery Network (CDN) service which utilizes a network of edge locations to cache copies of your website content closer to users, reducing latency and ensuring faster delivery.

Step 1: Log in to AWS and Access S3

Login to your AWS management console and search for s3 in the search bar.

Image description

Step 2: Create an S3 Bucket

  • Click on create a bucket
  • Choose General purpose
  • Enter a unique name for your bucket
  • Ensure Block all public access is selected. Leave the rest of the settings at their default values and click Create bucket.

Image description

Step 3: Upload Website Files

Once your bucket is successfully created:

  • Click on the newly created bucket.
  • Upload your index.html, css , javascript , and any other static files.

Image description

Step 4: Set Up CloudFront Distribution

Now, we'll set up a CloudFront Distribution.

  • Navigate to CloudFront in AWS Console.

Image description

  • Click Create Distribution.
  • Create a new Origin Access Control (OAC) to securely grant CloudFront access to your S3 bucket.

Image description

  • Set Redirect HTTP TO HTTPS
  • Since this is a basic tutorial, your website won't need WAF.

Image description
Once youโ€™ve completed the setup, AWS will create your CloudFront distribution.

Step 5: Update the s3 Bucket Policy

After creating the CloudFront distribution, you'll see a prompt asking you to update your S3 bucket policy. This step is important to allow CloudFront access the content in your bucket.

Image description
Copy the policy, head over to your s3 bucket permissions tab and paste the new policy in the Bucket Policy Editor and save the changes.

Image description

Step 6: Access Your Website

Copy the Distribution Domain Name from CloudFront, open it in your browser, and you will see your static website!

Image description

Conclusion

You've now successfully hosted a static website using Amazon S3 and Amazon CloudFront. With S3 providing scalable storage and CloudFront ensuring fast, reliable content delivery through its edge locations, your website is well-optimized for performance and availability.

cloudfront Article's
30 articles in total
Favicon
Lee esto antes de implementar S3 y CloudFront usando Terraform.
Favicon
Lee esto antes de implementar S3 y CloudFront usando Terraform.
Favicon
Building an S3 Static Website with CloudFront Using Terraform
Favicon
AWS CloudFront: A Comprehensive Guide
Favicon
Configuring AWS WAF, CloudFront, and S3 Bucket for Secure Access
Favicon
Setting Up Custom Domain for API Gateway & CloudFront
Favicon
Apply SSL Certificate on AWS ACM (also Cloudflare)
Favicon
How to Fix Next.js CloudFront Permission Denied: Complete Guide to Static Export URL Issues
Favicon
Building Testable CloudFront Functions with TypeScript
Favicon
CloudFront and S3: SignatureDoesNotMatch , the request signature we calculated does not match the signature you provided
Favicon
Mastering Custom Responses in Amazon CloudFront to Block Behavior โ€” Default(*)
Favicon
Unlock CloudFront's New Logging Potential with Athena Partition Projection
Favicon
Discovering the Latest Features of AWS CloudFront: Enhancing Performance andย Security
Favicon
Create an Asset Store with a Custom Domain using AWS CDK, Route53, S3 and CloudFront
Favicon
New Feature: Amazon CloudFront no longer charges (No Billing) for requests blocked by AWS WAF
Favicon
Reduce the amount of code in AWS CDK: Apply OAC in Amazon CloudFront L2 constructs
Favicon
Amazon Web Services (AWS) has announced today a new edge location in #Qatar
Favicon
Hosting a Static Website On S3 bucket With CloudFront.
Favicon
Setting up AWS S3 and CloudFront with Signed URLs using CDK
Favicon
Leveraging Lambda@Edge to seamlessly manage frontend maintenance window like a pro
Favicon
How to Resolve 403 Access Issues When Deploying a SPA on AWS with S3 and CloudFront
Favicon
Cloud Resume Challenge: Hosting a React CV using S3, CloudFront, Route 53, Lambda, DynamoDB and GitHub actions for CI/CD
Favicon
Deploying Static Website to AWS: A Step-by-Step Guide with S3, Route 53, and CloudFront
Favicon
Resolve Lambda URL Error - signature not match when using POST/PUT
Favicon
Setting Up and Securing CloudFront for S3 Static Sites with Custom Subdomains Using AWS Cloud Development Kit(CDK)
Favicon
How to Host a Static Website on AWS Using S3, Route 53, CloudFront, and Certificate Manager
Favicon
RTT Reduction Strategies for Enhanced Network Performance
Favicon
Dynamically Choosing Origin Based on Host Header and Path with AWS CloudFront and Lambda@Edge
Favicon
Understanding Speed: A Beginner's Guide to AWS CloudFront
Favicon
Deploy a Static React Site Using AWS S3 and CloudFront

Featured ones: