Application components – Running Containers in AWS
- Blog
- Application components – Running Containers in AWS
This is supposed to bea long-running application that will primarily consist of two containers – a web application and a database. We can define them in their respective container definitions, which can then both be mapped to a single task definition. ECS offers the service construct to manage such long-running applications, so we will use it to expose the application container to the outside world on port 5000. As a best practice, we will front the application with an Application Load Balancer and the ECS service will take care of registering/de-registering the containers as part of their life cycle.
To build the core of our application, we will use the Python-based Flask framework. Among many other features the web application framework offers, we are mainly interested in static file support, template rendering, and HTTP request/response management. We will see these code snippets in action in the following sections. The application frontend will be rendered using HTML and Bootstrap. All the user interactions (creation or deletion of tasks) will be mapped to the corresponding APIs in Flask:
Similar to what we have used for the command- line utilities required in all exercises so far, I have published the bundled application code for the test application in a Docker image, in the public DockerHub registry. This should save you some hassle around building and hosting this image onyour own. Refer to Figure 7.3 for a visual understanding of how the application containers hosted in ECS interact with other infrastructure elements:
Figure 7.3 – Application components and the workflow of the To-Do List Manager application hosted on ECS
We intend to use CDK to deploy our infrastructure and application elements. So, let’s discuss the stack components we will require.
© Copyright 2024 morningfun.org