More Info:

No backend EC2 instances should be running in public subnets.

Risk Level

High

Address

Security

Compliance Standards

HIPAA, SOC2, HITRUST, AWSWAF, NISTCSF, PCIDSS, FedRAMP

Triage and Remediation

Remediation

To remediate the EC2 instance in a public subnet in AWS, follow these steps:

  1. Open the AWS Management Console and navigate to the VPC dashboard.

  2. Select the VPC containing the public subnet that the EC2 instance is in.

  3. Select the Subnets tab and then select the public subnet that the EC2 instance is in.

  4. Select the Route Table tab and then select the route table associated with the public subnet.

  5. Remove the route that allows traffic to the internet gateway. This will prevent any traffic from the internet from reaching the EC2 instance.

  6. Create a new route table and associate it with the public subnet.

  7. Add a route to the new route table that allows traffic to reach the internet gateway. This will allow any traffic from the EC2 instance to reach the internet.

  8. Launch a new EC2 instance in a private subnet and associate it with the new route table. This will ensure that the EC2 instance is not accessible from the internet.

  9. Terminate the old EC2 instance in the public subnet.

By following these steps, you can remediate the misconfiguration of having an EC2 instance in a public subnet in AWS.

Additional Reading: