What it is
A security group is a set of firewall rules attached to a cloud resource, such as a virtual server, a database or a load balancer. The rules say which network traffic is allowed to reach that resource and which traffic it may send out. If a packet doesn't match an allow rule, it's dropped.
Think of it as a bouncer standing at each resource's door, rather than one guard at the front gate of the whole building. That's the main idea. Your web servers can have one list of who gets in, your database another, and your admin tools a third.
The name is most closely tied to AWS, where "security group" is the literal term. Azure has network security groups, and Google Cloud has VPC firewall rules, which do much the same job with different wording. The details vary by provider, but the habit of thinking in allow rules per resource carries across all of them.
How it works
Each rule has a few parts: a direction (inbound or outbound), a protocol such as TCP, a port or port range, and a source or destination. The source can be a single IP address, a range of addresses written in CIDR notation, or, in AWS, another security group. A rule might read: allow TCP on port 443 from anywhere. Another might say: allow TCP on port 5432 only from the application servers' security group.
In AWS, security groups are stateful. If you allow a request in, the reply is allowed back out automatically, and you don't write a matching rule for it. They're also allow-only. You can't write a deny rule in a security group, so anything not explicitly permitted is blocked. Other tools, such as network ACLs in AWS, sit at the subnet level, are stateless and can deny. Many teams lean on security groups for day-to-day control and treat those subnet-level controls as a coarser second layer.
One resource can have several security groups attached, and the rules are added together. That's handy, and it's also where surprises come from: a resource is reachable if any attached group allows the traffic. Referencing one security group from another is the pattern worth learning early. Instead of listing IP addresses of your app servers, you say the database accepts traffic from whatever is in the app-server group. When servers come and go, the rule keeps working.
Why it matters for a business
Most cloud breaches that start with the network begin with something reachable that shouldn't have been: a database open to the internet, a remote admin port left available to anyone. Security groups are the control that decides that. They're often the difference between a service that only your own systems can talk to and one that strangers can probe all day.
They also shape how much damage spreads. If every server can talk to every other server on every port, one compromised machine becomes a stepping stone to everything else. Tight rules between tiers (web to app, app to database, nothing else) keep a single mistake or intrusion contained.
There's a business-facing side too. Customer security questionnaires and auditors routinely ask how network access is restricted and who can reach production data. Rules that are narrow, named clearly and reviewed on a schedule make those answers short and believable. A tangle of undocumented groups makes them slow and uncomfortable.
Common mistakes
The classic one is opening a port to the whole internet, written as 0.0.0.0/0, because it was the quickest way to get something working. SSH on port 22 and remote desktop on port 3389 are the usual offenders, along with database ports. A temporary rule added during a late-night fix often stays for years.
The second is sprawl. Teams create a new group for every project, copy rules from old ones, and never delete anything. Within a year nobody knows which groups are in use or why a rule exists. Names like "sg-test-2" tell a reviewer nothing. Rule descriptions are a free field, and almost nobody fills them in.
Third, people forget the outbound side. Default settings often allow all outbound traffic, which makes it easy for malware or a misused credential to send data out. You don't always need to lock this down fully, but you should know it's open and decide on purpose.
Finally, there's the assumption that security groups are enough. They control network paths, not who is logged in or what a valid user is allowed to do. An open-to-nobody database with an over-permissioned account is still a problem. Security groups are one layer.
How to get started
Start by listing what you have. Export every security group in each cloud account, and note which resources each one is attached to. Groups attached to nothing are candidates for deletion. Groups attached to many things deserve a closer look, since a change there has a wide effect.
Next, search for the risky patterns: any inbound rule from 0.0.0.0/0 (and its IPv6 equivalent) on anything other than ports you truly serve to the public, such as 80 and 443. For admin access, replace open rules with a known office range, a VPN, or a managed session tool so that no administrative port faces the internet at all.
Then adopt a simple convention. Name groups by role, such as web, app and db. Allow the database group to accept traffic only from the app group. Fill in the description on every rule. Put the groups in infrastructure-as-code so changes get reviewed like any other change, and turn on alerts for edits to production groups.
If you'd rather have an outside set of eyes first, Cloudverg offers a Cloud security review at $6,500/month (renews monthly until cancelled), a fixed-scope, read-only look at up to five cloud accounts that covers public exposure and network checks, with findings ranked by risk and the exact fix for each. It's one option alongside doing the audit in-house or using your cloud provider's own tooling.
Frequently asked questions
Is a security group the same as a firewall?
It works like one, but it's attached to individual resources rather than sitting at the edge of your whole network. Security groups filter traffic by protocol, port and source or destination. They aren't a replacement for a web application firewall, which inspects web requests at the application level.
What's the difference between a security group and a network ACL?
In AWS, a security group applies to a resource, is stateful and only allows traffic. A network ACL applies to a whole subnet, is stateless and can include deny rules. Most teams do their detailed control with security groups and use network ACLs as a broader backstop.
Do security groups cost extra?
In the major clouds, creating and using security groups is generally included with the networking service rather than billed as a separate item. Check your provider's current documentation to confirm for your setup. The real cost of getting them wrong is exposure, not a line on the invoice.