Production Level Static Sites in AWS

Production Level Static Sites in AWS

In this article, I will detail what I think is a more secure and more professional way to host static sites using AWS. While I use Gatsby to render my static sites I am not going to go into the site code itself. This is how to host your already generated static files.

When you go to most websites you can probably notice two things, the site usually redirects to HTTPS and it usually redirects to the WWW subdomain. Whether you type in the naked domain (the apex domain) or not. The reasons to do so are long but mostly for SEO and professional expectations, here’s a shortlist of good reasons.

Another thing, I’ll point out that bugs me is when people use AWS S3 for hosting, which sets their S3 bucket to public. I know this is an offered feature but your one misconfiguration mishap from a hacker is defacing your site.

In this article, I will detail what I think is a more secure and more professional way to host static sites using AWS. While I use Gatsby to render my static sites I am not going to go into the site code itself. This is how to host your already generated static files.

This is going to seem counterintuitive at first but we are actually going to set up the www subdomain first.

Create a Private S3 Bucket

First, we are going to create a new bucket. The name does not matter and we don’t want to give permission to the public. I usually denote these to be buckets with contents in its name. You *don’t *want to give the bucket the name of the domain, this can get confusing later. Do something like domain-contents as the bucket name.

Now upload the contents of your static site here. Honestly, for ease, I usually upload a simple index.html with a large heading just to test that I have everything up and running without also having to debug my site at the same time. Do something predictable.

Now we have a private S3 bucket with our site. We shouldn’t be able to reach this from outside AWS at all.

S3 Private bucket for website content

s3-bucket cloudfront hosting-service dns aws

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to deploy static websites to AWS S3 and CloudFront

Deploying static websites for progressive web apps, landing pages and countless other use cases. We often see the need for static websites to serve various requirements, such as a web application, an admin interface for a service, a landing page and countless other cases where all that’s required is pre-built HTML pages with CSS and JavaScript. In this post, we’ll take a look at one of Altostra’s templates that can help you deploy static websites quickly. How to deploy static websites to AWS S3 and CloudFront

What Is S3 In AWS | AWS S3 Tutorial for Beginners

In this video, i will show you what is s3 in aws ,S3 is a simple stroage service with excellent reliability and cost structure. I show you some of the basic ...

How to host a Static Website in AWS S3 - CodeBabel

Along with unlimited cloud storage, AWS S3 can be used to host static web content. In this article, we will discuss how to host a static website in AWS S3.

Cache Busting for an Angular App Deployed with AWS S3 and CloudFront

Caching is a very good way to load our web pages faster on users’ browsers, But that same cache becomes a problem when you have made a new release of your web application and this new release contains few very important bugs fixes or import feature. In that case, You expect your users to start using a new version of your application and you will have to handle cache-busting during such release. In this post, I am going to share a checklist of things that you should do to bust the cache for an angular app deployed with AWS S3 and Cloudfront.

12 Strategies to Reduce Amazon S3 Costs

Amazon Simple Storage Service or Amazon S3 is a service designed to house storage for the internet. In this article, we'll talk through all the strategies you can use to reduce Amazon S3 costs.