DEV Community

Cover image for Running a Containerised App on AWS: My Experience
Ijay
Ijay

Posted on

Running a Containerised App on AWS: My Experience

In this project, I wanted to practice building a DevOps workflow from development to deployment.
The goal was simple. Take a small application, package it with Docker, deploy it to AWS, and automate the process using GitHub Actions.
This project helped me understand how different tools in the DevOps ecosystem work together.

What this project does

This project shows how an application can move from code to deployment using automation.

The process looks like this:

  • Code is pushed to GitHub
  • GitHub Actions builds the Docker image
  • The image is pushed to Amazon ECR
  • Amazon ECS Fargate pulls the image

This removes the need to manually deploy applications.

Architecture

Here is a simple view of the setup:

Developer (Build the code)
   │
   │ 
   ▼
Build Docker Image
   │ provision with Terraform
   ▼
Amazon ECR
   │
   ▼
Amazon ECS Fargate
   │ push code
   ▼
GitHub Repository
   │
   ▼
Users can access the application
Enter fullscreen mode Exit fullscreen mode

Tools used

  • Docker
  • Terraform
  • AWS ECS Fargate
  • Amazon ECR
  • GitHub Actions
  • Node.js

Each tool plays a different role in the deployment process.

  • Docker packages the application so it runs consistently anywhere.
  • Terraform creates and manages the infrastructure.
  • ECR stores the container images.
  • ECS Fargate runs the containers without managing servers.
  • GitHub Actions automates the build and deployment process.

Key steps in the project

The application was packaged into a Docker image using a Dockerfile. This allows the application to run consistently across environments.

Creating the infrastructure

  • Terraform was used to create the AWS infrastructure:
  • VPC
  • Subnets
  • Security groups
  • ECS Cluster
  • ECS Service running on Fargate

Using Terraform makes the infrastructure reproducible and easy to manage.

Deploying to ECS Fargate
The container image stored in Amazon ECR is pulled by ECS Fargate. Fargate runs the container without needing to manage EC2 servers.

When code is pushed to the main branch:

  • The Docker image is built
  • The image is pushed to Amazon ECR
  • ECS updates the running service
  • This means deployments happen automatically.

What I learned

Working on this project helped me understand how different DevOps tools connect.

Challenge

One challenge I encountered during this project was configuring the Application Load Balancer. After deploying the service on ECS Fargate, the application was accessible using the assigned public IP address. However, I wanted users to access the application via a stable DNS URL rather than an IP address.
To achieve this, I set up an Application Load Balancer and connected it to a target group. The target group showed a healthy status, which indicated that the ECS service was running correctly. Despite this, the application was still not accessible through the load balancer DNS.
After several attempts to troubleshoot the issue, I suspected it might be related to network configuration or security group settings. Since the project's focus was the deployment pipeline, I temporarily removed the load balancer configuration.
For now, the application can be accessed using the public IP address assigned by ECS. I plan to revisit the load balancer configuration later to fully resolve the issue.

Assign IP from AWS ECS

Project repository

You can see the full project here

Final thoughts

This project helped me put my DevOps knowledge into practice and see the tools I have been learning work together in a real setup. It was a good opportunity to apply Docker, Terraform, AWS, and CI/CD in a practical environment and better understand how these tools support deployments.


If you would like to build the same setup yourself, I wrote a step-by-step guide explaining the exact process.


If you found this article helpful, share it with others who may find it interesting.


Other Helpful Resources


Stay updated with my projects by following me on Twitter, LinkedIn, and GitHub.

Thanks for reading

Top comments (0)