Skip to Content
Cloud Engineering Academy
2. AWS Networking & Infrastructure

Multi-account network architecture: a central network account for the whole bank

Design a bank's AWS network across many accounts: a central network account, shared VPCs with AWS RAM, a shared Transit Gateway, centralised egress, inspection and endpoints, IPAM pools, and guardrails that stop workload accounts building their own way to the internet.

advancedโฑ 1 h 50 min๐ŸŸข FreeSAA-C03SCS-C03SOA-C03

Assumes: .NET 10 LTS (file-based app, no AWS calls) ยท AWS CLI v2 ยท Terraform AWS provider v6 ยท AWS Organizations, AWS RAM, Amazon VPC IPAM ยท Region us-east-1. Verified against official sources on 2026-11-18.

Learning objectives

By the end of this lesson you can:

  • Explain why banks run networking from a central network account and what stays in workload accounts.
  • Share subnets with VPC sharing (AWS RAM) and state exactly what the owner and the participants can and cannot do.
  • Combine a shared Transit Gateway, centralised egress, a central inspection VPC and centralised interface endpoints into one design, and know when each is worth it.
  • Allocate address space from IPAM pools so overlapping CIDRs become impossible rather than unlikely.
  • Write guardrails โ€” service control policies, VPC Block Public Access, Network Access Analyzer โ€” so workload accounts cannot create their own internet paths.
  • Validate a landing-zone network configuration in C# before anything is deployed.

Prerequisites

Why this matters in banking

Banks use many AWS accounts โ€” one per workload per environment is common โ€” because an account is the strongest isolation boundary AWS offers: separate IAM, separate quotas, separate billing, separate blast radius. Harbourline has 40 accounts today and expects 150 within three years.

If every account team builds its own network, you get what Harbourline had in its first year: overlapping CIDRs, a dozen NAT gateways each with its own egress policy (or none), peering connections nobody approved, interface endpoints duplicated in every VPC, and no single answer to "what can reach the core banking network?". Security reviews took weeks because each design was different.

The fix is organisational as much as technical: a network team owns a network account (sometimes several: hub, inspection, DNS) and offers connectivity as a product. Workload teams get subnets that are already connected, inspected and logged, and guardrails make it impossible to build around them.

The idea in plain language

Think of the AWS Organization as a city:

  • The network account is the city's utility company. It owns the roads (Transit Gateway), the city gates (egress and ingress), the checkpoints (inspection), the telephone exchange (DNS) and the land registry (IPAM).
  • Workload accounts are businesses. They rent plots (shared subnets) or build their own buildings connected to the city roads (VPC attachments). They decide what happens inside their buildings (security groups, instances, databases), but they can't build their own road out of the city.
  • Guardrails are planning law: no matter what a business wants, it can't build a private road to the motorway (SCP denying internet gateways), and inspectors (Network Access Analyzer) check regularly.

Analogy: Azure folks will recognise this as the Azure Landing Zone "connectivity subscription" with hub-and-spoke or Virtual WAN, plus Azure Policy to stop spokes creating public IPs. The AWS pieces are different products, but the operating model is the same.

What problem the AWS services solve

Service / featureRole in the designNotes and limits
AWS Organizations + OUsAccount structure; where guardrails attachSCPs restrict what IAM can do in member accounts; they don't grant anything
AWS RAMShares subnets, Transit Gateways, Resolver rules, IPAM pools, prefix lists, Network Firewall policies with accounts or OUsSharing within the Organization can be enabled without invitations
VPC sharingSeveral accounts deploy into subnets of one VPC owned by the network accountSame Region; owner manages VPC, subnets, route tables, NACLs, gateways; participants manage their own resources and security groups
Transit Gateway (shared)Connects VPCs from every account and on-premisesAttachments created by workload accounts, accepted and associated by the network account
Centralised egress VPCOne set of NAT gateways (and firewall) for the whole RegionSaves NAT cost, centralises egress policy; adds TGW processing cost
Inspection VPCNetwork Firewall for north-south and east-west trafficNeeds appliance mode on its TGW attachment
Centralised interface endpointsEndpoints in a shared-services VPC used by all spokesRequires DNS design (private hosted zones associated with spokes)
Amazon VPC IPAMPools of address space per Region/environment; accounts allocate VPC CIDRs from poolsAdvanced Tier billed per active IP; pools shared via RAM
SCPsDeny internet gateways, peering, VPN, public IPs, flow-log deletion outside the network teamTest carefully; SCPs apply to everyone in the account except the management account
VPC Block Public AccessAccount-level switch that blocks internet ingress/egress through IGWsExclusions for approved VPCs/subnets
Network Access AnalyzerProves no unintended paths exist (e.g. IGW โ†’ data tier)Per-ENI pricing
AWS Control Tower / Landing Zone AcceleratorAutomate the baseline for new accountsLZA on AWS has a network configuration file describing all of this โš  VERIFY current feature set

Microsoft / Azure comparison

You know (Microsoft/Azure)AWS equivalentWhat's different
Management groups + subscriptionsOrganizations OUs + accountsAWS accounts are harder isolation boundaries than subscriptions
Connectivity subscription (ALZ)Network account (hub)Same idea
Hub VNet / Virtual WAN hubTransit Gateway (+ inspection VPC) / Cloud WANTGW is a managed router, shared via RAM
Spoke VNets peered to hubSpoke VPCs attached to TGW, or shared subnets in a central VPCVPC sharing has no direct Azure equivalent: many subscriptions deploying into one VNet's subnets
Azure Policy deny public IP / deny route to InternetSCPs + VPC Block Public Access + declarative policiesSCPs block API calls; BPA blocks traffic
Azure Firewall in the hubNetwork Firewall in an inspection VPCAppliance mode on the attachment for symmetry
Private DNS zones linked to spokesRoute 53 private hosted zones associated with spoke VPCs (cross-account) + Resolver rules shared via RAMCross-account association needs an authorisation step
AVNM IPAM / Azure IPAMAmazon VPC IPAM pools shared with RAMAllocation rules enforce size and tags

Architecture

Harbourline's landing zone network

Harbourline uses both connection models on purpose:

  • Prod workload accounts own their VPCs (CIDRs allocated from IPAM) and attach them to the shared Transit Gateway. Each prod team controls its own route tables inside its VPC, under guardrails, and gets the strongest isolation.
  • Non-prod accounts get subnets shared from network-owned VPCs. Many small dev/test accounts share one dev VPC and one test VPC: fewer TGW attachments, fewer NAT gateways, no IP planning per team.

VPC sharing: who controls what

ActionOwner (network account)Participant (workload account)
Create/modify VPC, subnets, route tables, NACLs, gateways, endpointsYesNo
Launch resources (EC2, ECS tasks, RDS, Lambda ENIs, ALBs) in shared subnetsYesYes
Create security groups in the shared VPCYesYes (their own)
Modify another account's resources or security groupsNoNo
See other participants' resourcesOwner sees ENIs in its subnets; not the resources themselvesNo
Pays forVPC-level items such as NAT gateway hours, VPC endpoints, TGW attachment โš  VERIFY exact splitTheir own resources and their data transfer โš  VERIFY

Constraints worth knowing: sharing works within the same Organization (with sharing enabled in RAM), in the same Region; you cannot share subnets of a default VPC; participants cannot use the owner's default security group โš  VERIFY current rules for cross-account security-group referencing in shared VPCs.

Centralised egress and inspection

One firewall policy, one set of NAT gateways (one per AZ), one place for egress logs. Spokes have no internet gateway and no NAT. Details of routing and symmetry are in AWS Network Firewall.

Centralised interface endpoints

Instead of seven endpoints ร— three AZs in each of 100 VPCs (2,100 endpoint-AZs, about USD 15,000 a month), put each endpoint once in the shared-services VPC with private DNS disabled, create a Route 53 private hosted zone per service name (for example secretsmanager.us-east-1.amazonaws.com) with an alias to the endpoint, and associate those zones with every spoke VPC. Spokes reach the endpoints over the Transit Gateway. Trade-offs: TGW processing charges on endpoint traffic, and endpoint policies become shared โ€” use aws:PrincipalOrgID/aws:ResourceOrgID conditions.

Guardrails

Service control policy: no do-it-yourself internet paths

scp-network-guardrails.json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyInternetPathsExceptNetworkTeam",
      "Effect": "Deny",
      "Action": [
        "ec2:CreateInternetGateway",
        "ec2:AttachInternetGateway",
        "ec2:CreateEgressOnlyInternetGateway",
        "ec2:CreateNatGateway",
        "ec2:CreateVpcPeeringConnection",
        "ec2:AcceptVpcPeeringConnection",
        "ec2:CreateVpnGateway",
        "ec2:CreateCustomerGateway",
        "ec2:CreateVpnConnection",
        "ec2:CreateTransitGateway",
        "directconnect:*",
        "globalaccelerator:Create*"
      ],
      "Resource": "*",
      "Condition": {
        "ArnNotLike": { "aws:PrincipalArn": "arn:aws:iam::*:role/hl-network-pipeline" }
      }
    },
    {
      "Sid": "DenyTurningOffEvidence",
      "Effect": "Deny",
      "Action": [
        "ec2:DeleteFlowLogs",
        "ec2:ModifyVpcBlockPublicAccessOptions",
        "ec2:DeleteVpcBlockPublicAccessExclusion",
        "ec2:CreateVpcBlockPublicAccessExclusion"
      ],
      "Resource": "*",
      "Condition": {
        "ArnNotLike": { "aws:PrincipalArn": "arn:aws:iam::*:role/hl-network-pipeline" }
      }
    },
    {
      "Sid": "NoPublicIpOnInstanceLaunch",
      "Effect": "Deny",
      "Action": "ec2:RunInstances",
      "Resource": "arn:aws:ec2:*:*:network-interface/*",
      "Condition": { "Bool": { "ec2:AssociatePublicIpAddress": "true" } }
    }
  ]
}

Attach it to the Workloads OUs, not to the Infrastructure OU. Notes:

  • SCPs restrict every principal in member accounts, including administrators โ€” but not the management account and not service-linked roles.
  • The exception uses a role name pattern; protect that role's trust policy so only the network pipeline can assume it.
  • Action names and condition keys should be validated in a sandbox OU first โš  VERIFY each action against the Service Authorization Reference before production.
  • Pair the SCP with VPC Block Public Access set in each account (or via an Organizations declarative policy โš  VERIFY availability), so traffic is blocked even if an IGW somehow exists.

Detective controls

  • Network Access Analyzer scope in the security tooling account: "any path from an internet gateway to any ENI in a subnet tagged Tier=data" โ€” expected findings: none.
  • AWS Config rules: vpc-flow-logs-enabled, restricted-ssh, ec2-instance-no-public-ip, subnet-auto-assign-public-ip-disabled โš  VERIFY managed rule names.
  • CloudTrail alarms on TGW route-table changes, RAM share changes and SCP changes.

Step-by-step implementation

1. Create the Infrastructure OU and network account

Create the network account through your account vending process (Control Tower Account Factory or your own pipeline). Restrict human access; changes flow through the network pipeline role.

2. Enable RAM sharing with the Organization

In the management account: aws ram enable-sharing-with-aws-organization. Shares to OUs then need no invitations.

3. Build IPAM

Delegate IPAM administration to the network account, create a top-level pool 10.16.0.0/12, Regional pool for us-east-1, and environment pools (prod 10.17.0.0/16โ€“10.18.0.0/16, non-prod 10.19.0.0/16โ€“10.20.0.0/16) with allocation rules (for example, minimum /20, maximum /16, required tags). Share the pools with the relevant OUs.

4. Build the hub

Transit Gateway with defaults off and auto-accept off, shared with the Workloads OUs; inspection/egress VPC with Network Firewall and NAT; shared-services VPC with interface endpoints and Resolver endpoints; DX gateway and VPN.

5. Offer two connection products

  • Shared subnets (non-prod): the network team creates the VPC and shares subnet groups to accounts via RAM.
  • Attached VPC (prod): the workload pipeline creates a VPC with a CIDR from IPAM and a TGW attachment; the network pipeline accepts it, associates and propagates per segment.

6. Apply guardrails, then detect

Attach the SCP to Workloads OUs, enable VPC BPA, deploy Config rules, and schedule Network Access Analyzer.

7. Validate configuration as code

Keep the whole network design in a configuration file in Git and validate it in CI (the C# validator below) before any deployment.

AWS Console instructions

  • RAM: Console โ†’ Resource Access Manager โ†’ Settings โ†’ Enable sharing with AWS Organizations (management account). Create resource share โ†’ resource type Subnets (or Transit gateways, Resolver rules, IPAM pools) โ†’ principals: OU ARN.
  • Shared subnets in a participant account: Console โ†’ VPC โ†’ Subnets shows the shared subnets with the owner's account ID; launch resources normally.
  • IPAM: Console โ†’ IPAM โ†’ Create IPAM โ†’ operating Regions โ†’ Pools โ†’ Create pool (top-level, Regional, environment) โ†’ Allocation rule settings.
  • SCPs: Console โ†’ AWS Organizations โ†’ Policies โ†’ Service control policies โ†’ Create policy โ†’ attach to OU.
  • Network Access Analyzer: Console โ†’ VPC โ†’ Network Access Analyzer โ†’ Create Network Access Scope.

AWS CLI

# Run in the network account unless noted. Read-only commands are safe in any sandbox.
$p = '--profile', 'learn-sandbox', '--region', 'us-east-1'

# (Management account) allow RAM shares within the Organization
aws ram enable-sharing-with-aws-organization --profile management

# Share two subnets with the non-prod OU
aws ram create-resource-share @p --name hl-dev-shared-subnets `
  --resource-arns arn:aws:ec2:us-east-1:111122223333:subnet/subnet-0devapp000000000a arn:aws:ec2:us-east-1:111122223333:subnet/subnet-0devapp000000000b `
  --principals arn:aws:organizations::999988887777:ou/o-exampleorgid/ou-nonp-11111111 `
  --no-allow-external-principals --tags key=Project,value=cea-lab key=Lab,value=m02-l16

# What is shared, and with whom?
aws ram list-resources @p --resource-owner SELF --query "resources[].{Type:type,Arn:arn,Share:resourceShareArn}"
aws ram get-resource-share-associations @p --association-type PRINCIPAL --query "resourceShareAssociations[].{Share:resourceShareName,Principal:associatedEntity,Status:status}"

# IPAM: allocate a /16 for a new prod VPC from the prod pool (the workload pipeline does this)
aws ec2 allocate-ipam-pool-cidr @p --ipam-pool-id ipam-pool-0prod000000000000 --netmask-length 16 --description "hl-cards-prod"

# Or create the VPC directly from the pool - no CIDR typed by a human
aws ec2 create-vpc @p --ipv4-ipam-pool-id ipam-pool-0prod000000000000 --ipv4-netmask-length 16 `
  --tag-specifications "ResourceType=vpc,Tags=[{Key=Name,Value=hl-cards-prod},{Key=Project,Value=cea-lab}]"

# (Management account) create and attach the SCP to the Workloads OU
aws organizations create-policy --profile management --type SERVICE_CONTROL_POLICY --name hl-network-guardrails `
  --description "No DIY internet paths in workload accounts" --content file://scp-network-guardrails.json
aws organizations attach-policy --profile management --policy-id p-examplepolicy --target-id ou-work-22222222

Infrastructure as Code

network-account/sharing.tf
# Transit Gateway shared with the Workloads OU; attachments must be accepted by the network team.
resource "aws_ram_resource_share" "tgw" {
  name                      = "hl-tgw"
  allow_external_principals = false
}

resource "aws_ram_resource_association" "tgw" {
  resource_arn       = aws_ec2_transit_gateway.hub.arn
  resource_share_arn = aws_ram_resource_share.tgw.arn
}

resource "aws_ram_principal_association" "tgw_workloads" {
  principal          = var.workloads_ou_arn
  resource_share_arn = aws_ram_resource_share.tgw.arn
}

# Non-prod shared VPC: subnets shared with the non-prod OU
resource "aws_ram_resource_share" "dev_subnets" {
  name                      = "hl-dev-shared-subnets"
  allow_external_principals = false
}

resource "aws_ram_resource_association" "dev_subnets" {
  for_each           = { for k, s in aws_subnet.dev : k => s if s.tags["Tier"] != "public" }
  resource_arn       = each.value.arn
  resource_share_arn = aws_ram_resource_share.dev_subnets.arn
}

resource "aws_ram_principal_association" "dev_nonprod_ou" {
  principal          = var.nonprod_ou_arn
  resource_share_arn = aws_ram_resource_share.dev_subnets.arn
}

# IPAM with a top-level AWS pool, a Regional pool and a prod pool with allocation rules
resource "aws_vpc_ipam" "main" {
  operating_regions {
    region_name = "us-east-1"
  }
}

resource "aws_vpc_ipam_pool" "aws_top" {
  address_family = "ipv4"
  ipam_scope_id  = aws_vpc_ipam.main.private_default_scope_id
  description    = "All of Harbourline AWS"
}

resource "aws_vpc_ipam_pool_cidr" "aws_top" {
  ipam_pool_id = aws_vpc_ipam_pool.aws_top.id
  cidr         = "10.16.0.0/12"
}

resource "aws_vpc_ipam_pool" "use1_prod" {
  address_family                    = "ipv4"
  ipam_scope_id                     = aws_vpc_ipam.main.private_default_scope_id
  source_ipam_pool_id               = aws_vpc_ipam_pool.aws_top.id
  locale                            = "us-east-1"
  allocation_min_netmask_length     = 16
  allocation_max_netmask_length     = 20
  allocation_resource_tags          = { Environment = "prod" }
  auto_import                       = false
  description                       = "us-east-1 prod VPCs"
}

resource "aws_vpc_ipam_pool_cidr" "use1_prod" {
  ipam_pool_id = aws_vpc_ipam_pool.use1_prod.id
  cidr         = "10.17.0.0/16"
}

# Workload side (in the workload account's own stack): VPC CIDR comes from the shared pool
# resource "aws_vpc" "this" {
#   ipv4_ipam_pool_id   = var.prod_pool_id
#   ipv4_netmask_length = 16
# }

Complete code

Landing-zone tools describe the network as a configuration file. Harbourline validates that file in CI with a small .NET 10 file-based app before anything is deployed: every VPC CIDR must be inside the AWS supernet and inside its environment's range, no two VPCs may overlap, every prod VPC must attach to the Transit Gateway in a prod segment, no non-prod account may be in a prod segment, and no VPC may declare its own internet gateway unless it is the egress VPC.

network-config.json
{
  "awsSupernet": "10.16.0.0/12",
  "environments": {
    "prod": ["10.17.0.0/16", "10.18.0.0/16"],
    "nonprod": ["10.19.0.0/16", "10.20.0.0/16"],
    "shared": ["10.16.0.0/16"]
  },
  "vpcs": [
    { "name": "hub-egress",   "account": "network",       "env": "shared",  "cidr": "10.16.0.0/18",  "segment": "shared",  "internetGateway": true },
    { "name": "shared-svc",   "account": "network",       "env": "shared",  "cidr": "10.16.64.0/18", "segment": "shared",  "internetGateway": false },
    { "name": "payments-prd", "account": "payments-prod", "env": "prod",    "cidr": "10.17.0.0/16",  "segment": "prod",    "internetGateway": false },
    { "name": "accounts-prd", "account": "accounts-prod", "env": "prod",    "cidr": "10.18.0.0/16",  "segment": "prod",    "internetGateway": false },
    { "name": "test-shared",  "account": "network",       "env": "nonprod", "cidr": "10.19.0.0/16",  "segment": "nonprod", "internetGateway": false, "sharedWith": ["ou-nonprod"] },
    { "name": "dev-shared",   "account": "network",       "env": "nonprod", "cidr": "10.20.0.0/16",  "segment": "nonprod", "internetGateway": false, "sharedWith": ["ou-nonprod"] }
  ]
}
lzcheck.cs
using System.Net;
using System.Text.Json;

// Usage: dotnet run lzcheck.cs -- network-config.json
// Exit code 0 = valid, 3 = rule violations, 1 = unreadable input.
if (args.Length != 1 || !File.Exists(args[0]))
{
    Console.Error.WriteLine("Usage: dotnet run lzcheck.cs -- <network-config.json>");
    return 1;
}

var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
var config = JsonSerializer.Deserialize<NetworkConfig>(File.ReadAllText(args[0]), options);
if (config is null)
{
    Console.Error.WriteLine("Empty configuration.");
    return 1;
}

var errors = new List<string>();
var supernet = Cidr.Parse(config.AwsSupernet);

foreach (var vpc in config.Vpcs)
{
    var cidr = Cidr.Parse(vpc.Cidr);

    if (!supernet.Contains(cidr))
    {
        errors.Add($"{vpc.Name}: {vpc.Cidr} is outside the AWS supernet {config.AwsSupernet}");
    }

    if (!config.Environments.TryGetValue(vpc.Env, out var envRanges))
    {
        errors.Add($"{vpc.Name}: unknown environment '{vpc.Env}'");
    }
    else if (!envRanges.Any(r => Cidr.Parse(r).Contains(cidr)))
    {
        errors.Add($"{vpc.Name}: {vpc.Cidr} is outside the {vpc.Env} ranges {string.Join(", ", envRanges)}");
    }

    if (vpc.Env == "prod" && vpc.Segment != "prod")
    {
        errors.Add($"{vpc.Name}: prod VPCs must be in the prod segment (found '{vpc.Segment}')");
    }

    if (vpc.Env != "prod" && vpc.Segment == "prod")
    {
        errors.Add($"{vpc.Name}: a {vpc.Env} VPC must never join the prod segment");
    }

    if (vpc.InternetGateway && vpc.Name != "hub-egress")
    {
        errors.Add($"{vpc.Name}: only the hub-egress VPC may have an internet gateway");
    }

    if (vpc.SharedWith is { Count: > 0 } && vpc.Account != "network")
    {
        errors.Add($"{vpc.Name}: only the network account may share subnets (owner is '{vpc.Account}')");
    }
}

// Pairwise overlap check: overlapping VPCs can't be routed through one Transit Gateway.
for (var i = 0; i < config.Vpcs.Count; i++)
{
    for (var j = i + 1; j < config.Vpcs.Count; j++)
    {
        var a = config.Vpcs[i];
        var b = config.Vpcs[j];
        if (Cidr.Parse(a.Cidr).Overlaps(Cidr.Parse(b.Cidr)))
        {
            errors.Add($"{a.Name} {a.Cidr} overlaps {b.Name} {b.Cidr}");
        }
    }
}

foreach (var e in errors)
{
    Console.WriteLine("ERROR " + e);
}

Console.WriteLine(errors.Count == 0
    ? $"OK: {config.Vpcs.Count} VPCs, no overlaps, segments and internet paths follow policy."
    : $"{errors.Count} violation(s).");
return errors.Count == 0 ? 0 : 3;

record NetworkConfig(string AwsSupernet, Dictionary<string, List<string>> Environments, List<VpcConfig> Vpcs);

record VpcConfig(string Name, string Account, string Env, string Cidr, string Segment, bool InternetGateway, List<string>? SharedWith);

readonly record struct Cidr(uint Network, int Length)
{
    public static Cidr Parse(string text)
    {
        var parts = text.Split('/');
        var bytes = IPAddress.Parse(parts[0]).GetAddressBytes();
        var length = int.Parse(parts[1]);
        var value = (uint)(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3]);
        if ((value & ~Mask(length)) != 0)
        {
            throw new FormatException($"{text} has host bits set");
        }

        return new Cidr(value, length);
    }

    public bool Contains(Cidr other) => other.Length >= Length && (other.Network & Mask(Length)) == Network;

    public bool Overlaps(Cidr other) => Contains(other) || other.Contains(this);

    private static uint Mask(int length) => length == 0 ? 0u : uint.MaxValue << (32 - length);
}

Expected output for the file above:

OK: 6 VPCs, no overlaps, segments and internet paths follow policy.

Change dev-shared to "segment": "prod" and "cidr": "10.18.128.0/17" and you get three errors: outside the non-prod range, non-prod in prod segment, and an overlap with accounts-prd.

Code explained line by line

  1. The JSON file is the network design as data: environments map to address ranges, and each VPC states its owner account, environment, CIDR, Transit Gateway segment, whether it has an internet gateway and whether its subnets are shared.
  2. JsonSerializer.Deserialize<NetworkConfig> with case-insensitive names maps camelCase JSON to C# records.
  3. supernet.Contains(cidr) โ€” every VPC must sit inside 10.16.0.0/12, so the data centres can use one summarised route to AWS.
  4. The environment check ties CIDRs to environments (each environment owns a list of aligned /16s from the IP plan), which makes a mis-tagged VPC visible (and lets firewall rules use the environment range).
  5. The segment rules encode the most important policy in the bank: prod is only in prod, and non-prod never joins prod.
  6. The internet-gateway rule enforces centralised egress: only hub-egress may have an IGW. The SCP enforces the same rule at runtime; the validator catches it at design time.
  7. The sharing rule: only the network account may own shared VPCs.
  8. The pairwise overlap loop is O(nยฒ), fine for hundreds of VPCs; IPAM prevents overlaps in production, and this catches mistakes in the plan before IPAM is asked.
  9. Cidr.Parse rejects host bits (10.20.1.0/16 is an error, not silently 10.20.0.0/16).
  10. Exit code 3 on violations fails the CI job, so a bad plan never reaches terraform apply.

Security considerations

โš  Learning shortcut โ€” not for production

This lesson's SCP exempts one role by name pattern across all accounts (arn:aws:iam::*:role/hl-network-pipeline). In production, also restrict who can create a role with that name (otherwise any account admin could create it and bypass the guardrail): deny iam:CreateRole/iam:UpdateAssumeRolePolicy on that role name outside the network account, or use aws:PrincipalAccount to pin the exception to the network account.

  • Separation of duties: the network team cannot deploy workloads; workload teams cannot change routing. Both need security-team approval for guardrail changes.
  • Blast radius of the hub: the network account is critical infrastructure. Restrict human access (break-glass only), require MFA, enable delete protection on firewalls, and keep routing changes in reviewed pipelines.
  • Shared VPC visibility: participants can't see each other's resources, but they share NACLs and route tables owned by the network account. Use security groups for per-team isolation and separate subnets for teams that need it.
  • Logging: flow logs from every VPC and TGW, firewall logs and DNS query logs go to the log archive account; SCP denies ec2:DeleteFlowLogs outside the network pipeline.
  • Data residency: sharing and routing are Regional; cross-Region TGW peering should be explicit and reviewed for GDPR / UK GDPR transfer implications by the data-protection officer.

Banking use case

Onboarding a new Cards workload at Harbourline takes one pull request:

  1. The workload team adds a VPC entry to network-config.json (env: prod, segment: cde), CI runs lzcheck.cs and the TGW simulator.
  2. The account vending pipeline creates the account in the Prod/CDE OU, which carries the network guardrail SCP and a stricter CDE SCP.
  3. The workload pipeline creates the VPC from the prod IPAM pool (no CIDR typed), with flow logs to the log archive and a TGW attachment.
  4. The network pipeline accepts the attachment, associates it with rt-cde, propagates it into rt-shared and rt-inspection, and adds the Cards egress allow-list to Network Firewall.
  5. The security tooling account's Network Access Analyzer scope runs and reports no internet paths into the CDE.

Lead time went from three weeks of tickets to under a day, and every step leaves evidence. Whether CDE segmentation satisfies PCI DSS scoping is for the QSA to confirm.

Common mistakes

  • Every account builds its own NAT and IGW "just for now". The SCP is easier to apply on day one than on day 300.
  • Overlapping CIDRs between accounts because each team picked 10.0.0.0/16. Use IPAM from the start.
  • Sharing subnets but expecting participants to edit route tables. They can't โ€” design for that.
  • Auto-accept on shared TGW attachments, letting any account join any segment.
  • An SCP exception any account can satisfy (see the callout).
  • Centralising interface endpoints without DNS planning โ†’ spokes still resolve public IPs.
  • Forgetting the management account: SCPs don't apply to it, so don't run workloads there.

Troubleshooting

SymptomLikely causeFix
Participant can't see shared subnetsRAM sharing with Organizations not enabled, or share targets the wrong OUEnable sharing in the management account; check principal associations
Participant gets UnauthorizedOperation on CreateRouteTableExpected โ€” owner controls routingAsk the network team; route tables belong to the owner
AccessDenied creating a NAT gateway in a workload accountNetwork guardrail SCPUse centralised egress, or request a reviewed exception
New prod VPC can't reach shared servicesTGW attachment pending acceptance or not associated/propagatedNetwork pipeline accepts and associates; run the TGW simulator
allocate-ipam-pool-cidr failsAllocation rules (netmask, tags) not met, or pool exhaustedCheck pool rules; request a larger pool
Spokes resolve public IPs for centralised endpointsPrivate hosted zones not associated with spoke VPCsAssociate the zones (cross-account authorisation)
SCP blocks the network pipelineException condition doesn't match the role ARNCheck aws:PrincipalArn pattern; test in a sandbox OU

Cost and cleanup

This lesson is free: the validator runs locally and nothing is deployed. Indicative costs for the design (us-east-1, checked 2026-11-18 unless marked):

  • Transit Gateway: USD 0.05 per attachment-hour + USD 0.02 per GB. 40 VPC attachments โ‰ˆ USD 1,460/month before data.
  • Centralised NAT: 3 NAT gateways (one per AZ) โ‰ˆ 3 ร— 0.045 ร— 730 = USD 98.55/month + USD 0.045/GB โ€” instead of NAT gateways in each of 40 VPCs (โ‰ˆ USD 3,940/month in hours alone). TGW processing on egress traffic offsets part of the saving.
  • Network Firewall (3 AZs): โ‰ˆ USD 865/month + USD 0.065/GB, with NAT hours waived (see AWS Network Firewall).
  • Centralised interface endpoints: 7 services ร— 3 AZs โ‰ˆ USD 153/month once, instead of per VPC โš  VERIFY endpoint rate.
  • IPAM Advanced Tier: USD 0.00027 per active IP per hour (from the VPC pricing page) โ€” 20,000 active IPs โ‰ˆ USD 3,942/month; the free tier covers single-account use.
  • VPC sharing and RAM: no charge for sharing itself.

Optional free exercise: if you have two sandbox accounts in an Organization with RAM sharing enabled, share a subnet of a lab VPC from one to the other and launch nothing (sharing costs nothing). Clean up with aws ram delete-resource-share --resource-share-arn โ€ฆ and confirm with aws ram get-resource-shares --resource-owner SELF.

Exercises

  • ๐ŸŸข Guided: Run lzcheck.cs on the sample file. Then add a cards-prd VPC (10.17.128.0/17) and explain the error you get; fix it by choosing a non-overlapping range inside the prod environment.
  • ๐ŸŸก Challenge: Extend lzcheck.cs with two rules: every VPC must have a segment that exists in a new segments list, and no VPC smaller than /20 may be attached to the Transit Gateway (wasteful attachments). Add test cases as extra JSON files.
  • ๐Ÿ”ด Live problem: A developer in a dev account (participant in the shared dev VPC) complains: "I can't create a NAT gateway, I can't add a route, and my Lambda can't call a partner API on the internet โ€” your network is broken." Write the response: what's working as designed, what the supported path for partner calls is, and what you'd change (if anything).

Assignment

Produce a one-page network operating model for Harbourline: what the network team offers (products), what workload teams own, the guardrails (SCP excerpt, BPA, detective controls), how onboarding works, and the monthly cost of the hub. Commit network-config.json, lzcheck.cs and the SCP to your portfolio repository.

Solutions

Knowledge check

Interview questions

  • "How would you structure networking for 100 AWS accounts in a bank?" โ€” Central network account with a shared TGW (defaults off), segments per environment and CDE, centralised egress and inspection, shared-services VPC for endpoints and DNS, IPAM pools, SCP guardrails and BPA, detective checks, and connectivity offered as products through pipelines.
  • "VPC sharing or one VPC per account?" โ€” Sharing for many small or similar workloads (cost, simplicity); separate VPCs where teams need control or strong isolation. Many estates use both.
  • "How do you stop someone creating an internet gateway?" โ€” SCP deny on the relevant ec2: actions outside the network pipeline role, VPC BPA as a traffic-level backstop, Config/Network Access Analyzer to detect.
  • "What are the cost trade-offs of centralised egress?" โ€” Fewer NAT gateways and firewalls, but TGW attachment-hours and per-GB processing on all egress traffic; it usually wins at scale and always wins on governance.

Certification practice

Completion checklist

  • I can explain the network account's role and what workload accounts own
  • I know what VPC sharing participants can and cannot do
  • I can draw centralised egress, inspection and endpoints on a shared Transit Gateway
  • I can explain the network guardrail SCP and its exception risk
  • I ran lzcheck.cs and extended it

Key takeaways

  • Networking in a bank is a central product: one network account, shared TGW, central egress, inspection, endpoints and DNS.
  • VPC sharing gives participants subnets without routing control; attached VPCs give teams control under guardrails โ€” use both deliberately.
  • IPAM turns "don't overlap" from a hope into a rule.
  • Guardrails are layered: SCPs prevent, BPA blocks traffic, Network Access Analyzer and Config detect.
  • Keep the network design in Git and validate it before deployment.

Further reading

Next steps: prove isolation end to end in the secure VPC lab, then review the whole module on the module overview.

Independent learning resource โ€” not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.

On this page