Cloud security Cloud security groups 3 min read

What is a cloud security group?

A database only needs connections from the application servers. Why does its security group allow PostgreSQL from every IP address?

  1. Rules allow matching traffic

    A security group rule can allow TCP port 5432 from the application tier’s security group. The database can then accept matching connections without accepting that port from every internet address.

    AWS security groups are stateful: response traffic for an allowed connection is tracked automatically.

    A matching allow rule permits the connection to reach the resource. RequestAllow ruleResource

    In short Define allowed paths around the resource, not just open ports.

  2. Every attached group contributes rules

    An instance can have more than one security group. AWS evaluates their rules together, so a restrictive group does not cancel a broad allow in another group.

    In short Check the full set of groups attached to the resource.

  3. Make the source as narrow as practical

    Use a specific peer security group or a restricted network range for administration. An inbound rule from 0.0.0.0/0 means any IPv4 address can attempt that connection.

    In short Avoid broad sources, especially for management ports.

What a security group doesn’t control

A security group is not an identity policy and does not decide which authenticated user may read data. It also does not replace host firewalls or application authorization.

Other cloud providers use different names and semantics for network filtering rules.

Keep this

Allow only the network paths the workload needs.

Review security groups as traffic allowlists. Avoid opening administration ports to the whole internet, and check every group attached to a resource.
Inbound
Which sources may connect to this resource?
Outbound
Which destinations may it contact?
Scope
Prefer references to known groups or narrow CIDRs.

Sources

Last reviewed 20 November 2026.

Next byte · Cloud networking What makes a subnet public or private?