Join our Newsletter — 33% off our NHI Course

AWS Security Group

An AWS security group is a virtual firewall that controls inbound and outbound traffic for cloud resources such as EC2 instances and databases. It uses rule based allow lists tied to protocols, ports, IP ranges, and principals, making it a core network access control in AWS environments.

How AWS security groups work

AWS security group are stateful, instance-attached traffic filters that define which network flows may reach or leave a resource. Their main value is that they turn network exposure into an explicit allow-list rather than a broad, always-open perimeter.

Because security groups evaluate rules at the resource boundary, they are often used as the first line of control for EC2, load balancers, RDS, and other AWS services that support them. The practical security meaning is simple: if a port, protocol, or source is not allowed, traffic is denied by default.

This makes rule design important. Broad CIDR ranges, permissive source references, and “temporary” exceptions can quickly become lasting exposure, especially in environments that change often.

Rule design and traffic scope

Security group rules are built around protocols, ports, and source or destination references. In practice, that means they should reflect the actual communication path between workloads rather than a network diagram copied from a static design document.

Groups are stateful, so return traffic for an allowed connection is automatically permitted. That reduces rule complexity, but it also means a single overly broad inbound rule can expose a service more widely than intended. Using references to other security groups is often safer than opening traffic to large IP ranges because it keeps trust tied to known workload relationships.

A useful way to think about security groups is as a control for application reachability, not just network segmentation. They work best when paired with subnet design, host hardening, and service-level authentication, because they restrict paths but do not prove that the caller is legitimate.

Where AWS security groups fit in layered defense

Security groups are a core cloud control, but they are not a complete security boundary. They do not inspect payloads, validate application requests, or replace identity checks inside the application or database layer. Their role is to reduce the attack surface that is exposed to other controls.

That is why they are most effective when aligned with least privilege and tightly scoped trust relationships. For example, allowing a database only from a specific application tier is stronger than allowing an entire subnet or VPN range when only one workload actually needs access.

They also fit naturally into change management and infrastructure-as-code workflows. In managed cloud environments, the risk is often not the concept itself but drift, where ad hoc rule changes outgrow the original design and leave unintended paths open.

Operational examples and common failure modes

In real AWS environments, security groups are used to permit web ingress on 443, app-to-database traffic on a single port, or admin access from a controlled source. The security outcome depends on how narrowly those rules are written and how consistently they are reviewed.

Common failure modes include open inbound SSH or RDP from the internet, overuse of 0.0.0.0/0, permissive east-west access between tiers, and stale rules that remain after a system is retired. These patterns are simple to create and easy to miss in large estates, which is why rule review and inventory matter.

For related reading on the threat side, see 230M AWS environment compromise and Codefinger AWS S3 ransomware attack, both of which show how exposed cloud access paths can be abused once credentials or network reachability are in hand.

Risk and Threat Considerations

Security groups can create material exposure when they are broader than the workload’s real trust boundary. The main risk is not the control itself, but the ease with which a single permissive rule can expose a service to scanning, brute force, lateral movement, or unintended partner access.

Failure mechanism: Overly broad inbound rules, weak source scoping, stale exceptions, or rule drift can turn a narrow service into a reachable target across the internet or across internal tiers.

Impact: The result can be unauthorized access, easier exploitation of vulnerable services, faster lateral movement after compromise, and a larger blast radius when credentials or application flaws are abused.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 address the attack and risk surface, while CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
CIS Controls v8 CIS 4 — Secure Configuration of Enterprise Assets and Software Security group rules are configuration state that directly controls reachable services.
Recommendation — Audit and harden security group rules as part of secure configuration baselines.
NIST CSF 2.0 PR.AC-5 — Network Integrity is Protected Security groups enforce network reachability boundaries for cloud workloads.
PR.PT-4 — Communication and Control Networks are Protected Security groups protect service communication paths by filtering allowed flows.
Recommendation — Use network access controls to restrict traffic paths to only approved destinations and sources. Apply boundary controls to protect and segment workload communication flows.
OWASP Non-Human Identity Top 10 NHI-03 — Secrets and Credential Exposure Overexposed AWS workloads often become reachable once credentials or access paths are abused.
NHI-06 — Overprivileged Non-Human Identities Broad security group exposure often compounds overprivileged machine access in AWS estates.
NHI-07 — Third-Party and Supply Chain Trust Security group trust relationships often encode cross-account or partner connectivity assumptions.
Recommendation — Reduce exposed access paths and tighten credential-driven reachability to limit compromise impact. Limit machine access paths so overprivileged non-human identities cannot reach unnecessary services. Review third-party connectivity rules and narrow trust to only required partner sources.

Practitioner Guidance

What to watch for: Treat security groups as a live control, not a one-time setup task. The most common governance mistake is assuming that because a rule was once justified, it is still appropriate after infrastructure, ownership, or application paths change.

Practitioner takeaway: Review inbound exposure first, then validate whether each permitted source still matches an actual workload relationship rather than a convenience exception.