You know that sinking feeling when someone pushes straight to main because the review system was down? That is the moment infrastructure meets chaos. Setting up Gerrit on AWS EC2 is supposed to prevent that. Yet, when keys pile up and permissions drift, the cure starts to look like the disease.
Gerrit is a code review server that gates what lands in your repo. EC2 Instances are Amazon’s elastic machines that host pretty much anything. Together they form a flexible review platform that can scale horizontally while staying close to your production network. The trick is wiring them securely so every commit, review, and approval maps to a real identity, not a stray SSH key.
At the simplest level, EC2 runs the Gerrit service, fronted by a load balancer or proxy. IAM roles handle machine permissions while OIDC or SAML through providers like Okta or Google Identity control human access. Reviewers get authenticated against your identity provider, Gerrit enforces review workflows, and EC2 handles the compute behind it. The result: clean approvals, auditable logs, and no mystery access paths.
How do I connect Gerrit to EC2 securely?
Create an EC2 Instance with the least-privileged IAM role, attach storage for Gerrit’s repositories, and front it with an identity-aware proxy or ALB that supports OIDC. This bridges your corporate identity provider and Gerrit without hardcoded credentials. Use AWS Secrets Manager for key rotation and enforce OAuth tokens over SSH passwords.
Common pitfalls and fixes
- Drifting permissions: Map IAM roles to Gerrit groups, not users.
- Unreviewed access logs: Feed Gerrit’s event stream into CloudWatch or OpenSearch for traceability.
- Fragile scaling: Use EC2 instance templates and launch configurations rather than manual setup.
Keep EC2 stateless wherever possible. Persist Gerrit’s data on EBS or S3-backed storage so rolling upgrades don’t break history.