DEV Community

Cover image for Deploying Metabase on AWS ECS (Fargate) with PostgreSQL (RDS)
Ikoh Sylva
Ikoh Sylva

Posted on

Deploying Metabase on AWS ECS (Fargate) with PostgreSQL (RDS)

At some point in your cloud journey, you stop just deploying applications and start thinking about data, persistence, and real-world architecture.

Because most production applications don’t just run they store, query, and visualize data.

That’s exactly what this project is about.

Image of the AWS ECS Cluster

In this guide, I’ll walk you through how I deployed Metabase (an open-source business intelligence tool) on AWS using ECS with Fargate, and connected it to a PostgreSQL database hosted on RDS.

This is no longer just a “hello world” setup this is a real application backed by a real database.

What We’ll Be Building

In this project, we will:

  • Deploy Metabase using containers

  • Run it on Amazon ECS (Fargate)

  • Create a PostgreSQL database using Amazon RDS

  • Connect the application to the database

  • Configure networking and security for communication

By the end, we’ll have a fully functional data application in the cloud.

Why This Matters

This project introduces critical real-world concepts:

  • Application + Database architecture

  • Containerized workloads

  • Managed databases (RDS)

  • Secure service-to-service communication

  • Environment variable configuration

This is the kind of setup you’ll see in production systems.

Architecture Overview

User (Browser)
     |
     v
ECS Service (Fargate)
     |
Metabase Container
     |
     v
Amazon RDS (PostgreSQL)
Enter fullscreen mode Exit fullscreen mode

Both ECS and RDS must be in the same VPC for private communication.

Step 1: Create the RDS PostgreSQL Database

  1. Go to RDS → Create Database
  2. Choose:
  • Engine: PostgreSQL

  • Template: Free tier (if available)

Configure:

  • DB instance identifier: metabase-db

  • Username: postgres

  • Password: (your choice)

Networking Settings

  • Place RDS in your VPC

  • Choose a private subnet (recommended)

  • Disable public access (best practice)

Security Group for RDS

Add inbound rule:

  • Port: 5432 (PostgreSQL)

  • Source: ECS security group

This allows only your container to access the database.

Step 2: Create ECS Cluster (Fargate)

  1. Go to ECS
  2. Create a cluster
  3. Choose Fargate (Networking only)
  4. Name it: metabase-cluster

Step 3: Create Task Definition

  1. Go to Task Definitions → Create
  2. Choose Fargate

Container Configuration

  • Container name: metabase

  • Image: metabase/metabase

  • Port mapping:
    Container port: 3000

Environment Variables

Add the following:

MB_DB_TYPE=postgres
MB_DB_DBNAME=metabase
MB_DB_PORT=5432
MB_DB_USER=postgres
MB_DB_PASS=yourpassword
MB_DB_HOST=<RDS-ENDPOINT>
Enter fullscreen mode Exit fullscreen mode

Replace <RDS-ENDPOINT> with your database endpoint.

This is how Metabase connects to PostgreSQL.

Step 4: Create ECS Service

  • Launch type: Fargate

  • Task definition: metabase-task

  • Number of tasks: 1

Image of Metabase Database

Networking Setup

  • Use the same VPC as RDS

  • Select subnets (public or private depending on access strategy)

  • Enable public IP (if accessing via browser)
    Security Group for ECS

Add inbound rule:

  • Port: 3000

  • Source: your IP (recommended)

Step 5: Deploy and Run

  • Start the service

  • Wait for task status → RUNNING

Step 6: Access Metabase

  1. Get the public IP of the ECS task
  2. Open: http://<public-ip>:3000

You should see the Metabase setup screen!

Common Mistakes to Avoid

  1. ECS and RDS in different VPCs
    They won’t communicate.

  2. Incorrect RDS endpoint
    Connection will fail.

  3. Missing security group rule (5432)
    Database access will be blocked.

  4. Wrong environment variables
    Metabase won’t initialize properly.

What This Project Teaches You

This project is a major step forward.

You learn:

  • How applications connect to databases

  • How to configure secure communication

  • How to run stateful applications in the cloud

  • How real-world systems are structured

This is no longer just infrastructure it’s application architecture.

Real-World Use Cases

This setup is similar to:

  • Internal analytics dashboards

  • Business intelligence platforms

  • SaaS reporting tools

  • Monitoring and metrics visualization

Deploying Metabase with ECS and RDS is where things start to feel real.

You’re no longer just launching resources you’re building connected systems.

And that’s the difference between:

“Learning cloud” and “Thinking like a cloud engineer”

Image of a Metabase Site

I’m also excited to share that I’ve been able to secure a special discount, in partnership with Sanjeev Kumar’s team, for the DevOps & Cloud Job Placement / Mentorship Program.

For those who may not be familiar, Sanjeev Kumar brings over 20 years of hands-on experience across multiple domains and every phase of product delivery. He is known for his strong architectural mindset, with a deep focus on Automation, DevOps, Cloud, and Security.

Sanjeev has extensive expertise in technology assessment, working closely with senior leadership, architects, and diverse software delivery teams to build scalable and secure systems. Beyond industry practice, he is also an active educator, running a YouTube channel dedicated to helping professionals successfully transition into DevOps and Cloud careers.

This is a great opportunity for anyone looking to level up their DevOps/Cloud skills with real-world mentorship and career guidance.

Do refer below for the link with a dedicated discount automatically applied at checkout;

DevOps & Cloud Job Placement / Mentorship Program.

If you also found this interesting and would love to take the next steps in the application process with AltSchool Africa do use my referral link below;

Apply here or use this Code: W2jBG8 during the registration process and by so doing, you will be supporting me and also getting a discount!

Special Offer: By signing up through the link and using the code shared, you’ll receive a 10% discount!

Don’t miss out on this opportunity to transform your future and also save while doing it! Let’s grow together in the tech space. Also feel free to reach out if you need assistance or clarity regarding the program.

I’m Ikoh Sylva, a passionate cloud computing enthusiast with hands-on experience in AWS. I’m documenting my cloud journey here from a beginner’s perspective, aiming to inspire others along the way.

If you find my contents helpful, please like and follow my posts, and consider sharing this article with anyone starting their own cloud journey.

Let’s connect on social media. I’d love to engage and exchange ideas with you!

LinkedIn Facebook X

Top comments (0)