
Migrating a Legacy Website to the Cloud, Leveraging CloudFront and S3
Introduction
The client, a team of researchers at Broad Institute, had a legacy application that was created using a Python script. A repository of over 80,000 static HTML files was created using this script. The client wanted us to try out SharePoint first and see if the solution worked as expected without making much changes to the same.
Objectives
The client wanted the look and feel to be very similar to what they currently had, and more importantly, the speed of the website had to be super-fast.
Approach
The first approach as recommended by the client was SharePoint. A sample set of the static assets along with an index of the files (a file consisting of the meta information associated with the static files), was also created by the client and sent to us.
We integrated these static files within a document library and the meta information file as a list within SharePoint.
The first challenge was being able to link the documents in the document library with the list. As these are 2 mutually exclusive objects, hence creating a relationship between them was not out of the box. We reverse-engineered the file structure and introduced custom JavaScript-based code to the list, facilitating the linking of items in the list to the corresponding documents in the library. This approach worked ok, but we were not very happy with the overall outcome.
The second challenge was being able to open the external documents, i.e., some of the meta information consisted of external URLs pointing to external websites. SharePoint does not allow one to open external websites owing to security features. Our attempts to mitigate this issue by reducing security settings at the admin level proved futile.
The third challenge we came across was regarding the speed of the website (SharePoint deployment). This issue was exacerbated by the use of the online version of SharePoint, rather than the on-premises solution, thereby placing limitations beyond our control.
A demo of this solution was presented to the client, and unfortunately (or fortunately) this approach was rejected.
Now with the SharePoint solution of the way, we concentrated on a pure cloud-native application (something we specialize and take great pride in!).
Post rejection of multiple AWS architectures, we decided on the following approach:
- All static assets go into S3
- For optimized speed, we added CloudFront as the CDN
- For Authorization and Authentication, we added Cognito.
Now, as our solution is a serverless solution (WITHOUT A DATABASE, i.e. No persistent storage), we use Lambda on the edge to maintain users’ authentication/authorization.
A diagram of the architecture can be found below:
With this approach, our costs came down drastically, whereas there are no server costs, we are only paying for the storage. With a limited user base exhibiting dedicated usage, our CloudFront-based approach has helped speed up the application by a factor of 3x over the previous version, and about 15x over the SharePoint setup.
The client enthusiastically embraced our solution due to the cost reduction and superior speeds it offered.
Biggest takeaways from this approach:
- Do not try to force a solution on a framework that does not provide the best fit.
- Cloud provides great microservices, choose the exact services meticulously based on what you want.
- Do study the pricing of each service, else at the end of the month, you will realize (or not) what hit you.
- Try to use the free tier of services where applicable
- Add alerts/notifications to your account to ensure you stay on top of your billing
- Enhance security by enabling Multi-Factor Authentication (MFA) for your root account. Safeguard your root account; limit its access within your development team. Embrace simplicity with the “Keep It Simple, Stupid” (KISS) principle. Do not hesitate to contact AWS, and AWS Partner, or an AWS specialist to help you with these migrations.
There could be funding from AWS to help you with your project, so do ensure you contact us at the right time before initiating the project!
Related: How Cloud Computing Can Benefit Your Business Operations