For the majority of organizations intending to move to the cloud, their webpages and webapps are of the utmost importance, since they are, in most cases, the organization’s store front to the world and the interface through which the customers and potential customers interact with the services provided by the organization. Therefore, special attention should be given to the migration of such components so that they are able to take full advantage of all the facilities AWS provides in order to guarantee the best experience for the users while also improving the performance, scalability, and security of the website.

Taking this into account, at Magic Beans, we propose to our customers to migrate their webpages (whenever possible) to a S3 and CloudFront solution, instead of migrating their on-prem webserver as-is to their new AWS environment.

Why use AWS S3 for website hosting?

AWS S3 is a highly scalable and durable storage solution that can help you store, serve, and protect your website content. AWS S3 website hosting allows users to store their web pages and other content in S3 buckets.

One of the primary advantages of AWS S3 is its scalability. AWS S3 can handle an unlimited amount of data, making it an ideal platform for storing and serving website content. This means that as the website traffic grows, S3 infrastructure will handle the additional load without worrying about capacity limitations.

Cost is also a big advantage of S3 website hosting. This way the customer only pays for the amount of storage and the amount of bandwidth used. This means that there’s no webserver cost and the customer only ends up paying for actual usage, which translates to considerable savings compared to hosting on a traditional webserver.

AWS S3 is also a highly available service by default, ensuring that the website is always running, even in the event of infrastructure failure on AWS’ side, removing the need for a Disaster Recovery plan and solution. In addition to all of the points above, AWS S3 also offers robust security features, including encryption at rest and in transit, access control, and data compliance. This helps to protect your website from unauthorized access, data breaches, and other security threats.

Integration with CloudFront

Amazon CloudFront is a content delivery network (CDN) service that speeds up the distribution of static and dynamic web content.

Integration between AWS CloudFront and S3 allows for the use of CloudFront as a CDN to distribute the website stored in S3 to users globally, with low latency and high transfer speeds. This integration helps improve the performance of the website or application and reduce your overall content delivery costs.

To achieve this, CloudFront uses AWS’ Edge Location network to cache the website. This way, users can access the website with minimal latency.

CloudFront also provides real-time metrics and logs to help monitor and troubleshoot delivery issues, as well as understanding trends in the access to the website.

Deployment and management

Deploying this solution is also a much simpler setup than a traditional infrastructure. One only needs a S3 bucket with website hosting enabled and a CloudFront distribution that points to the bucket in question. A simple example can be seen below in Figure 1.

To manage and update the website contents, it is only required to update the source files that are inside the S3 bucket. This task can be achieved by using the AWS Console, the CLI or the SDK. This allows the user to do the updating manually in a web interface or have the freedom to automate the process however they like, for example, integrating this step in a CI/CD pipeline.

Below is an example of the same website architecture where the website code stored in the S3 bucket is updated by a pipeline from CodePipeline that is triggered by changes in a git repository. With this architecture we have a fully automated website deployment model that is compliant with modern DevOps practices and cloud-native philosophy.

Summary

By making the change to this hosting and distribution model, the organization eliminates virtually any need for infrastructure management regarding the website, no matter the scale of their project, or the demand spikes one might have to consider when managing a typical webserver infrastructure. Furthermore, by taking advantage of AWS’ worldwide infrastructure network, one can achieve levels resiliency and performance that are nearly impossible to achieve in a traditional solution.

By implementing such a solution, the organization can expect a much more resilient website, as well as the best performance available in the market and a reduced cost compared to a more traditional solution, all while being elastic in order to adapt to the real world demand.

This makes it, in our opinion the best solution to deploy a website, and that’s why we are so adamant in recommending it to our customers when they come to us to help them kickstart their cloud journey. In our eyes, deploying a website in S3 and CloudFront is the perfect example of a cloud-native solution.