# How I Achieved 99% Cost Saving After Migrating My Application To Azure

Almost every year I try to come up with a side project to work on in order to keep my skills as sharp as possible as well as explore new technologies. Most of these projects never see the light of day but I’m extremely proud of my Regulatory Exam (RE) Made Easy applications (RE 5 Made Easy and RE 1 Made Easy) that I developed in 2019 and 2020 respectively. At the time of writing, these apps have combined downloads of over 35,000. I am a super proud dev . In this post I am going to talk about how I migrated one of the components used by both applications to Azure and saved 99% in costs.

I built a separate web application that serves as a back office admin portal. It also has a small user-facing component to it that helps users carry out certain tasks that I didn’t expose in the apps. When I started back in 2019, I built the portal using Flask, a Python framework for building web apps and APIs. One of the main reasons for using Flask was to learn something new. Both the apps and the admin portal were built using technologies that I had never worked with before – Flutter for the mobile apps and Flask for the admin portal. Talk about throwing oneself in the deep-end.

### Initial Architecture

The old admin portal was a simple Flask web application that used PostgreSQL for persistence. The UI component was built with Jinja templates that were styled using Tailwind CSS.

It also used a custom-built authentication/authorization layer (very brave I know) for the back office admin section. I also integrated with Firebase – where I handle all my mobile app backend services from auth, image storage, etcetera. Integration with SendGrid was also added so I could send transactional emails to the users. A simplified diagram of the architecture is shown in Figure 1 below:

This was a simple architecture that enabled me to have a relatively short time to market – something that was very paramount at the moment. However, it had a few drawbacks:

• Security: I’m not a big fan of custom-built authentication/authorization services. I could have opted for an external provider but I didn’t want to bite more that I could chew.
• No segregation: The same Flask web app served as both the back office admin portal as well as a user-facing portal. The back office portal was protected by the custom auth layer I wrote while the user facing endpoints allowed anonymous access. This did not sit very well with me.

## Conclusion

In this post I spoke about how I managed to save 99% after migrating one of my applications to Azure. Like always, thank you so much for taking your time to read. Don’t hesitate to leave a comment, question or suggestion in the comments section below.

Tags:

Updated: