When configuring AWS Security Groups for a multi-tier application architecture, an engineer must ensure that the web tier only communicates with the application tier on port 8080. Which configuration best adheres to the principle of Defense in Depth?
Trap 1: Set the application tier inbound rule to allow TCP 8080 from…
Allowing traffic from 0.0.0.0/0 violates the principle of least privilege by exposing the application tier to the entire internet rather than restricting access solely to the web tier. This configuration is tempting because it is the standard approach for public-facing services, such as a web server intended to serve global users via HTTP or HTTPS. In such public scenarios, permitting unrestricted inbound traffic is a functional necessity, but it remains a security failure when applied to internal tiers requiring strictly controlled, private communication.
Trap 2: Use an IP-based rule in the application tier Security Group…
Hardcoding private IP addresses fails because AWS instances are ephemeral; when instances scale or restart, their IP addresses change, rendering static rules obsolete and causing connectivity outages. This approach is tempting for legacy on-premises environments where network infrastructure remains static and IP-based access control lists are the primary mechanism for traffic filtering. In such traditional data centres, referencing specific IP addresses provides granular control, but in dynamic cloud architectures, security groups should instead reference the security group ID to maintain persistent, identity-based access.
Trap 3: Set the application tier inbound rule to allow TCP 8080 from the…
Allowing the whole VPC CIDR on port 8080 permits any VPC resource, not just the web tier, so it fails least privilege and Defence in Depth. It is tempting because VPC-scoped rules are easy to manage, but the correct approach references the web tier's security group as the source, restricting traffic to that tier alone.
- A
Set the application tier inbound rule to allow TCP 8080 from 0.0.0.0/0.
Why it fails: Allowing traffic from 0.0.0.0/0 violates the principle of least privilege by exposing the application tier to the entire internet rather than restricting access solely to the web tier. This configuration is tempting because it is the standard approach for public-facing services, such as a web server intended to serve global users via HTTP or HTTPS. In such public scenarios, permitting unrestricted inbound traffic is a functional necessity, but it remains a security failure when applied to internal tiers requiring strictly controlled, private communication.
- B
Use an IP-based rule in the application tier Security Group referencing the private IP of the web tier instances.
Why it fails: Hardcoding private IP addresses fails because AWS instances are ephemeral; when instances scale or restart, their IP addresses change, rendering static rules obsolete and causing connectivity outages. This approach is tempting for legacy on-premises environments where network infrastructure remains static and IP-based access control lists are the primary mechanism for traffic filtering. In such traditional data centres, referencing specific IP addresses provides granular control, but in dynamic cloud architectures, security groups should instead reference the security group ID to maintain persistent, identity-based access.
- C
Set the application tier inbound rule to allow TCP 8080 from the specific Security Group ID of the web tier.
Referencing the specific Security Group ID of the web tier enforces the principle of least privilege by restricting inbound traffic exclusively to authorised instances rather than broad IP ranges. This configuration satisfies the constraint requiring the web tier to communicate with the application tier on port 8080 while ensuring that only traffic originating from the identified security group is permitted. By leveraging stateful security group rules, the architecture minimises the attack surface, effectively implementing a robust layer of Defense in Depth.
- D
Set the application tier inbound rule to allow TCP 8080 from the CIDR block of the VPC.
Why it fails: Allowing the whole VPC CIDR on port 8080 permits any VPC resource, not just the web tier, so it fails least privilege and Defence in Depth. It is tempting because VPC-scoped rules are easy to manage, but the correct approach references the web tier's security group as the source, restricting traffic to that tier alone.