1. Context and scale
A startup usually reaches the same awkward point: product and operations questions are arriving faster than engineers can answer them. Someone wants signups by acquisition channel; someone else needs to know which accounts renewed last month. If every answer requires a custom SQL query or an application release, analytics becomes a queue rather than a capability.
This blueprint gives a small internal team self-serve access to curated product data using Metabase and PostgreSQL. It deliberately starts without a separate warehouse, a transformation framework, or a streaming pipeline. The product already stores business data in PostgreSQL; Metabase reads a carefully limited reporting schema on that same managed database instance.
The example uses AWS because it provides a straightforward managed PostgreSQL service and container runtime. The design is deliberately a single-region, single-database-instance starting point. This saves money and operational effort, but does not isolate analytics from application workloads. That trade-off is explicit, measured, and reversible.
Assumptions — planning inputs, not measured requirements
| Dimension | Assumption |
|---|---|
| Users | 5–20 internal Metabase users; fewer than 1,000 product users per day |
| Requests/s | Product API averages under 10 requests/s; analytics is occasional and interactive, not a public query API |
| Data volume | 20 GB of PostgreSQL data today; under 100 GB in the first year; daily growth is modest |
| Team size | 1–3 engineers, with one person owning the reporting model and access reviews |
| Budget | Target roughly $150–$350/month for the analytics-related AWS footprint; estimate excludes the existing application and database cost where shared |
The figures are sizing assumptions. Validate them with real workload measurements and the AWS Pricing Calculator before committing to a budget. If the application has strict availability or latency requirements, do not share database compute with analytics merely to meet a cost target.
2. Requirements
The goal is not to make every table queryable. It is to make common business questions answerable without handing every user unrestricted access to production data.
Functional requirements
| Requirement | Design response |
|---|---|
| Answer common product and revenue questions | Publish stable PostgreSQL reporting views with documented metric definitions |
| Let non-engineers explore data | Use Metabase questions, models, dashboards, and collections |
| Keep dashboards useful as the schema changes | Treat reporting views as an application interface and test them in CI |
| Limit access by role | Use Metabase groups and collections; restrict the database credential to reporting objects |
| Preserve history and recoverability | Use RDS backups and rehearse a restore of both product and Metabase metadata |
| Avoid a manual data refresh process | Query current PostgreSQL data directly; communicate the freshness and latency characteristics |
Non-functional requirements
| Requirement | Starting target |
|---|---|
| Availability | Best-effort internal analytics during business hours; a database outage may affect both analytics and the product |
| Freshness | Near-current for ordinary views; no claim of a separate warehouse refresh schedule |
| Performance | Typical dashboard loads under 5 seconds at low concurrency; investigate sustained slower queries |
| Security | Private database networking, TLS, least-privilege database roles, and no unnecessary personal data in reporting views |
| Operability | One AWS region, one Metabase service, managed PostgreSQL backups, and documented restore steps |
| Cost | Reuse the existing RDS instance initially; make database isolation the first scaling move when workload warrants it |
3. High-level design
Metabase is a web application, not a database proxy with independent query capacity. Its application database stores users, saved questions, dashboards, and settings. Its analytics connection reads product data. Keeping those databases logically separate prevents Metabase metadata from being mixed into product tables, even though this initial design hosts both databases on the same RDS instance.
The product application writes to PostgreSQL as usual. Metabase runs as a small ECS Fargate service behind an Application Load Balancer. Its analytics database user can read only the reporting schema. Its application database user can read and write only the dedicated Metabase database.
flowchart LR
User["Internal users"] --> DNS["Route 53"]
DNS --> ALB["Application Load Balancer"]
ALB --> MB["ECS Fargate Metabase"]
App["Product application"] --> RDS["Amazon RDS for PostgreSQL"]
MB --> RDS
MB --> Secrets["AWS Secrets Manager"]
RDS --> CW["Amazon CloudWatch"]
MB --> CW
RDS --> S3["Amazon S3 backup exports"]Metabase reads curated reporting objects in RDS; the application and Metabase metadata use separate databases and credentials.
The diagram shows the principal components, not every network resource. Route 53 and the load balancer expose the web application over HTTPS. ECS tasks and RDS remain in private subnets. Secrets Manager holds credentials, and CloudWatch receives service and database telemetry. RDS automated backups are the primary recovery mechanism; S3 can hold exported artifacts or separately managed backup copies when required by policy.
The design is intentionally not highly available. One RDS instance is a cost-conscious starting point, not a resilient analytics platform. A heavy dashboard can consume resources needed by the product. Query timeouts, conservative user access, and monitoring reduce the risk; a read replica or separate analytics instance is the next isolation step.
4. Cloud service mapping
The AWS column is the implementation in this blueprint. The other columns name broadly comparable managed services, not drop-in equivalents; networking, identity, backup, and pricing details differ.
| Component | AWS choice | Azure equivalent | GCP equivalent |
|---|---|---|---|
| DNS | Route 53 | Azure DNS | Cloud DNS |
| HTTPS entry point | Application Load Balancer | Application Gateway | Cloud Load Balancing |
| Container runtime | Amazon ECS on Fargate | Azure Container Apps | Cloud Run |
| PostgreSQL | Amazon RDS for PostgreSQL | Azure Database for PostgreSQL Flexible Server | Cloud SQL for PostgreSQL |
| Credentials | AWS Secrets Manager | Azure Key Vault | Secret Manager |
| Logs and metrics | Amazon CloudWatch | Azure Monitor | Cloud Monitoring and Cloud Logging |
| Container registry | Amazon ECR | Azure Container Registry | Artifact Registry |
| Object storage for exports | Amazon S3 | Azure Blob Storage | Cloud Storage |
| CI identity | GitHub Actions OIDC to AWS IAM | GitHub Actions OIDC to Microsoft Entra ID | GitHub Actions Workload Identity Federation |
A container platform is sufficient for Metabase at this scale. ECS Fargate avoids managing hosts, while keeping the service in a private network. The service should use a pinned, reviewed Metabase image rather than a floating latest tag. Choose and test an edition and version deliberately; features such as some enterprise authentication and governance integrations may require a paid edition.
5. Data design
For the first stage, PostgreSQL is both the application store and the analytics source. Do not expose the entire operational schema just because Metabase can connect to it. Create a reporting schema with a small number of stable views, names that reflect business concepts, and definitions that have an owner.
The example below models customers, products, orders, and line items. It uses integer minor units for money, which avoids floating-point rounding errors. The reporting view defines booked revenue as the sum of line-item amounts for orders that are paid or fulfilled. That is a business rule, not a universal accounting definition; finance should approve the metric before it becomes a dashboard headline.
erDiagram
CUSTOMER ||--o{ SALES_ORDER : places
SALES_ORDER ||--|{ ORDER_ITEM : contains
PRODUCT ||--o{ ORDER_ITEM : appears_in
CUSTOMER {
bigint id PK
text country_code
timestamptz created_at
}
SALES_ORDER {
bigint id PK
bigint customer_id FK
text status
timestamptz created_at
}
PRODUCT {
bigint id PK
text category
boolean active
}
ORDER_ITEM {
bigint id PK
bigint order_id FK
bigint product_id FK
integer quantity
integer unit_price_cents
}The reporting model exposes commercial facts while keeping customer-identifying details out of the initial analytics interface.
Here is a minimal runnable Metabase query. It assumes the tables and columns shown below exist. Use a half-open time interval so adjacent periods do not double-count boundary timestamps.
SELECT
date_trunc('month', o.created_at)::date AS month,
count(DISTINCT o.id) AS paid_orders,
sum(oi.quantity * oi.unit_price_cents) / 100.0 AS gross_revenue
FROM sales.orders AS o
JOIN sales.order_items AS oi ON oi.order_id = o.id
WHERE o.status IN ('paid', 'fulfilled')
AND o.created_at >= DATE '2026-01-01'
AND o.created_at < DATE '2026-02-01'
GROUP BY 1
ORDER BY 1;
Notice that the query spells out its revenue rule and uses an exclusive upper date bound; replace the literal dates with Metabase parameters when turning it into a reusable question.
A realistic starting DDL creates the reporting view and limits what the Metabase analytics role can see. The table definitions are abbreviated to the fields relevant to this model; application migrations remain the source of truth for operational tables.
CREATE SCHEMA IF NOT EXISTS sales;
CREATE SCHEMA IF NOT EXISTS reporting;
CREATE TABLE sales.customers (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
country_code text,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE sales.products (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
category text NOT NULL,
active boolean NOT NULL DEFAULT true
);
CREATE TABLE sales.orders (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
customer_id bigint NOT NULL REFERENCES sales.customers(id),
status text NOT NULL CHECK (status IN ('pending', 'paid', 'fulfilled', 'cancelled')),
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE sales.order_items (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
order_id bigint NOT NULL REFERENCES sales.orders(id),
product_id bigint NOT NULL REFERENCES sales.products(id),
quantity integer NOT NULL CHECK (quantity > 0),
unit_price_cents integer NOT NULL CHECK (unit_price_cents >= 0)
);
CREATE INDEX orders_created_status_idx
ON sales.orders (created_at, status);
CREATE INDEX order_items_order_id_idx
ON sales.order_items (order_id);
CREATE OR REPLACE VIEW reporting.monthly_revenue AS
SELECT
date_trunc('month', o.created_at)::date AS month,
count(DISTINCT o.id) AS paid_orders,
sum(oi.quantity::bigint * oi.unit_price_cents::bigint) AS revenue_cents
FROM sales.orders AS o
JOIN sales.order_items AS oi ON oi.order_id = o.id
WHERE o.status IN ('paid', 'fulfilled')
GROUP BY 1;
CREATE ROLE metabase_reader LOGIN PASSWORD 'replace-through-secret-provisioning';
GRANT CONNECT ON DATABASE app TO metabase_reader;
GRANT USAGE ON SCHEMA reporting TO metabase_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA reporting TO metabase_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA reporting
GRANT SELECT ON TABLES TO metabase_reader;
Notice that the Metabase role receives access to the reporting schema, not to the underlying sales tables; provision its password through a secret-management workflow rather than committing this example literal.
The view is intentionally simple. Views do not make expensive queries free: PostgreSQL still executes the underlying joins when a dashboard runs. Start with suitable indexes and inspect real query plans. Avoid returning names, email addresses, credentials, or other personal data unless there is a documented need and an approved access policy.
6. Low-level design
The application has three logical responsibilities: Metabase serves users and stores its own configuration; PostgreSQL owns the canonical business data and reporting contract; the platform layer supplies networking, secrets, backups, and deployment. There is no separate analytics API in the first version.
classDiagram
class Analyst {
+openDashboard()
+saveQuestion()
}
class MetabaseService {
+authenticate()
+executeQuestion()
+loadMetadata()
}
class ReportingDatabase {
+queryReportingView()
+storeMetabaseMetadata()
}
class ReportingModel {
+monthlyRevenue()
+documentMetric()
}
Analyst --> MetabaseService
MetabaseService --> ReportingDatabase
ReportingDatabase --> ReportingModelMetabase owns the user-facing exploration workflow; PostgreSQL reporting views provide the stable data contract.
For a small team, the main design boundary is the database role. Metabase should use one connection for its own metadata database and a different, read-only connection for analytics. The analytics role should have a statement timeout, no write privileges, and access only to approved reporting objects. Metabase group permissions then organize collections and dashboards, but should not be mistaken for database-level tenant isolation.
A minimal connection guardrail can be applied in PostgreSQL:
ALTER ROLE metabase_reader SET default_transaction_read_only = on;
ALTER ROLE metabase_reader SET statement_timeout = '15s';
ALTER ROLE metabase_reader SET idle_in_transaction_session_timeout = '30s';
Notice that the timeout is a containment measure, not a performance strategy; tune it against observed dashboard queries and the product’s latency budget.
For a more realistic operational check, run a small Python task during deployment or as a scheduled health check to verify the reporting contract. It opens a read-only connection, checks that the view is queryable, and emits a trace. Install psycopg[binary] and the OpenTelemetry SDK and exporter packages before running it. Set DATABASE_URL from a secret store; do not put credentials in source control.
import os
import psycopg
from opentelemetry import trace
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
provider = TracerProvider(
resource=Resource.create({"service.name": "analytics-contract-check"})
)
provider.add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))
trace.set_tracer_provider(provider)
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("reporting.contract_check") as span:
with psycopg.connect(os.environ["DATABASE_URL"], connect_timeout=5) as conn:
conn.execute("SET default_transaction_read_only = on")
row = conn.execute(
"SELECT month, paid_orders, revenue_cents "
"FROM reporting.monthly_revenue "
"ORDER BY month DESC LIMIT 1"
).fetchone()
span.set_attribute("reporting.has_data", row is not None)
print({"contract": "monthly_revenue", "has_data": row is not None})
Notice that the check exercises the same database contract as Metabase while recording a trace span; the console exporter is suitable for this example, not a production telemetry pipeline.
The snippet is an example of tracing a supporting task, not a replacement for instrumenting the Metabase service. For the service, collect HTTP and JVM telemetry through supported instrumentation or the container platform, and correlate it with PostgreSQL metrics. Do not add a custom proxy solely to trace database queries at this scale.
7. Key flows
The first sequence is the normal analyst journey. Metabase authenticates the user, applies its collection and data permissions, and runs a query using its configured database credential. PostgreSQL permissions remain the hard boundary around the data available to that credential.
sequenceDiagram
actor Analyst
participant Browser
participant Metabase
participant PostgreSQL
Analyst->>Browser: Open dashboard
Browser->>Metabase: Request dashboard
Metabase->>Metabase: Authenticate and check permissions
Metabase->>PostgreSQL: Query reporting view
PostgreSQL-->>Metabase: Rows or query error
Metabase-->>Browser: Render cards and filters
Browser-->>Analyst: Display resultsDashboard access is governed by Metabase permissions, while the database credential bounds the maximum data any Metabase query can retrieve.
The second sequence is how a reporting change should move from an engineer’s branch to an analyst’s dashboard. A schema change is not complete when a migration runs; the team should verify the view contract and then check the affected saved questions in a staging environment.
sequenceDiagram
actor Engineer
participant GitHub
participant CI
participant Staging
participant Metabase
participant PostgreSQL
Engineer->>GitHub: Open change with migration and view
GitHub->>CI: Start checks
CI->>CI: Run unit and SQL contract tests
CI->>Staging: Apply migration
Staging->>PostgreSQL: Update reporting objects
Staging->>Metabase: Run smoke questions
Metabase-->>CI: Return expected columns and result
CI-->>Engineer: Report checksThe saved Metabase content is also a deployable artifact: export or otherwise back it up, and test important questions against staging after reporting changes.
8. Build and release
Use Terraform for AWS infrastructure and GitHub Actions for CI/CD. Keep the Metabase image version, database migrations, and reporting SQL under version control. Do not assume saved questions are automatically versioned with SQL migrations; choose a deliberate backup and promotion process for Metabase content, and test it before relying on it.
A focused Terraform example provisions the PostgreSQL instance. The VPC, private subnets, security groups, and ECS service are omitted to keep the snippet readable; in a real deployment, allow database ingress only from the application and Metabase security groups. Use a tested engine version supplied through configuration and manage the master password outside Terraform state where possible.
variable "postgres_engine_version" {
type = string
description = "A PostgreSQL engine version tested by this deployment."
}
resource "aws_db_subnet_group" "analytics" {
name = "startup-analytics"
subnet_ids = var.private_subnet_ids
}
resource "aws_db_instance" "shared_postgres" {
identifier = "startup-postgres"
engine = "postgres"
engine_version = var.postgres_engine_version
instance_class = "db.t4g.medium"
allocated_storage = 100
max_allocated_storage = 200
storage_type = "gp3"
storage_encrypted = true
db_subnet_group_name = aws_db_subnet_group.analytics.name
vpc_security_group_ids = [var.postgres_security_group_id]
publicly_accessible = false
multi_az = false
backup_retention_period = 7
deletion_protection = true
manage_master_user_password = true
auto_minor_version_upgrade = true
apply_immediately = false
skip_final_snapshot = false
final_snapshot_identifier = "startup-postgres-final"
}
Notice that this is a cost-conscious single-AZ example; production deployments should also define naming, parameter groups, maintenance windows, alarm thresholds, and a tested restore procedure.
A GitHub Actions workflow can run checks, assume a narrowly scoped AWS role through OIDC, publish an immutable container image, and ask ECS to deploy it. The role should be limited to the required ECR repository and ECS service. Pin third-party actions to reviewed versions or commit SHAs according to the organization’s supply-chain policy.
name: analytics-release
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
id-token: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate Terraform
run: |
terraform fmt -check -recursive
terraform init -backend=false
terraform validate
- name: Run tests
run: |
./scripts/test-unit.sh
./scripts/test-sql-contracts.sh
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Build and push image
env:
REGISTRY: ${{ vars.ECR_REGISTRY }}
REPOSITORY: ${{ vars.ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
run: |
aws ecr get-login-password | docker login --username AWS --password-stdin "$REGISTRY"
docker build -t "$REGISTRY/$REPOSITORY:$IMAGE_TAG" .
docker push "$REGISTRY/$REPOSITORY:$IMAGE_TAG"
- name: Deploy ECS service
run: |
aws ecs update-service \
--cluster "${{ vars.ECS_CLUSTER }}" \
--service "${{ vars.ECS_SERVICE }}" \
--force-new-deployment
Notice that an ECS force deployment only helps if the task definition references the image being released; production pipelines should register and deploy a new task definition with the immutable image tag.
Use a test strategy that checks behavior at the right boundary:
- Unit: test metric calculations, date boundaries, and any transformation code with fixed fixtures.
- Integration: apply migrations and run reporting queries against a disposable PostgreSQL instance, preferably in a container.
- Contract: assert view names, column names, types, and representative results so an application migration cannot silently break dashboards.
- Load: replay representative dashboard queries with realistic concurrency against a non-production database. Validate both query latency and product API impact before enabling broader access.
Keep production analytics load small and bounded. A concurrency test against a tiny local database is useful for regressions, but it does not prove that the production instance can handle a particular workload.
9. Observability
Self-serve analytics needs enough telemetry to distinguish a broken dashboard from a slow query, a failed Metabase task, or a database under pressure. Track the user-visible path and the shared database resource. Avoid logging query results or sensitive SQL literals; logs should help diagnose behavior without becoming another copy of the data.
A structured application log might look like this:
{
"timestamp": "2026-10-31T12:30:00Z",
"level": "INFO",
"service": "metabase",
"event": "dashboard_query_completed",
"request_id": "req-7f20",
"dashboard_id": 12,
"duration_ms": 842,
"result_rows": 48,
"outcome": "success"
}
Log deployment version, request or trace identifier, dashboard or question identifier where available, duration, outcome, and sanitized error category. Restrict access to logs and set retention deliberately. Do not log passwords, access tokens, row values, or personally identifying query output.
Use RED for the Metabase service and USE for PostgreSQL and container resources:
| Method | Signals to collect |
|---|---|
| RED: Rate | HTTP requests, dashboard loads, and database queries per second |
| RED: Errors | HTTP 5xx, failed or timed-out queries, authentication failures |
| RED: Duration | Request latency and query duration, including p50 and p95 |
| USE: Utilization | RDS CPU, memory pressure, storage, connections, and ECS CPU/memory |
| USE: Saturation | Database connection pool pressure, queued work, free storage, and container restarts |
| USE: Errors | RDS storage or connection errors, failed health checks, and task exits |
OpenTelemetry tracing should connect incoming requests, Metabase application work, and database activity where the application’s supported instrumentation allows it. The Python contract-check example above demonstrates the SDK in the article’s supporting-task stack. In production, export spans to a collector or compatible backend, propagate trace context where possible, and avoid attaching SQL parameters or row contents to spans.
| SLI | Initial SLO target | Measurement |
|---|---|---|
| Dashboard availability | 99.5% during the agreed business window | Successful dashboard requests divided by total requests |
| Dashboard latency | 95% of representative loads under 5 seconds | Request duration, excluding explicitly identified slow exploratory queries |
| Query success | 99% of bounded reporting queries succeed | Successful queries divided by attempted queries |
| Data correctness | No known regression in critical metric contracts | Automated contract checks and owner review of metric changes |
These are starting service objectives, not a promise from AWS or Metabase. Agree on the business window, exclusions, and measurement source before treating them as commitments.
Build one dashboard for the platform owner with Metabase request health, query duration, ECS task health, and RDS CPU, connections, storage, and freeable memory. Page an engineer for sustained inability to reach the database, repeated Metabase health-check failure, rapidly declining free storage, or persistent database saturation that also affects the product. Route slow individual questions and isolated dashboard errors to a non-paging review queue unless they indicate a broader incident.
10. Security and compliance
The smallest viable security boundary is the network plus database permissions. Put Metabase and PostgreSQL in private subnets where practical; expose only the HTTPS load balancer publicly. Restrict RDS ingress to the application and Metabase security groups. Use TLS for browser traffic and database connections, and encrypt RDS storage and backups.
Use different credentials for the product application, Metabase’s metadata database, and Metabase’s analytics connection. The analytics role should be read-only and restricted to the reporting schema. Rotate credentials through a managed workflow and keep them out of container images, Terraform source, and CI logs. Keep Metabase administrator access limited; remove accounts promptly when people leave or change roles.
Metabase groups and collections help organize internal access. They do not make shared database credentials safe for arbitrary customer-level row isolation. If users must see only their own organization’s data, enforce that boundary at a layer that can reliably identify each user at query time, or use a suitable separately isolated data connection. A dashboard filter is not an authorization mechanism.
Minimize data before it reaches reporting views. Do not include raw email addresses or other direct identifiers by default. Define retention for logs and exports, document who can download data, and review permissions periodically. If the startup processes regulated or sensitive data, involve the security and legal owners before declaring that this design meets a compliance requirement; compliance depends on the full operating environment, not a database setting.
11. Cost
Assumption-based monthly estimate: a single AWS region, low internal usage, one small ECS task, one single-AZ db.t4g.medium RDS instance with 100 GB of allocated gp3 storage, modest logs, and an internet-facing load balancer. These are planning ranges, not quoted prices. Region, utilization, backups, traffic, and current AWS pricing change the result.
| Cost area | Monthly planning range | Assumption |
|---|---|---|
| RDS compute | $60–$120 | One small PostgreSQL instance, single AZ |
| RDS storage and backup | $15–$45 | 100 GB gp3 plus modest retained backups |
| ECS Fargate | $20–$55 | One small always-on Metabase task |
| Application Load Balancer | $20–$45 | One load balancer with low traffic |
| Secrets, logs, and monitoring | $5–$25 | Low-volume telemetry and a few secrets |
| DNS, data transfer, and miscellaneous | $5–$30 | Light internal use; excludes unusual egress |
| Estimated total | $125–$320 | Shared database instance; excludes the existing product application where costs are already incurred |
The largest financial saving is sharing the existing RDS instance, but that is also the main operational compromise. If the database already exists for the product, calculate the incremental cost rather than counting the full instance twice. Conversely, adding a read replica, Multi-AZ deployment, or dedicated analytics database can materially increase the bill. Re-estimate using actual query load before making that change.
12. Failure modes, resilience and disaster recovery
A small design can be simple without pretending that failure is impossible. Decide which failures are acceptable and make recovery steps repeatable.
| Failure mode | Impact | Response |
|---|---|---|
| A dashboard runs an expensive query | Slower reporting and possible product contention | Bound query duration, investigate the plan, reduce access to raw objects, and move reporting off the shared instance when needed |
| Metabase task restarts or deployment fails | Analytics unavailable during recovery | Use a health-checked ECS service, retain the previous image, and roll back the task definition |
| RDS is unavailable or corrupted | Product and analytics may both be affected | Use automated backups and point-in-time recovery; document and exercise restoration |
| Metabase metadata is lost | Saved questions, users, and configuration may be lost | Back up the Metabase application database independently and test restoring it |
| A migration breaks a reporting view | Questions or dashboards fail | Run SQL contract tests before deployment and promote schema changes with a rollback plan |
| Credentials are exposed | Unauthorized data access | Revoke and rotate credentials, review database and Metabase access, and follow the incident process |
For the initial single-region deployment, a reasonable planning assumption is an RPO of up to 24 hours for recoverable analytics metadata and an RTO of several hours, subject to successful restore testing. These are operational targets to validate, not guaranteed recovery times. Enable the RDS backup retention that matches the team’s requirements, retain deployment artifacts, and write down the steps to restore both PostgreSQL databases and reattach Metabase to them.
A single RDS instance is a shared failure domain: a database outage can take down the product and analytics together. If that is unacceptable, use a separate analytics instance or read replica architecture before expanding user access. A replica can isolate read traffic, but it adds cost and replication lag; test the exact PostgreSQL objects and refresh strategy you intend to use before choosing it.
13. Evolving to the next scale
Do not add infrastructure because a diagram looks incomplete. Add it when a measured limit or a new business requirement makes the simpler design unsafe or too slow.
| Signal | Next change |
|---|---|
| Analytics queries affect product latency or database headroom | Move analytics to a dedicated PostgreSQL instance or read replica; validate replica lag and query behavior |
| Reporting views become difficult to own or test | Introduce a managed transformation workflow and explicit model tests; keep metric definitions versioned |
| Data volume or query complexity outgrows PostgreSQL reporting | Evaluate a warehouse based on query patterns, refresh needs, and team capacity |
| Users need tenant-specific data access | Add an authorization design that enforces isolation in the database or a trusted query service; do not rely on dashboard filters |
| Data needs arrive from multiple systems or require replay | Add a controlled ingestion pipeline with idempotency, freshness monitoring, and documented ownership |
| Analytics availability becomes business-critical | Separate failure domains, add appropriate database availability, and define tested recovery objectives |
| Concurrent users and dashboards increase | Measure connection and query pressure, then scale the database or isolate read workloads before adding caches |
A read replica is often the first useful step because it protects the product’s primary database from read-heavy exploration without replacing PostgreSQL or Metabase. A warehouse is a bigger organizational decision: it introduces data movement, freshness semantics, additional permissions, and another system to operate. Make that move when the workload or source diversity justifies those costs, not merely because the company has dashboards.
14. Phased implementation plan
A small team can deliver this in controlled slices. The first milestone is not “Metabase is running”; it is “a colleague can answer an agreed question with a trusted metric and without access to unneeded data.”
- Agree on the first questions. Pick a few recurring questions, identify their business owners, and write down metric definitions, expected freshness, and who should see the answers.
- Inspect the existing PostgreSQL workload. Measure database capacity and review the application’s availability needs. If sharing RDS is already unsafe, budget for separate analytics compute before rollout.
- Create the reporting contract. Add a reporting schema, role grants, views, and indexes through migrations. Exclude unnecessary identifiers and test the contract against a disposable PostgreSQL instance.
- Deploy Metabase privately. Run a pinned image on ECS Fargate, configure its separate metadata database, enable HTTPS at the load balancer, and retrieve credentials from Secrets Manager.
- Add a small trusted user group. Configure Metabase groups and collections, demonstrate how to build a question from approved reporting objects, and explain what the initial model does not include.
- Instrument and rehearse recovery. Establish the dashboards and alerts, test a database restore, and document the rollback path for both application and Metabase deployments.
- Review after real use. Look at query latency, product database impact, failed questions, and permission requests. Add a replica, stronger isolation, or a more substantial data pipeline only in response to those observations.
This starting point keeps the architecture understandable for a one-to-three-person team: one managed PostgreSQL service, one small Metabase service, a narrow reporting contract, and operational practices that can grow with the business. The core discipline is to make the data easy to use without making the production database—and the people represented in it—easy to misuse.