Web hosting options with AWS

Want to know how to host website in AWS cloud, this post explains in detail about website hosting with different options.

Sathvik
Code Direct
4 min readMay 11, 2021

--

Photo by Greg Rakozy on Unsplash

Hosting a website is a very easy task now more than ever before. With the cloud providers competing for the best of the best to provide the most reliable and easy to use services, hosting a website is one of the core service. Amazon Web Services (AWS) is a leading and a cloud pioneer. There are many options to host a website in AWS. A website for making the existing products which are for internal use need not be indexed by the search engines, websites like this can be hosted in the server-less platform (Client-side rendering).

The websites which need to be indexed by the search engines for more visibility of business purposes need to be crawlable by the search engines — to achieve this, the website needs to be hosted on the servers(Server-side rendering).

To know more about client-side rendering and server-side rendering check out our post here.

Hosting a Website using S3

With the help of modern web UI frameworks developing a website is faster and better. Frameworks like Angular and React are the most famous. These frameworks bundle/compile the source file into HTML and JS files, a.k.a Single-page Applications (SPA).

The HTML, Script, and other supporting files can be copied into the S3 Bucket and turn on the static web hosting option from the Properties tab. Specify the initial HTML to show when requested by the users and error HTML page to show when error actors to fetch the files in the S3 Bucket.

For the pages to be displayed in the search engines it’s not recommended to host the website from the S3 bucket. To serve the pages globally the site endpoint can be connected to the Cloud Front. Can be accessed with faster load times after the initial user request. The hosted URL can be pointed as an “A Name” in the DNS entry in Route 53 in AWS.

Security

Files Hosted in S3 are all public, make sure they are Trans compiler to a non-friendly format with tools like babel and enforce the usage of HTTPS.

Availability

S3 Availability is 99.999999999% and the Cloud-Front caches the content in the local region and all of it is managed by the AWS.

Hosting With EC2 Instance

Server-side rendered (SSR) pages perform better than the SPA(Single page application) since these pages are rendered in the server and sent to the user. AWS has many options to host SSR Websites.

EC2 instances are the bare minimum highly configurable server instance with resizable storage and with pre-selected and ready to migratable instance, which can run all kinds of application in the cloud for AWS.

Using these instances the Websites can be hosted based on the region and user traffic.

EC2 instance and scaled out by placing them in auto-scaling groups. The traffic across the servers can be configured with the help of load balancers and managed more efficiently. The initial load of the page can be slower if the instances takes time to render pages. So make sure that the web applications are optimized to deliver content.

The AWS offers more instances like Elastic Beanstalk which does the heavy lifting of the initial configuration which is not dependent on the technology used in host. WordPress etc.. preimages can be used to create EC2 instances from AWS Marketplace.

Security

The website’s certificates can either be manually installed on the instance or attached to the load balancers. Either the groups or auto balancers can be pointed as “A Name” of DNS record or instance public IP of instance can be pointed. Site security should be managed at host application.

Availability

Website Availability is dependent on the traffic load, EC2, Route 53, and other services availability.

While there are lot of other options to consider like Kubernetes etc., they would most likely fall under one of the explained methods above. Since the AWS releases new services rapidly we couldn’t cover all of it here or if you’re checking out this post from mars 😉.

For more details on setting web hosting visit S3 Hosting and EC2 Setup.

--

--

Sathvik
Code Direct

Learning , Making computers do stuff, crypto explorer, living in Cayman.