Building dashboards with minimal servers.
Over the course of several data science projects one finds that eventually you will need to express results to the business in a clear and concise way that encapsulates your models observations and does so in a visaually appealing way. This is where the skill of dashboarding comes in. As data scientists, our weapon of choice is Dash, a flask based dashboarding tool that allows you to display the full power of python in a web-app based dashboard.
Now there is some skill involved when bringing Dash from your laptop to a scalable web-app that others can access. Traditionally we would need to spin up a server and have it hosted there 24/7 meaning big costs for a simple app if we're not using the server for anything else. The magic of AWS allows us to negate most of these costs in a few different ways.
The "serverless" EC2 method
Wait a second, I thought this was SERVERLESS dashboarding, why would we be spining up servers? Well, I would like you to consider this option as a very cost efficent method of hosting dashboards in the spirit of serverless architecture. In this method we do the following
With this architechture you have essentially built a nice "pay for what you use" dashboard that is great for short 10-15 minute looks at data, by actually clicking on the link to get here you have fired the API request to turn on the EC2 which is now visible here: DASHBOARD
There are some problems with this method, mainily that you are bound to a "cold-start" when you need to see the dashboard, which could be potentially minutes of time.
Container based solutions
While the above option is attractive for low traffic dashboarding, it becomes far less attractive when we require a more scalable solution without the worries of server upkeep. This is where Fargate, EBS, and ECS comes into play. Using these AWS tools we can create a docker image of our dash code, which we then upload to ECR and run it on AWS fargate using ECS.