RDS database with ECS and Metabase docker Image

RDS database with ECS and Metabase docker Imag

Project Overview:

To deploy Metabase, an open-source business intelligence tool, as a Docker container on Amazon ECS with Fargate, and connect it to a PostgreSQL (or MySQL) database hosted on Amazon RDS. This project demonstrates secure networking, container orchestration, and data visualization in a cloud-native architecture.

Architecture Summary:

- Metabase runs in a container on ECS Fargate.
- ALB exposes Metabase to the internet.
- RDS hosts the backend database (PostgreSQL or MySQL).
- All components are secured via VPC, subnets, and security groups.

Steps taken to complets this project :

1. Create Security Groups

ALB SG:
- Inbound: HTTP (80) from 0.0.0.0/0
- Outbound: All
ECS Task SG:
- Inbound: HTTP (3000) from ALB SG
- Outbound: PostgreSQL port (5432) to RDS SG
RDS SG:
- Inbound: PostgreSQL port 5432
- Outbound: All


2. Create RDS Database


Amazon RDS

- Engine: PostgreSQL
- Instance type: db.t3.micro (for testing)
- Subnet group: Public subnets
- Security group: RDS SG
- Enable public access: Yes
- Store DB endpoint, username, and password


3. Create Target Group

- Target type: IP
- Protocol: HTTP
- Port: 3000 (Metabase default)
- Health check path: /api/health


4. Create Aplication Load Balancer


Load balancer

- Scheme: Internet-facing
- Subnets: Public
- Security group: ALB SG
- Listener: HTTP (port 80) → forward to Metabase target group


5. Create Amazon ECS Cluster

- Type: Networking only(Fargate)
- Name: metabase-cluster


6. Crate Task definition


Amazon ECS

- Launch type: Fargate
- Container image: metabase/metabase
- Port mappings: 3000
Environment variables:
- MBDBTYPE: postgres
- MBDBHOST: RDS endpoint
- MBDBPORT: 5432
- MBDBUSER: your DB username
- MBDBPASS: your DB password
- MBDBDBNAME: your DB name
- Log configuration: awslogs


7. Create ECS Service


Amazon ECS

- Launch type: Fargate
- Cluster: metabase-cluster
- Task definition: the one you created
- Desired count: 1
- Load balancer: ALB
- Target group: Metabase target group
Network:
- Subnets: Public
- Security group: ECS Task SG
- Public IP: Enable

8. Access Metabase


Metabase
Metabase
Metabase

- Visit the ALB DNS name in your browser
- Complete Metabase setup wizard
- Connect to your RDS database
- Start building dashboards and visualizations