The Nginx web server runs on an Amazon EC2 instance inside a private subnet. It has no public IPv4 address.
All public traffic enters through an Application Load Balancer and passes AWS WAF before reaching the application.
How I built an AWS environment that blocks malicious traffic, detects risky configuration changes, remediates them automatically, and verifies compliance afterward.
This project explores both sides of cloud security: stopping bad traffic before it reaches the application and reducing configuration drift inside the environment.
The Nginx web server runs on an Amazon EC2 instance inside a private subnet. It has no public IPv4 address.
All public traffic enters through an Application Load Balancer and passes AWS WAF before reaching the application.
I sent the live application a request designed to resemble a cross-site scripting attack.
AWS WAF stopped the request before it reached Nginx.

Cloud environments change constantly. A legitimate administrative change can produce an unsafe state.
I deliberately created one of the classic dangerous configurations: unrestricted SSH.
AWS Config continuously evaluated the environment and marked the resource NON_COMPLIANT.

CloudTrail recorded the security-group API activity. EventBridge matched the change and invoked a Lambda remediation function.
Public SSH access was added.
The control-plane change became auditable evidence.
The AuthorizeSecurityGroupIngress event entered the response path.
The function checked the resource opt-in tag, TCP/22, and source 0.0.0.0/0.
Lambda revoked the unrestricted SSH ingress rule.
SNS sent the incident details and remediation status.

Automatic remediation can create its own blast radius. A resource must explicitly opt into this workflow.
1 NON_COMPLIANT resource
0 NON_COMPLIANT resources

After I removed the NAT Gateway to reduce unnecessary ongoing cost, the website stayed online but Systems Manager stopped working.
Instead of restoring broad internet egress, I added private VPC interface endpoints for Systems Manager.

| AWS Service | Role in the project |
|---|---|
| Application Load Balancer | Public application entry point |
| AWS WAF | Web-request enforcement |
| CloudTrail | Control-plane audit trail |
| AWS Config | Independent compliance evaluation |
| EventBridge | Event routing into the response workflow |
| Lambda | Bounded automated remediation |
| SNS | Operator notification |
| GuardDuty | Threat-pattern detection |
| Security Hub | Centralized security posture and findings |
| Systems Manager | Private administrative access |
A risky change became an auditable event. The event became a decision. The decision became an action. The action became an alert. Another control then verified that the unsafe state was gone.