DEV Community

Jack Pelorus
Jack Pelorus

Posted on

k6 + Playwright Load Testing on AWS

Production-grade Terraform project that deploys a self-hosted load testing environment on AWS EC2 with Docker, Grafana, Prometheus, optional PostgreSQL, and a web GUI for running both k6 load tests and Playwright browser tests.
Architecture

┌───────────────────────────────────────────────────────────────┐
│ VPC │
│ ┌───────────────────────────────────────────────────────────┐│
│ │ Public Subnet ││
│ │ ┌───────────────────────────────────────────────────────┐││
│ │ │ EC2 Instance │││
│ │ │ ┌──────────┐ ┌──────────┐ ┌────────────────────┐ │││
│ │ │ │ k6-gui │ │ Grafana │ │ k6 live dashboard │ │││
│ │ │ │ :8080 │ │ :3000 │ │ :5665 │ │││
│ │ │ └──────────┘ └──────────┘ └────────────────────┘ │││
│ │ │ ┌──────────┐ ┌──────────┐ ┌────────────────────┐ │││
│ │ │ │Prometheus │ │ PostgreSQL │ │ playwright-runner │ │││
│ │ │ │ :9090 │ │ :5432 │ │ (docker exec) │ │││
│ │ │ └──────────┘ └──────────┘ └────────────────────┘ │││
│ │ └───────────────────────────────────────────────────────┘││
│ └───────────────────────────────────────────────────────────┘│
└───────────────────────────────────────────────────────────────┘
│ │
Elastic IP Route53 / CloudFront DNS
k6.example.com

k6-gui is a Flask web app that runs both test types from the browser: k6 load tests via docker compose run, and Playwright browser tests via docker compose exec into the long-running playwright-runner container (Monaco editor, real-time log streaming, HTML reports for both). See terraform/modules/ec2-k6/templates/k6-gui/README.md for details.

Git Repo: https://github.com/jacksmartv/K6-PW-test-management-platform

Top comments (0)