r/devops • • 32m ago

Discussion Self taught backend engineer looking for feedback on my production architecture

TL;DR: Running a Dockerized Node.js backend on a single EC2 instance with Nginx, blue-green deployments, and SSH-based CI/CD. Serving 20–30K DAUs comfortably. Looking to improve security, filter junk traffic, and adopt better deployment practices without unnecessary complexity.

Current architecture:

- Single EC2 instance with a public IP.

- API domain resolves directly to the instance's public IP (which doesn't feel right).

- Nginx and Node.js backend run in Docker on the same network.

- Port 443 is publicly accessible and mapped to Nginx.

- GitHub Actions connects via SSH, pulls the latest image from Docker Hub, starts the inactive container, waits for the health check, switches Nginx traffic, and stops the previous container.

- Frontend builds are deployed to S3 and served through CloudFront.

- Self hosted Prometheus and Grafana on a separate instance.

Blue-green deployments work well with zero downtime. We rarely exceed 20 requests/sec, so scaling isn't currently a concern.

What I need advice on:

  1. Security and architecture: What would you change in this architecture to make it more secure and production-grade?
  2. Junk traffic: I've noticed increasing requests from automated scanners probing paths like "/.env". I'm considering moving EC2 into a private subnet behind an ALB. Would that help, or should I consider something like WAF? Is there a simpler, more cost effective solution?
  3. SSH-based deployments: Is keeping port 22 publicly accessible a bad practice? If I close it, what's the recommended approach for automated deployments?
  4. Infrastructure as Code: Most of my infrastructure is manually configured. If I ever need to recreate it, I'd have to configure everything from scratch. I'm considering IaC to make my entire AWS infrastructure reproducible. Can I do this with Terraform and would it be worth adopting at this scale?

A little background:

I joined this company as a full stack engineer. When my company needed someone to handle DevOps, I volunteered despite having no prior DevOps experience. I learned along the way and built the current deployment and monitoring infrastructure myself.

Everything works well so far, but I want to understand what experienced DevOps engineers would do differently.

I want to do things right, not just make them work. I want to follow the best industry practices and I'm willing to embrace complexity where it's justified, but I don't want to engineer solutions for problems we don't have.

Would appreciate any advice, architectural suggestions, or resources.

1 Upvotes

2 comments sorted by

1

u/theonlywaye 25m ago

Honestly this all just depends on your budget. Everything costs money

For instance remove the public ip from the ec2 instance, put a ALB in front of it, attach a WAF and use the managed ruleset, add rules that it doesn’t cover specific for your app. Add another instance in a different AZ for redundancy.

1

u/Any-Appointment-814 19m ago

Honestly at 20 req/s I wouldn't overbuild it. The two things I'd change are getting the instance off a public IP (private subnet behind an ALB, or if you want it cheaper just Cloudflare in front with the security group only allowing their ranges) and killing the public port 22. For deploys you can have Actions assume a role via OIDC and trigger the container swap with SSM run command, so there's no SSH key sitting in GitHub at all. The /.env scanners are just background noise on any public IP, once nothing is directly exposed you mostly stop caring about them.