Building a Contact Center Volume & Staffing Dashboard with Amazon Connect and AWS Serverless
Building a better contact center dashboard for Amazon Connect.
Overview
I've never been a fan of the metrics and dashboards natively available in Connect. We needed a better solution for a high-level overview of our Connect instance.
Contact centers face a persistent challenge: matching staff capacity to demand. Without data-driven insights, supervisors rely on gut instinct to schedule agents, often discovering problems only after callers have already abandoned the queue. This project fixes that gap with a serverless dashboard that transforms raw Contact Trace Record (CTR) data from Amazon Connect into an actionable volume heatmap, trend analysis, and staffing recommendations.
The solution is fully serverless, requires no standing infrastructure costs beyond storage, and delivers sub-second load times through an aggressive caching strategy. No more "data temporarily unavailable" on your dashboards.
Architecture
The system has three layers:
- Data Processing (Lambda + S3)
A Python 3.12 Lambda function reads CTR exports from S3 (stored in Hive-partitioned paths: ctr/year=YYYY/month=MM/day=DD/hour=HH/), deduplicates contacts by ID, classifies them into hourly intervals by local timezone, and computes per-interval metrics: contacts offered, contacts handled, contacts abandoned, abandon rate, unique active agents, and contacts-per-agent ratio.
Results are cached as daily JSON files in S3. An EventBridge Scheduler triggers a pre-warm invocation at 3:00 AM local time to rebuild yesterday's cache before business hours, so the dashboard loads instantly for the first user each morning.
- API Layer (API Gateway + Lambda)
A regional REST API Gateway exposes four endpoints via Lambda proxy integration:
/volume/heatmap — Averaged volume by day-of-week × hour-of-day, with threshold flags
/volume/weekly-trend — Week-over-week aggregate metrics (volume, abandon rate, agents)
/volume/daily-detail — Detailed hourly breakdown for a specific day of the week
/volume/recommendations — Flagged intervals ranked by severity with staffing guidance
All endpoints accept start_date, end_date, and channel filter parameters. Channel filtering supports all, voice, chat, and sms, allowing supervisors to isolate channel-specific staffing concerns.
- Frontend (S3 + CloudFront)
A static single-page dashboard served via CloudFront with Origin Access Control. Built with vanilla JavaScript and Chart.js — no framework dependencies. The UI features:
KPI summary cards (total volume, average abandon rate, average agents, flagged intervals) with period-over-period trend indicators
An SVG heatmap grid showing volume intensity by day × hour, with toggleable metrics (volume, abandon rate, per-agent load)
A collapsible daily detail bar chart that expands when clicking a heatmap row
A weekly trend line chart for historical analysis
A staffing recommendations panel listing flagged intervals by severity
Channel filter buttons (All / Voice / Chat / SMS)
Date range presets (4 weeks, 8 weeks, 3 months, 6 months) with custom date picker
PDF export via html2canvas and jsPDF
Staffing Intelligence: How Flags Work
The system evaluates three threshold conditions for each hour slot:
High contacts per agent — Average contacts handled per agent exceeds a configurable threshold (default: 8). This indicates agent overload, which is helpful for contact center managers and leadership.
High abandon rate — Average abandon rate exceeds a configurable threshold (default: 10%). This indicates customers are dropping before being served.
Volume spike — Contacts offered exceeds a multiplier (default: 1.5×) of the weekly average for that same day/hour slot. This catches abnormal surges.
Flagged intervals are classified by severity:
High: Two or more flags triggered simultaneously
Medium: One flag triggered and contacts-per-agent exceeds 1.5× the threshold
Low: One flag triggered
Thresholds are configurable via Lambda environment variables and can also be overridden per-session in the dashboard UI without redeploying.
Caching Strategy
Processing raw CTR data on every request would be prohibitively slow (tens of thousands of records per day). The caching layer solves this:
Daily cache files are stored in S3 as pre-aggregated JSON. Each file contains hourly intervals with all computed metrics, plus a by_channel breakdown for per-channel filtering.
Cache-or-compute pattern: On each request, the API checks if a cached file exists for each date in the range. If not, it processes raw CTRs on-demand and writes the cache for future requests.
Pre-warm scheduling: EventBridge triggers a daily cache rebuild for yesterday's data so the first morning request is served from cache.
Cache invalidation: A rebuild script deletes existing cache files and triggers a re-computation. This is needed when the aggregation logic changes (e.g., adding channel-level breakdowns).
The on-demand approach means only dates that users actually query get cached, minimizing processing costs while ensuring the most-accessed data is always fast.
Infrastructure as Code
The entire stack was deployed from a single CloudFormation template:
S3 bucket for dashboard assets with all public access blocked
CloudFront distribution with OAC, HTTPS redirect, and SPA error fallback
REST API Gateway with regional endpoint, throttling (50 RPS / 100 burst), and CORS
Lambda function (arm64, 512 MB, 120s timeout) with least-privilege IAM role
EventBridge Scheduler with retry policy (2 retries, 1-hour max age)
S3 bucket policy scoped to the specific CloudFront distribution ARN
Deployment is automated through shell scripts: one for packaging and deploying the Lambda zip, another for syncing dashboard assets to S3 and invalidating CloudFront.
Design Decisions
Why vanilla JavaScript instead of React/Vue? Because I like JS!
The dashboard is a read-only visualization tool with limited interactivity. A framework would add build complexity, bundle size, and maintenance overhead for something that's essentially four API calls, a heatmap renderer, and a couple of charts.
Why process CTRs instead of using Connect metrics APIs?
CTR exports provide contact-level granularity: individual contact IDs, timestamps, queue assignments, channel types, and agent identifiers. This enables deduplication, channel filtering, and custom interval definitions that Connect's built-in metrics don't support at this resolution.
Why daily caching?
Days are the natural partition boundary for both the CTR storage structure and the heatmap visualization. Finer-grained caching (per-hour) would create too many small objects. Coarser caching (per-week) would mean stale data until the entire week is recalculated.
Why no authentication on the dashboard?
This was a deliberate scope choice for an internal tool. The CloudFront distribution URL is not publicly discoverable, and the data is aggregate-only (no PII). Authentication can be layered in via Cognito or CloudFront signed URLs if the threat model changes or if your leadership suggests it is needed.
Key Metrics Explained
Metric Source Meaning
Contacts Offered CTR count per interval Total contacts that entered the queue
Contacts Handled CTRs with non-null agent Contacts picked up by an agent
Contacts Abandoned Offered − Handled Contacts where caller disconnected before agent pickup
Abandon Rate Abandoned / Offered Percentage of contacts lost
Active Agents Unique agent IDs per interval Distinct agents who handled at least one contact
Contacts per Agent Offered / Active Agents Workload intensity per agent
"Active Agents" counts agents who actually handled contacts in that interval, not agents who were merely logged in. This is a CTR-derived metric and underestimates true available capacity, which is an intentional conservative bias for staffing recommendations.
Lessons Learned
-CTR deduplication is essential. Connect can emit duplicate CTR records. The processor deduplicates by ContactId before aggregation. Otherwise, you'll see the same techs in multiple queues, which is common.
-Timezone handling matters. CTRs store timestamps in UTC. Converting to local time for interval classification requires explicit timezone handling (zoneinfo in Python). I struggled with getting the dashboard to present data in Central Time.
-CloudFront + OAC is the right hosting pattern for internal dashboards. It avoids public S3 buckets while keeping the deployment simple and cost-effective.
-Pre-warming is worth the small cost. A single daily Lambda invocation (costing fractions of a cent) eliminates cold-start latency for the first user and validates that the pipeline is healthy. This is helpful for emergencies.
-Channel filtering belongs at the cache level, not the API level. Storing per-channel breakdowns inside the daily cache file means a single cache read serves any channel filter, rather than requiring separate cache entries per channel.
Summary
This project demonstrates how a focused serverless architecture of Lambda, API Gateway, S3, CloudFront, and EventBridge can turn raw contact center records into operational staffing intelligence without any servers to manage, databases to maintain, or frameworks to keep updated. While this solution gives you the MVP, it's possible to build out more. The total AWS cost is very, very small.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article