Designing AWS architecture for Phoenix application

Posted:

AWSArchitecture

Imagine you have just finished developing your brilliant startup on Phoenix. What’s the next step? Yes, you are right. It’s time to test it and show to its first users. In the previous article, I’ve shown the way to deploy the application to an Ubuntu server, everything to one place. This way is rather good if your project’s load is not very high. But what if it grows? Then it needs to be scalable enough to handle as many customers as needed. This is where Amazon Web Services come to the scene. In this article, I will guide you through creating suitable AWS architecture for your basic Phoenix project.

Requirements

To move forward with this tutorial you need:

Overview

In this tutorial, we are going to create AWS architecture shown in the picture above.

In Part 1, we’ll make our app to work in AWS in the following way.
Our application will work in ECS container which will connect to RDS Postgres DB instance and S3 bucket for uploaded assets. Users will connect to our application through https serving by CloudFront.

To make things more reliable, in Part 2, we are going to set up continuous integration with Code Pipeline. It will take sources from our GitHub repo after any update of the ‘deploy’ branch. Then it will build the code, run dyalizer and tests. If they fail it will inform the Project manager by email. Otherwise, will build a release and deploy it to a staging container with temporary DB. When it’s ready, it will inform QA to test and accept production deploy. After deploy is accepted the pipeline will spin up container connected to RDS DB and that’s it.

In Part 3, we are going to create CloudFormation stack for all this stuff and discuss some alternatives to it.

Originally published on 3∑ blog on Medium.