AWS Network Security Archives - AWS Security Architect https://awssecurityarchitect.com/category/aws-network-security/ Experienced AWS, GCP and Azure Security Architect Tue, 08 Sep 2026 08:39:31 +0000 en-US hourly 1 https://wordpress.org/?v=7.1 214477604 Security Groups Design Patterns in AWS https://awssecurityarchitect.com/aws-network-security/security-groups-design-patterns-in-aws/ https://awssecurityarchitect.com/aws-network-security/security-groups-design-patterns-in-aws/#respond Tue, 08 Sep 2026 05:56:34 +0000 https://awssecurityarchitect.com/?p=349 Tiered Security Group Pattern for Secure AWS Architectures The Tiered Security Group Pattern: Building Intent-Based Network Boundaries in AWS Security groups are among the most important—and most frequently misconfigured—security controls […]

The post Security Groups Design Patterns in AWS appeared first on AWS Security Architect.

]]>
Tiered Security Group Pattern for Secure AWS Architectures

The Tiered Security Group Pattern: Building Intent-Based Network Boundaries in AWS

Security groups are among the most important—and most frequently misconfigured—security controls in an AWS environment.

A security group acts as a stateful virtual firewall for resources such as EC2 instances, load balancers, and databases. It controls which traffic may enter or leave a resource based on protocol, port, and source or destination. Because security groups are stateful, return traffic for an allowed connection is automatically permitted. (docs.aws.amazon.com)

The simplest implementation might attach one broadly permissive security group to every resource in an application. Although convenient, this approach creates an unnecessarily large attack surface. If one system is compromised, the attacker may be able to communicate directly with databases, management interfaces, monitoring systems, and other sensitive components.

A stronger approach is the Tiered Security Group Pattern.

Instead of treating the VPC as one trusted network, this pattern creates a distinct security boundary around each architectural tier, environment, and application. Communication is permitted only where there is a documented business or technical requirement.

What Is the Tiered Security Group Pattern?

The Tiered Security Group Pattern assigns different security groups to resources with different functions.

A typical three-tier application might use:

  • An internet-facing load balancer security group
  • A web-tier security group
  • An application-tier security group
  • A database-tier security group
  • An administrative-access security group
  • A monitoring or observability security group

Each security group describes the network role of the resources associated with it.

For example:

Destination tier Allowed source Port Purpose
Public load balancer Internet 443 Public HTTPS access
Web tier Load balancer SG 443 or application port Requests forwarded by the load balancer
Application tier Web-tier SG 443 or 8443 Application API calls
Database tier Application-tier SG 5432 PostgreSQL connections
Monitoring agent Monitoring SG Required telemetry ports Metrics and health monitoring
Administrative tier Approved management path Required admin port Controlled administration

The resulting communication path is deliberate:

Internet → Load Balancer → Web Tier → Application Tier → Database Tier

The database is not reachable from the internet, the load balancer, or the web tier. It accepts connections only from resources associated with the application-tier security group.

This is network least privilege expressed in architectural terms.

Use Security Group References Instead of Hard-Coded IP Addresses

One of the most valuable characteristics of AWS security groups is the ability to reference another security group as the source or destination of a rule.

Suppose the application tier must accept HTTPS connections from the web tier. The application security group can contain the following inbound rule:

Protocol: TCP
Port: 443
Source: sg-web-tier

The rule effectively says:

Permit TCP port 443 from resources associated with the approved web-tier security group.

This is superior to a rule such as:

Protocol: TCP
Port: 443
Source: 10.20.10.0/24

The CIDR-based rule trusts every resource that can obtain an address within that subnet. The security-group-based rule trusts only resources assigned the expected security identity.

AWS evaluates incoming traffic from a referenced security group using the private IP addresses of the resources associated with that group. (Amazon Elastic Compute Cloud)

Why SG-to-SG references are more resilient

Cloud resources are dynamic. Instances are replaced, containers move, Auto Scaling groups expand and contract, and load balancer nodes change over time.

If access depends on individual IP addresses, every infrastructure change can require a corresponding firewall change. That creates several problems:

  • Rules become stale.
  • Old addresses remain trusted.
  • New instances may not work until rules are updated.
  • Operations teams add broad CIDR ranges as a workaround.
  • Security reviews become difficult because the purpose of each IP address is unclear.

A security group reference avoids this dependency. Access follows the resource’s assigned role rather than its current IP address.

The rule remains valid when an instance is replaced or an application scales horizontally—as long as the appropriate security group is attached to the new resource.

1. Tier-Based Security Groups

Tier-based security groups separate resources according to their position and function within an architecture.

Load balancer security group

The public load balancer may accept HTTPS traffic from the internet:

Inbound:
TCP 443 from 0.0.0.0/0
TCP 443 from ::/0

Public access should terminate at a deliberately exposed service such as an Application Load Balancer rather than directly on application servers.

If CloudFront is the intended entry point, the load balancer can be restricted further by using the appropriate AWS-managed prefix list instead of accepting traffic from the entire internet.

Web-tier security group

The web tier should accept traffic only from the load balancer security group:

Inbound:
TCP 443 from sg-public-alb

This prevents clients from bypassing the load balancer and connecting directly to a web server—even if routing or another configuration mistake makes the server reachable.

AWS specifically supports configuring target security groups to accept traffic only from the security group associated with a load balancer. (Elastic Load Balancing)

Application-tier security group

The application tier should accept only the protocols required by the web tier:

Inbound:
TCP 8443 from sg-web

A web server compromise would therefore give an attacker access only to the application endpoint explicitly authorized by this rule. It would not automatically provide access to SSH, management interfaces, databases, or unrelated services.

Database-tier security group

The database security group should allow the database port only from the application security group:

Inbound:
TCP 5432 from sg-application

It should not allow database access from:

  • The internet
  • The complete VPC CIDR
  • Every private subnet
  • The load balancer
  • The web tier
  • Developer workstations
  • A general-purpose “internal” security group

AWS recommends creating security group rules based on the role of the associated resource—for example, web-server rules for web servers and database-specific rules for database systems. (docs.aws.amazon.com)

Administrative security group

Administrative access deserves its own boundary.

Avoid opening SSH or RDP to the internet. AWS Security Hub treats unrestricted access to SSH, RDP, and other high-risk ports as a significant security issue. (docs.aws.amazon.com)

Where possible, use AWS Systems Manager Session Manager so instances do not require publicly exposed administrative ports. If a bastion host or management appliance is necessary, create a dedicated security group and restrict access to an approved VPN, corporate network, or managed prefix list.

2. Environment-Isolated Security Groups

Production, staging, development, and test environments should not share the same application security groups.

Use separate security group sets such as:

prod-alb-sg
prod-web-sg
prod-app-sg
prod-db-sg

stage-alb-sg
stage-web-sg
stage-app-sg
stage-db-sg

dev-alb-sg
dev-web-sg
dev-app-sg
dev-db-sg

This prevents a development resource from becoming implicitly trusted by production simply because both systems perform a similar function.

For stronger isolation, place environments in separate AWS accounts and VPCs. Security groups then reinforce the account and network boundaries rather than attempting to replace them.

Production security groups should generally have:

  • Fewer permitted flows
  • Tighter egress controls
  • Separate change approval
  • Infrastructure-as-code ownership
  • Automated compliance monitoring
  • Alerts for unauthorized modifications

Development environments can remain flexible without forcing production to inherit the same permissive rules.

Avoid cross-environment references

Rules such as the following should be treated with suspicion:

prod-db-sg:
TCP 5432 from dev-app-sg

If developers need production data access, provide a controlled access mechanism with explicit authentication, authorization, auditing, and time-bounded approval. Do not create a permanent network trust relationship merely because it is operationally convenient.

3. Application-Scoped Security Groups

Tier separation alone may not be sufficient in a shared VPC.

Imagine that ten applications use the same application-tier security group. If the database security group trusts that shared group, every application associated with it may be able to reach the database—even when only one application requires access.

A stronger design gives each application or service its own security groups:

payments-prod-api-sg
payments-prod-db-sg

orders-prod-api-sg
orders-prod-db-sg

customer-prod-api-sg
customer-prod-db-sg

The Payments database accepts traffic only from the Payments application security group. The Orders application cannot connect to it simply because both workloads reside in the same subnet or application tier.

This creates a more meaningful security boundary:

Access is granted to a specific application role, not to a broad category of machines.

Application teams can own the ingress rules for their services, subject to centrally enforced guardrails.

Ingress Should Be Application-Owned

Each service should define who may initiate connections to it.

For example, the team responsible for an internal pricing API might own an ingress security group containing:

TCP 443 from sg-checkout-service
TCP 443 from sg-order-service

These rules clearly identify the approved consumers of the API.

This model improves:

  • Ownership
  • Change accountability
  • Impact analysis
  • Incident response
  • Architecture reviews
  • Automated policy validation

When a service is retired or a dependency is removed, its SG-to-SG rule can be removed without reviewing unrelated subnet ranges.

Treat Shared Egress Security Groups Carefully

Some organizations use a small, centrally managed egress security group for common destinations such as:

  • DNS services
  • Approved HTTPS endpoints
  • Central proxies
  • Monitoring collectors
  • Patch repositories
  • VPC endpoints

This can be useful, but there is an important AWS behavior to understand: when multiple security groups are associated with a resource, their rules are combined. Security groups do not contain explicit deny rules. A permissive rule in any attached security group can therefore undermine tighter rules in the others. (Amazon Virtual Private Cloud)

A shared egress security group should consequently contain only narrowly defined, genuinely common access. Do not attach an “allow all outbound” group and assume an application-specific security group can override it.

For precise egress control, consider a combination of:

  • Destination security-group references
  • AWS-managed or customer-managed prefix lists
  • VPC endpoints
  • Central egress proxies
  • Route 53 Resolver DNS Firewall
  • AWS Network Firewall
  • Explicit application-level allowlists

Security Groups Describe Permission, Not Connectivity

An SG-to-SG rule permits traffic; it does not create a network path.

The architecture still requires:

  • Valid routes
  • Compatible subnet routing
  • Correct load balancer configuration
  • Working DNS resolution
  • Network ACL compatibility
  • Listening application services
  • VPC peering, Transit Gateway, or another supported connection where applicable

Security group references also require special care when traffic passes through a middlebox or inspection appliance. AWS documents that SG references between the original source and final destination might not work when the traffic is routed through a middlebox. In those cases, private IP addresses or appropriate subnet CIDRs may be required. (Amazon Virtual Private Cloud)

Security-group references should therefore be the default for direct workload relationships, but they are not a universal substitute for understanding the traffic path.

Naming and Tagging Standards

A security group should communicate its purpose without requiring an engineer to inspect every rule.

A practical naming format is:

<application>-<environment>-<tier>-sg

Examples:

payments-prod-alb-sg
payments-prod-api-sg
payments-prod-db-sg
payments-prod-monitoring-sg

Recommended tags include:

Tag Example
Application Payments
Environment Production
Tier Database
Owner PaymentsPlatform
ManagedBy Terraform
DataClassification Confidential
Criticality High
CostCenter CC-1042

Rule descriptions should also be mandatory:

Allow PostgreSQL from Payments API
Allow HTTPS health checks from production ALB
Allow telemetry to central monitoring collector

Descriptions such as “temporary,” “internal,” or “required for testing” provide little governance value and have a habit of becoming permanent.

Infrastructure as Code

Tiered security groups should be created through Terraform, AWS CloudFormation, AWS CDK, or another controlled infrastructure-as-code process.

A simplified Terraform example looks like this:

resource "aws_security_group" "app" {
  name        = "payments-prod-app-sg"
  description = "Security group for the Payments production application tier"
  vpc_id      = aws_vpc.production.id
}

resource "aws_vpc_security_group_ingress_rule" "app_from_web" {
  security_group_id            = aws_security_group.app.id
  referenced_security_group_id = aws_security_group.web.id
  ip_protocol                  = "tcp"
  from_port                    = 8443
  to_port                      = 8443

  description = "Allow application traffic from Payments web tier"
}

resource "aws_security_group" "database" {
  name        = "payments-prod-db-sg"
  description = "Security group for the Payments production database"
  vpc_id      = aws_vpc.production.id
}

resource "aws_vpc_security_group_ingress_rule" "database_from_app" {
  security_group_id            = aws_security_group.database.id
  referenced_security_group_id = aws_security_group.app.id
  ip_protocol                  = "tcp"
  from_port                    = 5432
  to_port                      = 5432

  description = "Allow PostgreSQL from Payments application tier"
}

Infrastructure as code provides version history, peer review, repeatability, and automated testing. It also reduces configuration drift between environments.

Governance and Continuous Validation

A good pattern can deteriorate if nobody monitors it.

Organizations should continuously check for:

  • 0.0.0.0/0 and ::/0 on unauthorized ports
  • Databases reachable from public or broad internal sources
  • SSH and RDP exposed to the internet
  • Rules covering entire VPC CIDRs without justification
  • Cross-environment access
  • Cross-application trust
  • Unused security groups
  • Duplicate security groups
  • Stale referenced security groups
  • Security groups changed outside the approved deployment process
  • Default security groups containing active rules
  • Unrestricted outbound access from sensitive workloads

AWS Config can evaluate security group configurations, while Security Hub provides controls for unrestricted high-risk ports and other unsafe network configurations. AWS Firewall Manager can centrally apply, audit, and remediate security group policies across an AWS organization. It can also identify unused or redundant security groups. (AWS Config)

VPC Flow Logs and Network Access Analyzer can provide additional visibility into actual traffic and unintended network paths. (docs.aws.amazon.com)

Common Anti-Patterns

One security group for the entire application

This eliminates meaningful separation between web, application, database, and administration tiers.

Trusting the entire VPC

A rule allowing a database connection from the complete VPC CIDR treats every workload in the VPC as trusted.

Reusing production SGs in non-production

This creates unintended trust relationships and weakens environment isolation.

Hard-coding individual private IP addresses

This makes security rules fragile and difficult to maintain in an elastic environment.

Leaving the default outbound rule unchanged everywhere

New security groups commonly begin with an outbound rule permitting all traffic. Whether that is acceptable should be an explicit risk decision, not an unnoticed default. AWS allows this rule to be removed and replaced with specific outbound permissions. (Amazon Virtual Private Cloud)

Opening management ports temporarily

Temporary 0.0.0.0/0 SSH and RDP rules are frequently forgotten. Use Session Manager, VPN-based administration, or an automatically expiring access workflow.

Attaching too many security groups

Because rules are aggregated, attaching multiple SGs can create permissions that are difficult to understand. More security groups do not automatically mean more security.

A Practical Design Principle

Every security group rule should answer four questions:

  1. Who is initiating the connection?
  2. Which service is receiving it?
  3. Which protocol and port are required?
  4. Why is the connection necessary?

If a rule cannot answer those questions clearly, it is probably too broad.

The Tiered Security Group Pattern transforms security groups from collections of ports and IP addresses into an expression of application architecture:

  • The load balancer may communicate with the web tier.
  • The web tier may communicate with the application tier.
  • The application tier may communicate with its database.
  • Monitoring systems may reach defined telemetry endpoints.
  • Administrators may enter only through an approved management path.
  • Development systems may not communicate with production.
  • One application may not inherit access intended for another.

That is the central idea: grant access according to workload identity, architectural tier, application ownership, and environment—not merely according to network location.

When properly implemented, tiered security groups reduce lateral movement, contain compromised workloads, simplify security reviews, and make the intended architecture visible directly in the network policy.

“`
Also read VPC Security Best Practices

The Tiered Security Group Pattern: Building Intent-Based Network Boundaries in AWS

Security groups are among the most important—and most frequently misconfigured—security controls in an AWS environment.

A security group acts as a stateful virtual firewall for resources such as EC2 instances, load balancers, and databases. It controls which traffic may enter or leave a resource based on protocol, port, and source or destination. Because security groups are stateful, return traffic for an allowed connection is automatically permitted.

The simplest implementation might attach one broadly permissive security group to every resource in an application. Although convenient, this approach creates an unnecessarily large attack surface. If one system is compromised, the attacker may be able to communicate directly with databases, management interfaces, monitoring systems, and other sensitive components.

A stronger approach is the Tiered Security Group Pattern.

Instead of treating the VPC as one trusted network, this pattern creates a distinct security boundary around each architectural tier, environment, and application. Communication is permitted only where there is a documented business or technical requirement.

What Is the Tiered Security Group Pattern?

The Tiered Security Group Pattern assigns different security groups to resources with different functions.

A typical three-tier application might use:

  • An internet-facing load balancer security group
  • A web-tier security group
  • An application-tier security group
  • A database-tier security group
  • An administrative-access security group
  • A monitoring or observability security group

Each security group describes the network role of the resources associated with it.

For example:

Destination tier Allowed source Port Purpose
Public load balancer Internet 443 Public HTTPS access
Web tier Load balancer SG 443 or application port Requests forwarded by the load balancer
Application tier Web-tier SG 443 or 8443 Application API calls
Database tier Application-tier SG 5432 PostgreSQL connections
Monitoring agent Monitoring SG Required telemetry ports Metrics and health monitoring
Administrative tier Approved management path Required admin port Controlled administration

The resulting communication path is deliberate:

Internet → Load Balancer → Web Tier → Application Tier → Database Tier

The database is not reachable from the internet, the load balancer, or the web tier. It accepts connections only from resources associated with the application-tier security group.

This is network least privilege expressed in architectural terms.

Use Security Group References Instead of Hard-Coded IP Addresses

One of the most valuable characteristics of AWS security groups is the ability to reference another security group as the source or destination of a rule.

Suppose the application tier must accept HTTPS connections from the web tier. The application security group can contain the following inbound rule:

Protocol: TCP
Port: 443
Source: sg-web-tier

The rule effectively says:

Permit TCP port 443 from resources associated with the approved web-tier security group.

This is superior to a rule such as:

Protocol: TCP
Port: 443
Source: 10.20.10.0/24

The CIDR-based rule trusts every resource that can obtain an address within that subnet. The security-group-based rule trusts only resources assigned the expected security identity.

AWS evaluates incoming traffic from a referenced security group using the private IP addresses of the resources associated with that group.

Why SG-to-SG references are more resilient

Cloud resources are dynamic. Instances are replaced, containers move, Auto Scaling groups expand and contract, and load balancer nodes change over time.

If access depends on individual IP addresses, every infrastructure change can require a corresponding firewall change. That creates several problems:

  • Rules become stale.
  • Old addresses remain trusted.
  • New instances may not work until rules are updated.
  • Operations teams add broad CIDR ranges as a workaround.
  • Security reviews become difficult because the purpose of each IP address is unclear.

A security group reference avoids this dependency. Access follows the resource’s assigned role rather than its current IP address.

The rule remains valid when an instance is replaced or an application scales horizontally—as long as the appropriate security group is attached to the new resource.

1. Tier-Based Security Groups

Tier-based security groups separate resources according to their position and function within an architecture.

Load balancer security group

The public load balancer may accept HTTPS traffic from the internet:

Inbound:
TCP 443 from 0.0.0.0/0
TCP 443 from ::/0

Public access should terminate at a deliberately exposed service such as an Application Load Balancer rather than directly on application servers.

If CloudFront is the intended entry point, the load balancer can be restricted further by using the appropriate AWS-managed prefix list instead of accepting traffic from the entire internet.

Web-tier security group

The web tier should accept traffic only from the load balancer security group:

Inbound:
TCP 443 from sg-public-alb

This prevents clients from bypassing the load balancer and connecting directly to a web server—even if routing or another configuration mistake makes the server reachable.

AWS specifically supports configuring target security groups to accept traffic only from the security group associated with a load balancer.

Application-tier security group

The application tier should accept only the protocols required by the web tier:

Inbound:
TCP 8443 from sg-web

A web server compromise would therefore give an attacker access only to the application endpoint explicitly authorized by this rule. It would not automatically provide access to SSH, management interfaces, databases, or unrelated services.

Database-tier security group

The database security group should allow the database port only from the application security group:

Inbound:
TCP 5432 from sg-application

It should not allow database access from:

  • The internet
  • The complete VPC CIDR
  • Every private subnet
  • The load balancer
  • The web tier
  • Developer workstations
  • A general-purpose “internal” security group

AWS recommends creating security group rules based on the role of the associated resource—for example, web-server rules for web servers and database-specific rules for database systems.

Administrative security group

Administrative access deserves its own boundary.

Avoid opening SSH or RDP to the internet. AWS Security Hub treats unrestricted access to SSH, RDP, and other high-risk ports as a significant security issue.

Where possible, use AWS Systems Manager Session Manager so instances do not require publicly exposed administrative ports. If a bastion host or management appliance is necessary, create a dedicated security group and restrict access to an approved VPN, corporate network, or managed prefix list.

2. Environment-Isolated Security Groups

Production, staging, development, and test environments should not share the same application security groups.

Use separate security group sets such as:

prod-alb-sg
prod-web-sg
prod-app-sg
prod-db-sg

stage-alb-sg
stage-web-sg
stage-app-sg
stage-db-sg

dev-alb-sg
dev-web-sg
dev-app-sg
dev-db-sg

This prevents a development resource from becoming implicitly trusted by production simply because both systems perform a similar function.

For stronger isolation, place environments in separate AWS accounts and VPCs. Security groups then reinforce the account and network boundaries rather than attempting to replace them.

Production security groups should generally have:

  • Fewer permitted flows
  • Tighter egress controls
  • Separate change approval
  • Infrastructure-as-code ownership
  • Automated compliance monitoring
  • Alerts for unauthorized modifications

Development environments can remain flexible without forcing production to inherit the same permissive rules.

Avoid cross-environment references

Rules such as the following should be treated with suspicion:

prod-db-sg:
TCP 5432 from dev-app-sg

If developers need production data access, provide a controlled access mechanism with explicit authentication, authorization, auditing, and time-bounded approval. Do not create a permanent network trust relationship merely because it is operationally convenient.

3. Application-Scoped Security Groups

Tier separation alone may not be sufficient in a shared VPC.

Imagine that ten applications use the same application-tier security group. If the database security group trusts that shared group, every application associated with it may be able to reach the database—even when only one application requires access.

A stronger design gives each application or service its own security groups:

payments-prod-api-sg
payments-prod-db-sg

orders-prod-api-sg
orders-prod-db-sg

customer-prod-api-sg
customer-prod-db-sg

The Payments database accepts traffic only from the Payments application security group. The Orders application cannot connect to it simply because both workloads reside in the same subnet or application tier.

This creates a more meaningful security boundary:

Access is granted to a specific application role, not to a broad category of machines.

Application teams can own the ingress rules for their services, subject to centrally enforced guardrails.

Ingress Should Be Application-Owned

Each service should define who may initiate connections to it.

For example, the team responsible for an internal pricing API might own an ingress security group containing:

TCP 443 from sg-checkout-service
TCP 443 from sg-order-service

These rules clearly identify the approved consumers of the API.

This model improves:

  • Ownership
  • Change accountability
  • Impact analysis
  • Incident response
  • Architecture reviews
  • Automated policy validation

When a service is retired or a dependency is removed, its SG-to-SG rule can be removed without reviewing unrelated subnet ranges.

Treat Shared Egress Security Groups Carefully

Some organizations use a small, centrally managed egress security group for common destinations such as:

  • DNS services
  • Approved HTTPS endpoints
  • Central proxies
  • Monitoring collectors
  • Patch repositories
  • VPC endpoints

This can be useful, but there is an important AWS behavior to understand: when multiple security groups are associated with a resource, their rules are combined. Security groups do not contain explicit deny rules. A permissive rule in any attached security group can therefore undermine tighter rules in the others.

A shared egress security group should consequently contain only narrowly defined, genuinely common access. Do not attach an “allow all outbound” group and assume an application-specific security group can override it.

For precise egress control, consider a combination of:

  • Destination security-group references
  • AWS-managed or customer-managed prefix lists
  • VPC endpoints
  • Central egress proxies
  • Route 53 Resolver DNS Firewall
  • AWS Network Firewall
  • Explicit application-level allowlists

Security Groups Describe Permission, Not Connectivity

An SG-to-SG rule permits traffic; it does not create a network path.

The architecture still requires:

  • Valid routes
  • Compatible subnet routing
  • Correct load balancer configuration
  • Working DNS resolution
  • Network ACL compatibility
  • Listening application services
  • VPC peering, Transit Gateway, or another supported connection where applicable

Security group references also require special care when traffic passes through a middlebox or inspection appliance. AWS documents that SG references between the original source and final destination might not work when the traffic is routed through a middlebox. In those cases, private IP addresses or appropriate subnet CIDRs may be required.

Security-group references should therefore be the default for direct workload relationships, but they are not a universal substitute for understanding the traffic path.

Naming and Tagging Standards

A security group should communicate its purpose without requiring an engineer to inspect every rule.

A practical naming format is:

<application>-<environment>-<tier>-sg

Examples:

payments-prod-alb-sg
payments-prod-api-sg
payments-prod-db-sg
payments-prod-monitoring-sg

Recommended tags include:

Tag Example
Application Payments
Environment Production
Tier Database
Owner PaymentsPlatform
ManagedBy Terraform
DataClassification Confidential
Criticality High
CostCenter CC-1042

Rule descriptions should also be mandatory:

Allow PostgreSQL from Payments API
Allow HTTPS health checks from production ALB
Allow telemetry to central monitoring collector

Descriptions such as “temporary,” “internal,” or “required for testing” provide little governance value and have a habit of becoming permanent.

Infrastructure as Code

Tiered security groups should be created through Terraform, AWS CloudFormation, AWS CDK, or another controlled infrastructure-as-code process.

A simplified Terraform example looks like this:

resource "aws_security_group" "app" {
  name        = "payments-prod-app-sg"
  description = "Security group for the Payments production application tier"
  vpc_id      = aws_vpc.production.id
}

resource "aws_vpc_security_group_ingress_rule" "app_from_web" {
  security_group_id            = aws_security_group.app.id
  referenced_security_group_id = aws_security_group.web.id
  ip_protocol                  = "tcp"
  from_port                    = 8443
  to_port                      = 8443

  description = "Allow application traffic from Payments web tier"
}

resource "aws_security_group" "database" {
  name        = "payments-prod-db-sg"
  description = "Security group for the Payments production database"
  vpc_id      = aws_vpc.production.id
}

resource "aws_vpc_security_group_ingress_rule" "database_from_app" {
  security_group_id            = aws_security_group.database.id
  referenced_security_group_id = aws_security_group.app.id
  ip_protocol                  = "tcp"
  from_port                    = 5432
  to_port                      = 5432

  description = "Allow PostgreSQL from Payments application tier"
}

Infrastructure as code provides version history, peer review, repeatability, and automated testing. It also reduces configuration drift between environments.

Governance and Continuous Validation

A good pattern can deteriorate if nobody monitors it.

Organizations should continuously check for:

  • 0.0.0.0/0 and ::/0 on unauthorized ports
  • Databases reachable from public or broad internal sources
  • SSH and RDP exposed to the internet
  • Rules covering entire VPC CIDRs without justification
  • Cross-environment access
  • Cross-application trust
  • Unused security groups
  • Duplicate security groups
  • Stale referenced security groups
  • Security groups changed outside the approved deployment process
  • Default security groups containing active rules
  • Unrestricted outbound access from sensitive workloads

AWS Config can evaluate security group configurations, while Security Hub provides controls for unrestricted high-risk ports and other unsafe network configurations. AWS Firewall Manager can centrally apply, audit, and remediate security group policies across an AWS organization. It can also identify unused or redundant security groups.

VPC Flow Logs and Network Access Analyzer can provide additional visibility into actual traffic and unintended network paths.

Common Anti-Patterns

One security group for the entire application

This eliminates meaningful separation between web, application, database, and administration tiers.

Trusting the entire VPC

A rule allowing a database connection from the complete VPC CIDR treats every workload in the VPC as trusted.

Reusing production SGs in non-production

This creates unintended trust relationships and weakens environment isolation.

Hard-coding individual private IP addresses

This makes security rules fragile and difficult to maintain in an elastic environment.

Leaving the default outbound rule unchanged everywhere

New security groups commonly begin with an outbound rule permitting all traffic. Whether that is acceptable should be an explicit risk decision, not an unnoticed default. AWS allows this rule to be removed and replaced with specific outbound permissions.

Opening management ports temporarily

Temporary 0.0.0.0/0 SSH and RDP rules are frequently forgotten. Use Session Manager, VPN-based administration, or an automatically expiring access workflow.

Attaching too many security groups

Because rules are aggregated, attaching multiple SGs can create permissions that are difficult to understand. More security groups do not automatically mean more security.

A Practical Design Principle

Every security group rule should answer four questions:

  1. Who is initiating the connection?
  2. Which service is receiving it?
  3. Which protocol and port are required?
  4. Why is the connection necessary?

If a rule cannot answer those questions clearly, it is probably too broad.

The Tiered Security Group Pattern transforms security groups from collections of ports and IP addresses into an expression of application architecture:

  • The load balancer may communicate with the web tier.
  • The web tier may communicate with the application tier.
  • The application tier may communicate with its database.
  • Monitoring systems may reach defined telemetry endpoints.
  • Administrators may enter only through an approved management path.
  • Development systems may not communicate with production.
  • One application may not inherit access intended for another.

That is the central idea: grant access according to workload identity, architectural tier, application ownership, and environment—not merely according to network location.

When properly implemented, tiered security groups reduce lateral movement, contain compromised workloads, simplify security reviews, and make the intended architecture visible directly in the network policy.

The post Security Groups Design Patterns in AWS appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/security-groups-design-patterns-in-aws/feed/ 0 349
DNS Isolation on AWS https://awssecurityarchitect.com/aws-network-security/dns-isolation-on-aws/ https://awssecurityarchitect.com/aws-network-security/dns-isolation-on-aws/#respond Tue, 25 Nov 2025 20:11:40 +0000 https://awssecurityarchitect.com/?p=500 DNS Isolation on AWS: Route 53 Resolver, DNS Firewall & Private DNS DNS Isolation on AWS DNS isolation on AWS refers to designing your Amazon Web Services environment so that […]

The post DNS Isolation on AWS appeared first on AWS Security Architect.

]]>
DNS Isolation on AWS: Route 53 Resolver, DNS Firewall & Private DNS


dns isolation aws
dns isolation aws

DNS Isolation on AWS

DNS isolation on AWS refers to designing your Amazon Web Services environment so that certain workloads or networks can only resolve DNS names you explicitly allow, while blocking or segregating access to all other DNS sources—internal or external.

It is often used for security-sensitive, regulated, or multi-tenant architectures where you want to strictly control what resources can discover each other via DNS.

What DNS Isolation Means

DNS isolation ensures that a workload or subnet does not automatically inherit DNS visibility from the broader VPC or the internet. Instead, you tightly control where it gets DNS answers from (e.g., Route 53 Resolver rules, inbound/outbound resolvers, private hosted zones).

  • Isolates DNS Resolution Paths: Prevents workloads from resolving public DNS names or internal/private AWS names not intended for them.
  • Controls Resource Discovery: Restricts which internal services can be discovered by name.
  • Prevents Data Exfiltration via DNS: Cuts off malware from using DNS to exfiltrate data.

How to Implement DNS Isolation in AWS

1. Disable the Default VPC Resolver

At the subnet level, set enableDnsSupport = false or override DNS servers via DHCP option sets to force workloads to use only your DNS servers.

2. Use Custom DNS Servers or Route 53 Resolver Endpoints

Point instances/subnets to custom DNS appliances or Route 53 outbound resolver endpoints with controlled forwarding rules.

3. Use Route 53 Resolver Rules for Fine-Grained Control

Define conditional forwarding rules, e.g.:

  • corp.local → internal DNS server
  • serviceA.internal → specific resolver
  • Block everything else

4. Private Hosted Zones (PHZs) for Segregation

Attach PHZs only to specific VPCs to achieve multi-tenant DNS isolation and environment separation (dev vs prod).

5. Use Security Groups or Route 53 Resolver DNS Firewall

Create DNS firewall rule groups to:

  • Allow only approved domains
  • Block malware/TLDs
  • Prevent access to external DNS servers

Common Use Cases for DNS Isolation

  • Zero-Trust Network Design: Only authorized services resolve each other.
  • Regulated Workloads: Ensures workloads resolve only internal names (HIPAA, FedRAMP, PCI).
  • Multi-Tenant SaaS Platforms: Each tenant/VPC uses separate PHZs and resolver rules.
  • Highly-Sensitive Internal Apps: Prevents accidental communication.
  • Preventing Data Exfiltration: Blocks DNS tunneling by design.

Example Architecture for Isolated DNS

VPC (DNS Support Disabled)
   |
   +-- DHCP Option Set: DNS = Custom DNS Servers
   |
   +-- Route 53 Outbound Resolver Endpoint
           |
           |-- RULE: *.corp.local → Internal Data Center DNS
           |-- RULE: *.aws.local → AmazonProvidedDNS (private endpoints only)
           |-- RULE: BLOCK everything else

Workloads in this VPC cannot resolve public DNS, cannot query VPC private DNS unless allowed, and cannot access external resolvers.

 

The post DNS Isolation on AWS appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/dns-isolation-on-aws/feed/ 0 500
AWS Security Hub versus Wiz on AWS https://awssecurityarchitect.com/cspm-on-aws/aws-security-hub-versus-wiz-on-aws/ https://awssecurityarchitect.com/cspm-on-aws/aws-security-hub-versus-wiz-on-aws/#respond Fri, 07 Nov 2025 15:46:57 +0000 https://awssecurityarchitect.com/?p=460 Capabilities AWS Security Hub CSPM Provides That Wiz Cannot 1. ➡️ Only AWS Security Hub can directly inherit & enforce Org-level guardrails. Deep Native Integration With AWS Control APIs (Preventive […]

The post AWS Security Hub versus Wiz on AWS appeared first on AWS Security Architect.

]]>
Capabilities AWS Security Hub CSPM Provides That Wiz Cannot

1. ➡ Only AWS Security Hub can directly inherit & enforce Org-level guardrails. Deep Native Integration With AWS Control APIs (Preventive + Detective Controls)

Security Hub isn’t just reading posture — it is tightly wired into:

  • AWS Organizations / Control Tower

  • AWS Config and Config Conformance Packs

  • IAM Access Analyzer

  • GuardDuty

  • Macie

  • Inspector

  • CloudTrail

  • Network Firewall

  • RDS Enhanced Monitoring

  • Route 53 Resolver DNS Firewall

Wiz can ingest some of this data after it is generated,
but cannot natively participate in enforcement or orchestration because only AWS can modify guardrails at the organization level.

➡ Only AWS Security Hub can directly inherit & enforce Org-level guardrails.

2. Automatic, Native Remediation via SSM Automation Documents

Security Hub integrates natively with:

  • AWS Systems Manager Automation

  • Pre-built remediation playbooks (SSM documents)

    • e.g., “Enable S3 block-public-access”,

    • “Rotate IAM access keys”,

    • “Encrypt EBS volumes”,

    • “Enable CloudTrail globally”.

Wiz can create tickets, alerts, or send webhook actions —
but it cannot directly run AWS-managed remediation automation.

➡ AWS provides out-of-the-box remediation actions Wiz cannot trigger or manage natively.


✅ 3. Organization-Wide Mandatory Controls (FSBP, CIS Benchmarks)

Security Hub offers AWS Foundational Security Best Practices — tuned specifically to AWS internals, such as:

  • Ensuring CloudTrail multi-region logging

  • Ensuring GuardDuty is enabled in all regions

  • Ensuring EBS encryption-by-default

  • Ensuring VPC Flow Logs coverage

  • Ensuring S3 public access block (account-level)

Wiz can check configurations, but cannot enforce AWS-level mandatory controls such as:

  • Forced CloudTrail global

  • Forced GuardDuty onboarding

  • Automatic region enrollment

  • Policy inheritance via Organizations

➡ AWS-native CSPM can enforce security at the root account / org level, Wiz cannot.


✅ 4. Guaranteed Data Freshness from AWS APIs (Zero Lag)

AWS-native CSPM tools pull data directly from AWS control-plane APIs with:

  • zero throttling issues

  • full permission coverage

  • immediate state awareness

Wiz relies on:

  • periodic scans

  • configuration snapshots

  • ingestion delays

➡ Security Hub always has the canonical truth from AWS itself.


✅ 5. Fully Managed Multi-Account Aggregation Through AWS Organizations

Security Hub can:

  • auto-enable itself on new AWS accounts

  • apply controls org-wide via delegated admin

  • manage cross-account aggregation without custom roles

  • ensure region-by-region mandatory configuration

Wiz requires:

  • manually setting up IAM roles

  • cross-account connectors

  • agentless scanning permissions

  • manual policy propagation

➡ AWS CSPM has zero maintenance overhead for new accounts and new regions.

Summary: When AWS CSPM Outperforms Wiz

Security Hub is stronger when you need:

✅ Org-level governance
✅ Guaranteed integration correctness
✅ AWS-managed remediations
✅ Compliance-heavy requirements
✅ Zero external dependencies
✅ Cost + security combined governance
✅ Deep AWS internal telemetry

Wiz is stronger when you want:

✅ Attack path analysis
✅ Cloud-graph visualization
✅ Multi-cloud posture
✅ Unified risk context (identity + vuln + config)

The post AWS Security Hub versus Wiz on AWS appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/cspm-on-aws/aws-security-hub-versus-wiz-on-aws/feed/ 0 460
Replace DMZ with Shared VPC in AWS https://awssecurityarchitect.com/aws-network-security/replace-dmz-with-shared-vpc-in-aws/ https://awssecurityarchitect.com/aws-network-security/replace-dmz-with-shared-vpc-in-aws/#respond Mon, 03 Nov 2025 23:04:03 +0000 https://awssecurityarchitect.com/?p=438 AWS Shared VPC with Transit Gateway, GWLB & Centralized Firewall Inspection Shared VPC Host (Public & Private Subnets) + TGW + Security VPC (GWLB); Participant Accounts place ENIs in Shared […]

The post Replace DMZ with Shared VPC in AWS appeared first on AWS Security Architect.

]]>
AWS Shared VPC with Transit Gateway, GWLB & Centralized Firewall Inspection

AWS Firewall Manager
AWS Firewall Manager

Shared VPC Host (Public & Private Subnets) + TGW + Security VPC (GWLB); Participant Accounts place ENIs in Shared Subnets

Overview

This architecture uses a Shared VPC model where a central Host Account owns and manages a VPC containing both
Public and Private subnets. Multiple Participant Accounts launch their workloads
(ENIs, EC2 instances, ECS tasks, etc.) directly into these subnets. All inter-VPC and north-south traffic is routed through a
Transit Gateway (TGW) and inspected by a centralized Security VPC hosting
Gateway Load Balancer (GWLB) firewalls.

Key Components

1. Shared VPC Host Account

  • Owns the Shared VPC — including subnets, route tables, and TGW attachments.
  • Contains:
    • Public Subnets (connected to an Internet Gateway):
      • Host Internet-facing components such as ALBs, NAT Gateways, or public EC2 instances.
      • Default route 0.0.0.0/0 → IGW.
    • Private Subnets (non-Internet-facing):
      • Host backend workloads or participant ENIs.
      • Routes for internal CIDRs (e.g., 10.0.0.0/8) point to the TGW attachment.
  • Transit Gateway Attachment:
    • Connects the Shared VPC to the TGW for both east-west and north-south routing.
    • TGW route table determines if traffic is inspected or forwarded to other VPCs.

2. Security Account and Security VPC

  • A dedicated account owned by the security team.
  • Contains the Gateway Load Balancer (GWLB) and firewall appliances
    (e.g., Palo Alto, FortiGate, Check Point, or Suricata).
  • Security VPC details:
    • Subnets per AZ connected to GWLB target groups.
    • TGW attachment with Appliance Mode enabled to maintain flow symmetry.
  • GWLB endpoints are used by the Shared VPC’s private route tables to forward traffic for inspection.

3. Transit Gateway (TGW)

  • Acts as the central routing fabric connecting:
    • The Shared VPC (Host Account)
    • The Security VPC (Security Account)
    • Any additional application or support VPCs in other accounts
  • TGW Route Tables configured for traffic steering:
    • Routes between participant workloads go through the Security VPC for inspection.
    • North-south (Internet-bound) traffic also passes through the Security VPC before reaching the IGW.
    • Blackhole routes prevent direct bypass of inspection.

4. Participant Accounts

  • Do not own a VPC; workloads are deployed into exported subnets of the Shared VPC.
  • Each participant’s ENIs appear within the Shared VPC’s subnets.
  • Participants rely on the Host Account for:
    • Subnet routing configuration
    • Security group and NACL enforcement
    • TGW connectivity and inspection routing

Traffic Flow Scenarios

North–South (Internet Ingress/Egress)

  1. Internet traffic enters via the IGW in the Shared VPC’s Public Subnets.
  2. Traffic passes through ALB/firewall endpoints and then through the GWLB in the Security VPC for inspection.
  3. Allowed traffic is routed via TGW to workloads in private subnets (participant ENIs).
  4. Outbound follows the reverse path — Private → TGW → GWLB → IGW.

East–West (Inter-VPC / Internal Traffic)

  1. Workload in Shared VPC initiates traffic to another internal VPC.
  2. Traffic routes Shared VPC → TGW → Security VPC (inspection) → TGW → destination VPC.
  3. All inter-VPC traffic is centrally monitored and inspected.

Operational Benefits

  • Centralized governance: Host Account owns routing and TGW attachments ensuring policy consistency.
  • Least privilege & separation of duties:
    • Security Account manages firewalls and policies.
    • Host Account manages network infrastructure.
    • Participant Accounts manage only their workloads.
  • Scalable & multi-account compliant: Works under AWS Organizations + RAM.
  • Reduced operational duplication: One shared IGW/NAT/firewall layer for all accounts.
  • Inspection assurance: All traffic (north-south and east-west) passes through GWLB via TGW routing.

Design Best Practices

  • Enable Appliance Mode on the Security VPC TGW attachment for stateful symmetry.
  • Use dedicated TGW route tables for inspected vs. trusted paths.
  • Export both Public and Private subnets to participant accounts for flexible placement.
  • Use AWS Firewall Manager or SCPs to enforce inspection and prevent direct IGW use by participants.
  • Enable VPC Flow Logs and TGW Flow Logs for audit visibility.

The post Replace DMZ with Shared VPC in AWS appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/replace-dmz-with-shared-vpc-in-aws/feed/ 0 438
DMZs versus Shared VPCs https://awssecurityarchitect.com/aws-network-security/dmzs-versus-shared-vpcs/ https://awssecurityarchitect.com/aws-network-security/dmzs-versus-shared-vpcs/#respond Mon, 03 Nov 2025 22:51:50 +0000 https://awssecurityarchitect.com/?p=434   AWS Shared VPC Architecture – Segmentation by Ingress Type In an AWS Shared VPC architecture, the host account owns and manages the VPC, subnets, and routing. It shares specific […]

The post DMZs versus Shared VPCs appeared first on AWS Security Architect.

]]>
 

AWS Shared VPC Architecture – Segmentation by Ingress Type

In an AWS Shared VPC architecture, the host account owns and manages the VPC, subnets, and routing.
It shares specific subnets with participant accounts through AWS Resource Access Manager (RAM).
This allows each participant account to deploy workloads into shared subnets — without owning or modifying the core VPC networking.


1. Segmentation Models

A. Environment-Based

Each participant account represents an environment (e.g., Dev, Test, Prod).
Subnets within the shared VPC are labeled and shared accordingly:

  • Dev Account: dev-public-*, dev-private-* subnets
  • Test Account: test-public-*, test-private-* subnets
  • Prod Account: prod-public-*, prod-private-*, prod-isolated-* subnets

This keeps environments isolated while maintaining consistent security and routing through a single centrally managed VPC.

B. Workload-Based (by Ingress Profile)

Alternatively, participant accounts may represent workload ingress types:

  • Edge / Public Ingress Account: Internet-facing workloads using ALB/NLB, CloudFront origins.
  • Private Services Account: Application workloads reachable only through internal ALBs, VPC Lattice, or PrivateLink.
  • Data or Regulated Account: Isolated workloads (RDS, MSK, S3 endpoints) accessible only through endpoints or service meshes.

2. Ingress Flow Diagram

          +----------------------+
          |      Internet        |
          +----------+-----------+
                     |
                     v
         +-----------+-----------+
         |  Edge (Public Ingress)|
         |  Account – ALB/NLB    |
         +-----------+-----------+
                     |
                     v
         +-----------+-----------+
         |  Private App Services |
         |  Account – ECS/EKS    |
         +-----------+-----------+
                     |
                     v
         +-----------+-----------+
         |   Data/Isolated Tier  |
         |   Account – RDS, EFS  |
         +-----------------------+

Each tier runs in its own participant account using subnets shared from the host VPC.
Traffic flows from public ALBs → internal services → data layers, all within controlled ingress boundaries.


3. Governance and Control Layers

  • Subnet Sharing: Host account shares only the appropriate subnets (public/private/isolated) with each participant account.
  • Routing: Host account manages route tables (e.g., IGW routes only for public subnets, NAT or GWLB for private).
  • Security Groups: Participant accounts define SGs for their resources; AWS Firewall Manager can enforce org-wide SG policies.
  • Network Firewall: Centralized inspection via AWS Network Firewall or GWLB in the host account.
  • SCPs & Config: Prevent public resources in private-only accounts; ensure compliance via Config/FMS rules.

4. Example Mapping Table

Participant Account Shared Subnets Ingress Type Typical Components Notes
acct-edge edge-public-*, edge-private-* Public (ALB/NLB) Internet ALB, WAF, CloudFront Handles all internet-facing ingress
acct-apps apps-private-* Private Internal ALB, ECS, EKS, Lattice Accessible only via internal routing or Lattice
acct-data data-isolated-* Private (no IGW/NAT) RDS, Aurora, MSK, S3 Endpoints Ingress via Lattice/PrivateLink only
acct-prod prod-public-*, prod-private-*, prod-isolated-* Mixed (Controlled) Tiered production stack Strict SCP and FMS enforcement

5. Key Enforcement Mechanisms

  • Use AWS Firewall Manager to enforce org-wide SG and NFW policies.
  • Apply Service Control Policies (SCPs) to block creation of public ALBs or IGWs in private-only accounts.
  • Implement Config Rules for continuous compliance (public IP detection, restricted-ssh).
  • Tag subnets and accounts with Environment and IngressType for automation and visibility.

 

The post DMZs versus Shared VPCs appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/dmzs-versus-shared-vpcs/feed/ 0 434
Firewall Manager and Shared VPCs in AWS https://awssecurityarchitect.com/aws-network-security/firewall-manager-and-shared-vpcs-in-aws/ https://awssecurityarchitect.com/aws-network-security/firewall-manager-and-shared-vpcs-in-aws/#respond Thu, 30 Oct 2025 03:42:17 +0000 https://awssecurityarchitect.com/?p=407   Shared VPC Use Cases & Shared VPC vs Transit Gateway This document provides additional Shared VPC use cases for AWS Network Firewall and explains how Shared VPCs differ technically […]

The post Firewall Manager and Shared VPCs in AWS appeared first on AWS Security Architect.

]]>
 

Shared VPC Use Cases & Shared VPC vs Transit Gateway

This document provides additional Shared VPC use cases for AWS Network Firewall and explains how Shared VPCs differ technically and operationally from AWS Transit Gateways (TGWs).

Network Firewall Policies — Shared VPC Support

When AWS Network Firewall is deployed through Firewall Manager in a Shared VPC environment, it provides consistent network-layer inspection across workloads owned by multiple AWS accounts but hosted in a single VPC owned by the networking (host) account.

Shared VPC Use Cases for Network Firewall
  • Centralized inspection for multi-account applications: Multiple business units (each with separate AWS accounts) can deploy workloads into shared subnets of a central VPC. A single Network Firewall instance inspects north–south and east–west traffic.
  • Segregation between trust zones: Shared VPCs allow separate subnets for different security tiers such as Application, Database, and Management tiers—all inspected through centralized firewall endpoints.
  • Central egress control: Outbound traffic from all member accounts can be routed through shared egress inspection subnets where Firewall Manager enforces domain filtering, data-loss prevention (DLP) signatures, or threat-intelligence blocking.
  • Hub-and-spoke simplification: Instead of deploying firewalls in each spoke account, Shared VPCs enable a single firewall deployment protecting workloads across accounts.
  • Consistent DNS and Security Policy Integration: Shared VPCs simplify DNS Firewall and Security Group policy application because all traffic passes through common resolver endpoints and SG baselines.
  • Shared services protection: Protect central shared services such as CI/CD pipelines, Active Directory, and artifact repositories within the same VPC using a unified inspection layer.
  • East–West microsegmentation: Enforce inter-subnet communication controls between workloads of different accounts without additional firewalls per account.
  • Tenant isolation: Maintain logical separation between workloads from different participant accounts using route tables and firewall rules within a single address space.
  • Standardized SaaS egress policies: Permit access to approved SaaS domains while blocking all unapproved external destinations through DNS and firewall rule sets.
  • Gradual onboarding: Simplify onboarding of new participant accounts to a pre-secured network environment with inherited inspection and logging capabilities.

How Shared VPCs Differ from Transit Gateways

While both Shared VPCs and Transit Gateways enable multi-account connectivity, they operate at different scopes and layers of the network.

Aspect Shared VPC Transit Gateway (TGW)
Scope Single VPC shared across accounts in one AWS Region and Organization. Regional routing hub connecting multiple VPCs and on-prem networks.
Ownership Model One host account owns the VPC; participant accounts share designated subnets. Each account owns its own VPC; Transit Gateway connects them through attachments.
Network Plane Operates within one VPC’s address space, eliminating inter-VPC routing overhead. Creates an overlay routing fabric between multiple VPCs with explicit route propagation.
Security Controls Centralized via Security Groups, NACLs, and Network/DNS Firewall managed by Firewall Manager. Enforced per VPC or via centralized inspection VPCs using TGW route table redirection.
Traffic Visibility Unified visibility through a single VPC’s Flow Logs and logging infrastructure. Requires TGW Flow Logs or central inspection for consistent observability.
Use Case Fit Best for closely coupled workloads, shared services, or microservice clusters within one Region. Ideal for distributed architectures, hybrid connectivity, and multi-region or multi-BU environments.
Performance Low latency—no additional routing hops. Additional hop through TGW introduces slight latency overhead.
Cost No per-GB data processing charge. Charged per GB of data processed and per attachment.
Design Implications
  • Shared VPCs simplify policy enforcement because all traffic remains within a single VPC boundary—making it easier for Firewall Manager, Network Firewall, and DNS Firewall to apply consistent controls.
  • Transit Gateways are better suited for large, multi-region, or hybrid environments where many VPCs or on-prem networks must interconnect.
  • Combined Approach: Many enterprises deploy Shared VPCs for intra-business-unit workloads and Transit Gateways for cross-business-unit or cross-region routing.

Tip: Pair Firewall Manager policies (Network Firewall, Security Group, WAF, DNS Firewall) with centralized logging to S3 or CloudWatch and integrate with AWS Security Hub or GuardDuty for organization-wide visibility and automated compliance.

 

The post Firewall Manager and Shared VPCs in AWS appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/firewall-manager-and-shared-vpcs-in-aws/feed/ 0 407
AWS Shared VPC vs. Transit Gateways https://awssecurityarchitect.com/shared-vpcs/aws-shared-vpc-vs-transit-gateways/ https://awssecurityarchitect.com/shared-vpcs/aws-shared-vpc-vs-transit-gateways/#respond Fri, 24 Oct 2025 14:41:06 +0000 https://awssecurityarchitect.com/?p=377   AWS Shared VPCs as an Alternative to Transit Gateways How Security Groups behave for resources in shared subnets (Account-level roles, cross-account references, and enforcement path). TL;DR: In a Shared […]

The post AWS Shared VPC vs. Transit Gateways appeared first on AWS Security Architect.

]]>
 

AWS Shared VPCs as an Alternative to Transit Gateways

How Security Groups behave for resources in shared subnets (Account-level roles, cross-account references, and enforcement path).

TL;DR: In a Shared VPC, participant accounts place ENI-owning resources directly inside subnets owned by a host account. Security Groups remain stateful per-ENI and must be owned by the ENI’s account, but you can reference SGs across accounts via RAM for least-privilege, SG-to-SG allow rules. NACLs and routes stay host-managed.

Overview: Shared VPC vs. Transit Gateway

Aspect Shared VPC Transit Gateway
Purpose Centralize network & security for multiple accounts in a single VPC. Scalable hub-and-spoke to connect many VPCs/on-prem networks.
Use Case Multi-account workloads co-resident in common subnets. Large, multi-region or BU-isolated topologies.
Data Path Intra-VPC (no extra hops). Via TGW; additional hop.
Performance Lower latency (east-west). Slightly higher latency through TGW.
Cost No TGW processing fees. Attachment + data processing charges.
Management Host account owns VPC, subnets, routes, NACLs; shares via RAM. Each VPC independently attaches and maintains TGW route tables.
Security Boundary Common VPC fabric; SGs & NACLs enforce isolation. Each VPC has independent boundary; TGW governs interconnect.

How Shared VPCs Work

Host Account

  • Owns VPC, subnets, route tables, IGW/NAT, NACLs.
  • Shares subnets with participant accounts via AWS RAM.
  • Controls routing, NACL policy, logging (Flow Logs/GuardDuty).

Participant Accounts

  • Create EC2/ENIs into shared subnets.
  • Own ENIs and the SGs that attach to those ENIs.
  • May reference host/other SGs (if shared) for least-privilege rules.

Data Plane

  • Traffic stays inside the same VPC fabric.
  • East-west isolation: stateful SGs + stateless NACLs.
  • North-south governed by routes, IGW/NAT/Firewall.

Security Groups in Shared Subnets

1) Ownership Model

  • ENI owner = participant account.
  • SG attached to an ENI must be owned by the same account as the ENI.
  • Cross-account references to SGs are supported when shared via RAM.

2) Cross-Account SG References

Example: allow inbound from a host-owned SG to a participant SG.

aws ec2 authorize-security-group-ingress \
  --group-id sg- \
  --source-group sg-

Requirements: same Organization, SG shared via RAM, and the reference is within the same VPC context.

3) Enforcement Path

  • SGs (stateful): evaluated per ENI on both sides of a flow. Return traffic is auto-allowed.
  • NACLs (stateless): subnet-level allow/deny managed by the host account (both directions must be allowed).
  • Routes: host account controls egress/ingress reachability (e.g., to IGW, NAT, Firewall, endpoints).

4) Administrative Controls

Component Managed by Description
Security Groups Participant Each account defines SGs for its ENIs/instances.
SG Cross-References Host & Participant Allowed when SGs are shared via RAM; use SG-to-SG rules over CIDR.
NACLs Host Subnet-level stateless filters; participants cannot modify.
Routing Tables Host Controls north-south and inter-subnet reachability.
Flow Logs / GuardDuty Host Central visibility and threat detection across shared subnets.

Best Practices

  • Prefer SG-to-SG rules instead of broad CIDRs.
  • Enable VPC Flow Logs in the host account; aggregate to a central log account.
  • Use AWS Network Firewall or Gateway Load Balancer in the host account for inspection.
  • Combine with PrivateLink to expose services between participant workloads without IGW/NAT.
  • Use clear SG naming conventions indicating owning account and purpose.

Diagram: Network Flow & SG Enforcement (Shared VPC)

architecture diagram (PNG/SVG) showing Host Account, Participant Account, shared subnets, SGs on each ENI, NACLs (host-managed), and arrows for east-west (ENI↔ENI via SGs) and north-south flows (routes/IGW/NAT/Firewall).

shared VPC aws

© 2025 — Shared VPCs & Security Groups quick reference.

 

The post AWS Shared VPC vs. Transit Gateways appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/shared-vpcs/aws-shared-vpc-vs-transit-gateways/feed/ 0 377
API Gateway versus Transit Gateway https://awssecurityarchitect.com/aws-network-security/api-gateway-versus-transit-gateway/ https://awssecurityarchitect.com/aws-network-security/api-gateway-versus-transit-gateway/#respond Thu, 02 Oct 2025 16:36:21 +0000 https://awssecurityarchitect.com/?p=327     Transit Gateway vs API Gateway — and a Reference Architecture with NGINX Key Differences Aspect AWS Transit Gateway (TGW) API Gateway Primary purpose Network-level hub to connect VPCs, […]

The post API Gateway versus Transit Gateway appeared first on AWS Security Architect.

]]>
 

 

Transit Gateway vs API Gateway — and a Reference Architecture with NGINX

Key Differences

Aspect AWS Transit Gateway (TGW) API Gateway
Primary purpose Network-level hub to connect VPCs, on‑prem, SD‑WAN (L3 routing). Application/API front door to publish, secure, throttle, and monitor APIs (L7).
OSI layer Layer 3 (IP routing). Layer 7 (HTTP/HTTPS, WebSocket).
Traffic type Any IP traffic between networks/subnets. API requests/responses (REST/HTTP/WebSocket).
Controls Route tables, attachments, segmentation; relies on SGs/NACLs & firewalls for L4/L7. AuthN/Z (IAM, Cognito/JWT, Lambda authorizers), WAF, throttling, usage plans, transforms.
Typical use Hub‑and‑spoke between multiple VPCs and on‑prem; inter‑VPC segmentation. Expose internal/external APIs, per‑method policies, metering, dev portal.
Visibility/metrics VPC Flow Logs + TGW Flow Logs. Per‑route metrics, latency, errors, access logs.

Architecture Diagram

External APIs: Internet → WAF → API Gateway → (private integration via VPC Link) → ALB/NLB → NGINX → services.
Internal APIs: Internal clients → Corp Edge → Transit Gateway → (Internal VPC) → NGINX (internal) → services.

 

Security Policies

1) API Gateway (External)

  • Edge protections: WAF (OWASP, bot control, geo/IP blocks).
  • Auth: JWT (Cognito/OIDC), IAM SigV4, or Lambda authorizers.
  • Resource policies: Restrict by VPC Endpoint/CloudFront Distribution.
  • Threat controls: Throttling, quotas, usage plans, API keys.
  • Data protection: TLS 1.2+, request/response validation, payload limits, sensitive header redaction.
Example resource policy
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Deny",
    "Principal": "*",
    "Action": "execute-api:Invoke",
    "Resource": "arn:aws:execute-api:us-east-1:123456789012:abcde12345/*/*/*",
    "Condition": {
      "StringNotEquals": {
        "aws:SourceVpce": "vpce-0abc123def4567890",
        "aws:SourceArn": "arn:aws:cloudfront::123456789012:distribution/E123ABC456DEF"
      }
    }
  }]
}

2) NGINX (Reverse Proxy)

  • Transport: Enforce TLS; mTLS for service-to-service.
  • Identity: Validate JWT (OIDC) or client certs.
  • Access control: Path/host routing, IP allow/deny for admin paths, tenant scoping.
  • Rate limiting: Per IP/token; connection/request limits.
  • Hygiene: Header normalization, body size caps, method allowlists.
  • Observability: Structured logs, correlation IDs.
Example NGINX snippet
# mTLS
ssl_verify_client on;
ssl_client_certificate /etc/nginx/ca_bundle.pem;

# JWT validation (auth_jwt or OpenResty)
auth_jwt "closed api";
auth_jwt_key_file /etc/nginx/jwks.pem;

# Rate limiting
limit_req_zone $binary_remote_addr zone=api:10m rate=20r/s;
server {
  listen 443 ssl http2;
  server_name api.example.com;

  limit_req zone=api burst=40 nodelay;
  client_max_body_size 5m;

  location /service-a/ {
    proxy_set_header Authorization $http_authorization;
    proxy_pass http://svc-a:8080;
  }
}

3) Transit Gateway (L3)

  • Segmentation: Separate TGW route tables per environment/domain.
  • Least-route: Propagate/associate only where needed; deny east‑west by default.
  • Inspection: Force inter‑VPC traffic via an inspection VPC/NVA firewall.
  • Adjacencies: Complement with Security Groups/NACLs; use VPC endpoints for private API consumption.
  • Observability: TGW + VPC Flow Logs for anomalous inter‑VPC flows.

Layered Security Summary

  1. Edge: WAF + API Gateway throttling/authorizers.
  2. VPC: NGINX enforces mTLS/JWT, routing, rate limits.
  3. Network Hub: Transit Gateway confines routes, funnels inspection.
  4. Workloads: SG/NACL and app‑level authorization/validation.

 

The post API Gateway versus Transit Gateway appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/api-gateway-versus-transit-gateway/feed/ 0 327
Using Cloudflare and Palo Alto Together on AWS: Pros and Cons https://awssecurityarchitect.com/aws-network-security/using-cloudflare-and-palo-alto-together-on-aws-pros-and-cons/ https://awssecurityarchitect.com/aws-network-security/using-cloudflare-and-palo-alto-together-on-aws-pros-and-cons/#respond Fri, 06 Jun 2025 19:30:08 +0000 https://awssecurityarchitect.com/?p=321 Using Cloudflare and Palo Alto Together on AWS ✅ Potential Benefits (Why People Do This) Cloudflare: DDoS protection, WAF, CDN, TLS offload, bot protection — global edge network. Palo Alto […]

The post Using Cloudflare and Palo Alto Together on AWS: Pros and Cons appeared first on AWS Security Architect.

]]>
Using Cloudflare and Palo Alto Together on AWS

✅ Potential Benefits (Why People Do This)

  • Cloudflare: DDoS protection, WAF, CDN, TLS offload, bot protection — global edge network.
  • Palo Alto VM-Series: Layer 4-7 inspection, IPS/IDS, app-level policies, advanced logging, east-west traffic inspection within VPCs, integration with enterprise tooling.

⚠ Potential Downsides

1⃣ Latency and Performance

  • Cloudflare terminates TLS at edge, then re-encrypts to origin (your AWS app).
  • Introducing Palo Alto in-line can add latency and path complexity.
  • Improper design can cause hairpinning (traffic looping between VPCs/interfaces).

2⃣ Cost Overhead

  • Palo Alto VM-Series is costly — licensing, compute, bandwidth.
  • Running both Cloudflare and Palo Alto may duplicate features and increase total cost.

3⃣ Operational Complexity

  • Two security stacks mean two dashboards, two logging systems, two policy engines.
  • Increased burden on security and operations teams.
  • Clear ownership boundaries required (who manages Cloudflare vs Palo Alto?).

4⃣ Debugging Complexity

  • Failures may require debugging across multiple layers:
    • Cloudflare edge rules
    • Cloudflare WAF
    • Palo Alto firewall policies
    • AWS NACLs, Security Groups, ALB settings

5⃣ TLS / Encryption Conflicts

  • Careful design needed for TLS termination:
    • Cloudflare terminates TLS, then Palo Alto inspects plaintext? (often not desirable)
    • Cloudflare passes through TLS, Palo Alto inspects encrypted traffic (requires decryption licenses and proper configuration).
  • Improper handling can break mTLS or other sensitive integrations.

6⃣ Overlap in Features

  • Cloudflare Advanced WAF is powerful.
  • Palo Alto WAF/IPS may introduce redundant protection.
  • Requires careful coordination to avoid double blocking and false positives.

7⃣ Routing & Asymmetry

  • Improper architecture can cause asymmetric routing:
    • Inbound path through Cloudflare & Palo Alto.
    • Outbound path bypasses Palo Alto.
  • This can break stateful firewalling and cause unpredictable behavior.

Summary — When It Makes Sense vs Not

Situation Recommended Approach
Simple public web apps with Cloudflare Cloudflare alone often suffices
Complex apps needing deep inspection, East-West security Add Palo Alto, but plan architecture carefully
High traffic apps with latency sensitivity Be wary of inserting Palo Alto in-line unnecessarily
Highly regulated industries (finance, healthcare) Using both may be needed for compliance and reporting

✅ Recommendation: Simple Public Web Apps

For simple public web applications — marketing sites, basic informational apps, low-sensitivity data — Cloudflare alone typically provides sufficient protection:

  • Global DDoS protection
  • Advanced WAF and bot management
  • Global CDN and TLS termination
  • Minimal operational overhead

Adding Palo Alto in such scenarios may introduce unnecessary cost and complexity.

✅ Recommendation: Complex High-Traffic eCommerce Web Apps

For high-traffic eCommerce applications with sensitive data (PII, PCI), compliance needs, and fraud prevention requirements:

  • Use Cloudflare for edge security (DDoS, TLS, global CDN, bot mitigation).
  • Use Palo Alto VM-Series for:
    • Deep application inspection
    • Advanced IPS/IDS
    • East-West traffic security between microservices
    • Detailed logging and forensic analysis

For best performance, ensure traffic paths and TLS flows are carefully designed to avoid latency spikes and asymmetric routing.

Final Advice

  • Carefully design traffic path and TLS termination points.
  • Define clear responsibility boundaries between Cloudflare and Palo Alto management.
  • Monitor latency and debug complexity continuously.
  • Justify the cost of dual stack vs using either one effectively.

 

The post Using Cloudflare and Palo Alto Together on AWS: Pros and Cons appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/using-cloudflare-and-palo-alto-together-on-aws-pros-and-cons/feed/ 0 321
AWS DMZ Public and Private Subnets, Traffic to Internal VPC https://awssecurityarchitect.com/aws-network-security/dmz-public-and-private-subnets-traffic-to-internal-vpc/ https://awssecurityarchitect.com/aws-network-security/dmz-public-and-private-subnets-traffic-to-internal-vpc/#respond Fri, 30 May 2025 15:18:47 +0000 https://awssecurityarchitect.com/?p=314 Cloud DMZ Architecture Overview Yes, a DMZ (Demilitarized Zone) in the cloud can include both a public subnet and a private subnet. This configuration helps to separate internet-facing resources from […]

The post AWS DMZ Public and Private Subnets, Traffic to Internal VPC appeared first on AWS Security Architect.

]]>
Cloud DMZ Architecture Overview

Yes, a DMZ (Demilitarized Zone) in the cloud can include both a public subnet and a private subnet. This configuration helps to separate internet-facing resources from internal application layers that require added security.

DMZ Subnet Responsibilities

  • Public Subnet: Load balancers, web servers, bastion hosts. Directly accessible from the internet.
  • Private Subnet: Backend services like APIs, internal app servers, or firewalls. No direct internet access.

Traffic Flow

  1. User sends request to public IP on the DMZ Public Subnet (e.g., via a Load Balancer).
  2. Load Balancer forwards request to app servers in the DMZ Private Subnet.
  3. App servers in the DMZ Private Subnet may access internal services in the Internal VPC.

Network Diagram

Firewall Rules

Security groups – defined at VPC level – enforced at Instance Level

1. DMZ Public Subnet → DMZ Private Subnet

Type Protocol Port Range Source Description
HTTP TCP 80 sg-dmz-public Allow web traffic from public to private
HTTPS TCP 443 sg-dmz-public Allow secure traffic
Custom TCP TCP 8080 sg-dmz-public For custom app ports

2. DMZ Private Subnet → Internal VPC

Type Protocol Port Range Source Description
MySQL TCP 3306 sg-dmz-private Allow DB queries
HTTPS TCP 443 sg-dmz-private Access to internal APIs
Custom TCP TCP 8443 sg-dmz-private Optional app ports

Optional: NACL Rules

DMZ Private Subnet NACL

Rule # Type Protocol Port Range Source CIDR Allow/Deny
100 HTTP TCP 80 10.0.1.0/24 ALLOW
110 HTTPS TCP 443 10.0.1.0/24 ALLOW

Internal VPC Subnet NACL

Rule # Type Protocol Port Range Source CIDR Allow/Deny
100 MySQL TCP 3306 10.0.2.0/24 ALLOW
110 HTTPS TCP 443 10.0.2.0/24 ALLOW

 

The post AWS DMZ Public and Private Subnets, Traffic to Internal VPC appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-network-security/dmz-public-and-private-subnets-traffic-to-internal-vpc/feed/ 0 314