{"id":1129,"date":"2026-11-03T17:29:28","date_gmt":"2026-11-03T17:29:28","guid":{"rendered":"https:\/\/www.vps.tc\/blog\/?p=1129"},"modified":"2026-11-03T09:29:17","modified_gmt":"2026-11-03T09:29:17","slug":"what-is-a-vpc-isolated-cloud-network","status":"publish","type":"post","link":"https:\/\/www.vps.tc\/blog\/en\/what-is-a-vpc-isolated-cloud-network\/","title":{"rendered":"What Is a VPC? Subnets, Routing, and Network Isolation"},"content":{"rendered":"<div class=\"aiw-summary\" id=\"aiw-ozet\">\n<p class=\"aiw-summary-title\">Quick Summary &#8211; VPCs and Network Isolation<\/p>\n<p>A VPC is a logically separated virtual network for cloud resources; it does not mean dedicated physical servers or traffic encryption. Address planning, routing, security rules, and administrative permissions jointly determine isolation.<\/p>\n<ul>\n<li><strong>Region and placement<\/strong> \u2014 An AWS VPC is regional; each subnet resides in a single Availability Zone.<\/li>\n<li><strong>Private address plan<\/strong> \u2014 The hypothetical lab allocates three \/24 subnets within 10.20.0.0\/16, each providing 251 usable IPv4 addresses after AWS reservations.<\/li>\n<li><strong>Routes define separation<\/strong> \u2014 Public-egress has a default route to an Internet Gateway, private-app routes through a NAT Gateway, and isolated-data has only the VPC-local route.<\/li>\n<li><strong>Access between tiers<\/strong> \u2014 Inbound TCP 5432 on the data tier is allowed only from the application security group; the application&#039;s TCP 8080 port is not exposed to the internet.<\/li>\n<li><strong>Verified access boundaries<\/strong> \u2014 A connectivity matrix tests application access to the data tier and internet, plus blocked access from the internet to private instances and from the data tier to the internet.<\/li>\n<li><strong>Billable resource checks<\/strong> \u2014 When closing the lab, check EC2, NAT Gateway, Elastic IP, and any enabled logging or analysis resources separately.<\/li>\n<\/ul>\n<\/div>\n<p class=\"aiw-lead\">Two servers cannot reach each other merely because they share a cloud provider. A VPC is a logically separated virtual network where resources use private addresses. Building an isolated cloud network requires nonoverlapping CIDR blocks, separate subnet routes, and security rules that restrict access; a VPC alone provides neither encryption nor physical hardware separation.<\/p>\n<div class=\"aiw-toc\" style=\"border:1px solid #dbe3ea;border-radius:8px;padding:16px 20px;margin:0 0 28px\">\n<p class=\"aiw-toc-head\"><strong>Table of Contents<\/strong><span class=\"aiw-toc-meta\"> \u00b7 18 min read<\/span><\/p>\n<ol style=\"margin:10px 0 0;padding-left:22px\">\n<li><a href=\"#sharing-a-cloud-does-not-mean-sharing-a-network\">Sharing a Cloud Does Not Mean Sharing a Network<\/a><\/li>\n<li><a href=\"#cidr-planning-public-private-and-isolated-subnets\">CIDR Planning: Public, Private, and Isolated Subnets<\/a><\/li>\n<li><a href=\"#creating-the-vpc-and-subnets-with-aws-cli\">Creating the VPC and Subnets with AWS CLI<\/a><\/li>\n<li><a href=\"#where-does-a-packet-go-internet-gateway-nat-and-route-tables\">Where Does a Packet Go? Internet Gateway, NAT, and Route Tables<\/a><\/li>\n<li><a href=\"#routes-enable-connectivity-security-rules-restrict-it\">Routes Enable Connectivity; Security Rules Restrict It<\/a><\/li>\n<li><a href=\"#verifying-isolation-with-a-connectivity-matrix\">Verifying Isolation with a Connectivity Matrix<\/a><\/li>\n<li><a href=\"#closing-the-lab-costs-dependencies-and-the-next-architecture\">Closing the Lab: Costs, Dependencies, and the Next Architecture<\/a><\/li>\n<li><a href=\"#checks-before-starting-and-closing-the-lab\">Checks Before Starting and Closing the Lab<\/a><\/li>\n<li><a href=\"#frequently-asked-questions\">Frequently Asked Questions<\/a><\/li>\n<li><a href=\"#sources\">Sources<\/a><\/li>\n<\/ol>\n<\/div>\n<h2 id=\"sharing-a-cloud-does-not-mean-sharing-a-network\">Sharing a Cloud Does Not Mean Sharing a Network<\/h2>\n<p>Two accounts&#8217; EC2 instances in the same AWS Region cannot reach each other&#8217;s private IPs merely because they share a provider. Proximity is not permission. Separate private networks need an explicit connection, suitable routing, and rules permitting traffic. Communication through a publicly accessible service takes a different path; it does not merge those networks.<\/p>\n<p><strong>What is a VPC?<\/strong> A logically isolated virtual network within AWS whose address space, subnets, and routing you configure. Account boundaries do not define it: one account can have multiple VPCs, while VPCs across accounts can communicate through explicitly configured connections. The permitted network path matters, not the shared provider.<\/p>\n<p>I keep three concepts separate: network isolation, hardware allocation, and encryption. A VPC is not a private cloud deployment model, does not itself provide dedicated physical servers, and does not guarantee encrypted traffic. Sensitive data still needs transport protection such as TLS.<\/p>\n<p>In this hypothetical lab, the VPC uses <code>10.20.0.0\/16<\/code> in <code>eu-central-1<\/code>. AWS VPCs are regional; each subnet occupies one Availability Zone. The <code>public-egress<\/code>, <code>private-app<\/code>, and <code>isolated-data<\/code> subnets all sit in <code>eu-central-1a<\/code>. Different traffic roles do not spread them across three zones or provide resilience against an Availability Zone failure.<\/p>\n<p>IETF RFC 1918 reserves <code>10.0.0.0\/8<\/code> for private use, including the lab&#8217;s addresses. These are not public addresses reserved for documentation. Private addressing does not replace access control. The application machine at <code>10.20.10.10<\/code> and data-tier machine at <code>10.20.20.10<\/code> receive no public IPv4 addresses, but routing and security rules still govern their traffic. Sharing a VPC does not require unrestricted access.<\/p>\n<p>Who can change the network? Where can packets travel, and which connections are permitted? IAM addresses the first question, route tables the second, and security groups and network ACLs the third. The <code>vpc-lab<\/code> profile uses AWS IAM Identity Center authentication for management operations; it does not automatically permit application TCP connections. In your deployment plan, record management permissions and data-traffic permissions as separate checks.<\/p>\n<h2 id=\"cidr-planning-public-private-and-isolated-subnets\">CIDR Planning: Public, Private, and Isolated Subnets<\/h2>\n<p>Naming a subnet <code>public<\/code> does not expose it to the internet. Routes decide. For this hypothetical AWS lab, I would leave gaps between the three <code>\/24<\/code> subnets inside <code>10.20.0.0\/16<\/code>, reserving space for future tiers without renumbering existing machines.<\/p>\n<p>RFC 1918 reserves <code>10.0.0.0\/8<\/code> for private networks; our addresses belong there, not to documentation-only IPv4 blocks. RFC 4632 describes CIDR&#8217;s slash number as the prefix length in bits: <code>\/16<\/code> covers 65,536 addresses; <code>\/24<\/code> covers 256. <a href=\"https:\/\/www.vps.tc\/blog\/en\/what-is-cidr-ip-range-calculation\/\">What Is CIDR? A Practical Guide to IP Range Calculation<\/a> explains the calculation for other prefixes.<\/p>\n<table>\n<thead>\n<tr>\n<th>Network<\/th>\n<th>CIDR<\/th>\n<th>Location<\/th>\n<th>Purpose and route<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>VPC<\/td>\n<td><code>10.20.0.0\/16<\/code><\/td>\n<td><code>eu-central-1<\/code><\/td>\n<td>Shared address space<\/td>\n<\/tr>\n<tr>\n<td>public-egress<\/td>\n<td><code>10.20.0.0\/24<\/code><\/td>\n<td><code>eu-central-1a<\/code><\/td>\n<td>Public NAT Gateway with an Elastic IP; default route to the Internet Gateway<\/td>\n<\/tr>\n<tr>\n<td>private-app<\/td>\n<td><code>10.20.10.0\/24<\/code><\/td>\n<td><code>eu-central-1a<\/code><\/td>\n<td>Test machine: <code>10.20.10.10<\/code>; default route to the NAT Gateway<\/td>\n<\/tr>\n<tr>\n<td>isolated-data<\/td>\n<td><code>10.20.20.0\/24<\/code><\/td>\n<td><code>eu-central-1a<\/code><\/td>\n<td>Test machine: <code>10.20.20.10<\/code>; VPC-local route only<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>AWS reserves the first four and last addresses in standard IPv4 subnets. For <code>private-app<\/code>, those are <code>10.20.10.0<\/code>, <code>10.20.10.1<\/code>, <code>10.20.10.2<\/code>, <code>10.20.10.3<\/code>, and <code>10.20.10.255<\/code>. Each <code>\/24<\/code> leaves <strong>256 \u2212 5 = 251 assignable addresses<\/strong>. This is an AWS reservation, not an RFC 4632 capacity rule. It does not guarantee room for 251 EC2 machines: managed services and additional network interfaces consume addresses too.<\/p>\n<p>Each subnet gets its own route table. Neither test machine receives public IPv4, and naming a subnet public does not assign public addresses. <code>isolated-data<\/code> has no default internet route, but its local route reaches other VPC subnets. <strong>Isolated does not mean unreachable within the VPC.<\/strong> Security rules restrict access separately.<\/p>\n<p>Do not size CIDRs solely for today&#8217;s machines. Compare your company network, home VPN, and future peering or Transit Gateway connections. RFC 1918 permits address reuse across organizations; connecting those networks can expose overlaps. VPC peering rejects overlapping CIDRs; overlaps also complicate direct routing through VPNs and Transit Gateway.<\/p>\n<p>One Availability Zone simplifies the lab, not high availability. Reserve non-overlapping blocks for a second zone in your production plan now; unplanned allocations can turn the next network connection into a renumbering job.<\/p>\n<div class=\"aiw-callout aiw-callout-example\">\n<p class=\"aiw-callout-label\">Example<\/p>\n<p>The hypothetical AWS lab uses three subnets in eu-central-1a: 10.20.0.0\/24 for public-egress, 10.20.10.0\/24 for private-app, and 10.20.20.0\/24 for isolated-data. These belong to RFC 1918 private address space, not public address blocks reserved for documentation. Using one Availability Zone simplifies the lab; it does not provide high availability.<\/p>\n<\/div>\n<h2 id=\"creating-the-vpc-and-subnets-with-aws-cli\">Creating the VPC and Subnets with AWS CLI<\/h2>\n<p>Creating a network in the wrong account can succeed. I check identity first. This hypothetical lab assumes Ubuntu Server 24.04 LTS, AWS CLI v2, and EC2 API <code>2016-11-15<\/code>; managed VPC has no separate product version.<\/p>\n<p>Preconfigure <code>vpc-lab<\/code> for AWS IAM Identity Center with EC2 network-management permissions. Bash authenticates through SSO without writing permanent access keys. Verify the displayed account, role, and region before entering <code>EVET<\/code> at the preserved Turkish prompt. Region: <code>eu-central-1<\/code>; availability zone: <code>eu-central-1a<\/code>.<\/p>\n<p>IETF RFC 1918 identifies <code>10.20.0.0\/16<\/code> as private address space, not public documentation space. Using RFC 4632&#8217;s CIDR notation, three <code>\/24<\/code> prefixes define separate subnets. JSON requests stay under <code>\/home\/ubuntu\/vpc-lab\/config\/<\/code>.<\/p>\n<pre><code>(\nset -euo pipefail\numask 077\nexport AWS_PROFILE=vpc-lab\nexport AWS_REGION=eu-central-1\nexport AWS_DEFAULT_REGION=eu-central-1\nexport AWS_PAGER=''\n\nmkdir -p \/home\/ubuntu\/vpc-lab\/config\ncd \/home\/ubuntu\/vpc-lab\/\nif [[ -e state.env ]]; then\n  printf 'state.env mevcut; yeniden olu\u015fturma durduruldu.\\n' &gt;&amp;2\n  exit 1\nfi\n\naws sso login --profile \"$AWS_PROFILE\"\naws sts get-caller-identity --output json\nprintf 'B\u00f6lge: %s\\n' \"$AWS_REGION\"\nread -r -p 'Hesap, rol ve b\u00f6lge do\u011fruysa EVET yaz\u0131n: ' ONAY\n[[ \"$ONAY\" == EVET ]] || exit 1\n\nprintf 'export AWS_PROFILE=%q\\nexport AWS_REGION=%q\\nexport AWS_DEFAULT_REGION=%q\\n' \\\n  \"$AWS_PROFILE\" \"$AWS_REGION\" \"$AWS_DEFAULT_REGION\" &gt; state.env\n\ncat &gt; config\/vpc.json &lt;&lt;'JSON'\n{\n  \"CidrBlock\": \"10.20.0.0\/16\",\n  \"TagSpecifications\": [{\n    \"ResourceType\": \"vpc\",\n    \"Tags\": [\n      {\"Key\": \"Name\", \"Value\": \"vpc-lab\"},\n      {\"Key\": \"Project\", \"Value\": \"vpc-lab\"}\n    ]\n  }]\n}\nJSON\n\nVPC_ID=$(aws ec2 create-vpc --cli-input-json file:\/\/config\/vpc.json \\\n  --query 'Vpc.VpcId' --output text)\nprintf 'VPC_ID=%q\\n' \"$VPC_ID\" &gt;&gt; state.env\naws ec2 wait vpc-available --vpc-ids \"$VPC_ID\"\naws ec2 modify-vpc-attribute --vpc-id \"$VPC_ID\" \\\n  --enable-dns-support '{\"Value\":true}'\naws ec2 modify-vpc-attribute --vpc-id \"$VPC_ID\" \\\n  --enable-dns-hostnames '{\"Value\":true}'\n\nwhile read -r NAME CIDR KEY; do\n  printf '{\"VpcId\":\"%s\",\"CidrBlock\":\"%s\",\"AvailabilityZone\":\"eu-central-1a\",\"TagSpecifications\":[{\"ResourceType\":\"subnet\",\"Tags\":[{\"Key\":\"Name\",\"Value\":\"%s\"},{\"Key\":\"Project\",\"Value\":\"vpc-lab\"}]}]}\\n' \\\n    \"$VPC_ID\" \"$CIDR\" \"$NAME\" &gt; \"config\/$NAME.json\"\n  SUBNET_ID=$(aws ec2 create-subnet \\\n    --cli-input-json \"file:\/\/config\/$NAME.json\" \\\n    --query 'Subnet.SubnetId' --output text)\n  printf '%s=%q\\n' \"$KEY\" \"$SUBNET_ID\" &gt;&gt; state.env\n  aws ec2 wait subnet-available --subnet-ids \"$SUBNET_ID\"\n  aws ec2 modify-subnet-attribute --subnet-id \"$SUBNET_ID\" \\\n    --no-map-public-ip-on-launch\ndone &lt;&lt;'SUBNETS'\npublic-egress 10.20.0.0\/24 SUBNET_PUBLIC_ID\nprivate-app 10.20.10.0\/24 SUBNET_PRIVATE_ID\nisolated-data 10.20.20.0\/24 SUBNET_ISOLATED_ID\nSUBNETS\n\naws ec2 describe-subnets --filters \"Name=vpc-id,Values=$VPC_ID\" \\\n  --query 'Subnets[].{ID:SubnetId,CIDR:CidrBlock,AZ:AvailabilityZone,AutoPublicIPv4:MapPublicIpOnLaunch}' \\\n  --output table\n)\n<\/code><\/pre>\n<p>Expect three rows showing subnet IDs, CIDRs, availability zone, and <code>AutoPublicIPv4=False<\/code>. AWS-generated IDs are saved immediately from creation responses. Successful modification commands may produce no output; silence proves nothing.<\/p>\n<p><code>Name<\/code> distinguishes resources; <code>Project=vpc-lab<\/code> supports filtering. DNS resolution and DNS hostname support are explicitly enabled, without providing internet access. Automatic public IPv4 assignment is disabled across all three subnets. No EC2 instances are created yet; future test machines <code>10.20.10.10<\/code> and <code>10.20.20.10<\/code> will also have no public IPv4.<\/p>\n<p>AWS creates the VPC&#8217;s main route table, default security group, and default network ACL. Subnets initially use the main table implicitly, including its VPC-local route. The default security group permits inbound traffic from the same group and all outbound traffic; the default ACL permits both directions. The next section explicitly associates separate route tables with each subnet. The name <code>public-egress<\/code> grants no internet access.<\/p>\n<p>This is not idempotent: removing the file guard allows reruns to create additional resources. Load non-secret saved state with <code>source \/home\/ubuntu\/vpc-lab\/state.env<\/code>. After partial failure, inspect recorded resources rather than deleting the file and restarting.<\/p>\n<h2 id=\"where-does-a-packet-go-internet-gateway-nat-and-route-tables\">Where Does a Packet Go? Internet Gateway, NAT, and Route Tables<\/h2>\n<p>Naming a subnet <code>public-egress<\/code> creates no internet path. It needs a route. In this hypothetical lab, I explicitly associate three separate route tables so main-table changes cannot silently alter these subnets&#8217; outbound paths.<\/p>\n<p>IETF RFC 1918 places <code>10.20.0.0\/16<\/code> within private-use <code>10.0.0.0\/8<\/code>, not public documentation space. RFC 4632 explains longest-prefix matching: <code>10.20.0.0\/16 \u2192 local<\/code> beats <code>0.0.0.0\/0<\/code> for VPC destinations. Application-to-data traffic bypasses NAT.<\/p>\n<p>This Bash example targets Ubuntu Server 24.04 LTS, AWS CLI v2, and EC2 API <code>2016-11-15<\/code>. The preceding step&#8217;s <code>state.env<\/code> must contain <code>VPC_ID<\/code>, with no Internet Gateway attached yet. Subnets are found by CIDR and Availability Zone within the VPC. IAM Identity Center authenticates <code>vpc-lab<\/code> without writing permanent access keys. Resources can incur charges; rerunning does not automatically reuse them.<\/p>\n<pre><code>set -euo pipefail\ncd \/home\/ubuntu\/vpc-lab\/\nsource .\/state.env\n: \"${VPC_ID:?state.env i\u00e7inde VPC_ID tan\u0131ml\u0131 olmal\u0131}\"\n\naws sso login --profile vpc-lab\nec2() {\n  aws --profile vpc-lab --region eu-central-1 --no-cli-pager ec2 \"$@\"\n}\nsave_ids() {\n  for name in \"$@\"; do\n    printf '%s=%q\\n' \"$name\" \"${!name}\" &gt;&gt; .\/state.env\n  done\n}\nsubnet_id() {\n  ec2 describe-subnets \\\n    --filters \"Name=vpc-id,Values=$VPC_ID\" \\\n      \"Name=cidr-block,Values=$1\" \\\n      \"Name=availability-zone,Values=eu-central-1a\" \\\n    --query 'Subnets[0].SubnetId' --output text\n}\n\nPUBLIC_SUBNET_ID=$(subnet_id 10.20.0.0\/24)\nPRIVATE_SUBNET_ID=$(subnet_id 10.20.10.0\/24)\nISOLATED_SUBNET_ID=$(subnet_id 10.20.20.0\/24)\nfor id in \"$PUBLIC_SUBNET_ID\" \"$PRIVATE_SUBNET_ID\" \"$ISOLATED_SUBNET_ID\"; do\n  [[ \"$id\" == subnet-* ]] || { printf 'Alt a\u011f bulunamad\u0131\\n' &gt;&amp;2; exit 1; }\ndone\nsave_ids PUBLIC_SUBNET_ID PRIVATE_SUBNET_ID ISOLATED_SUBNET_ID\n\nIGW_ID=$(ec2 create-internet-gateway \\\n  --query 'InternetGateway.InternetGatewayId' --output text)\nsave_ids IGW_ID\nec2 attach-internet-gateway --internet-gateway-id \"$IGW_ID\" --vpc-id \"$VPC_ID\"\n\nPUBLIC_RT_ID=$(ec2 create-route-table --vpc-id \"$VPC_ID\" \\\n  --query 'RouteTable.RouteTableId' --output text)\nsave_ids PUBLIC_RT_ID\nPRIVATE_RT_ID=$(ec2 create-route-table --vpc-id \"$VPC_ID\" \\\n  --query 'RouteTable.RouteTableId' --output text)\nsave_ids PRIVATE_RT_ID\nISOLATED_RT_ID=$(ec2 create-route-table --vpc-id \"$VPC_ID\" \\\n  --query 'RouteTable.RouteTableId' --output text)\nsave_ids ISOLATED_RT_ID\n\nPUBLIC_ASSOC_ID=$(ec2 associate-route-table --route-table-id \"$PUBLIC_RT_ID\" \\\n  --subnet-id \"$PUBLIC_SUBNET_ID\" --query 'AssociationId' --output text)\nsave_ids PUBLIC_ASSOC_ID\nPRIVATE_ASSOC_ID=$(ec2 associate-route-table --route-table-id \"$PRIVATE_RT_ID\" \\\n  --subnet-id \"$PRIVATE_SUBNET_ID\" --query 'AssociationId' --output text)\nsave_ids PRIVATE_ASSOC_ID\nISOLATED_ASSOC_ID=$(ec2 associate-route-table --route-table-id \"$ISOLATED_RT_ID\" \\\n  --subnet-id \"$ISOLATED_SUBNET_ID\" --query 'AssociationId' --output text)\nsave_ids ISOLATED_ASSOC_ID\n\nec2 create-route --route-table-id \"$PUBLIC_RT_ID\" \\\n  --destination-cidr-block 0.0.0.0\/0 --gateway-id \"$IGW_ID\"\n\nEIP_ALLOC_ID=$(ec2 allocate-address --domain vpc \\\n  --query 'AllocationId' --output text)\nsave_ids EIP_ALLOC_ID\nNAT_ID=$(ec2 create-nat-gateway --subnet-id \"$PUBLIC_SUBNET_ID\" \\\n  --allocation-id \"$EIP_ALLOC_ID\" --connectivity-type public \\\n  --query 'NatGateway.NatGatewayId' --output text)\nsave_ids NAT_ID\n\nec2 wait nat-gateway-available --nat-gateway-ids \"$NAT_ID\"\nec2 create-route --route-table-id \"$PRIVATE_RT_ID\" \\\n  --destination-cidr-block 0.0.0.0\/0 --nat-gateway-id \"$NAT_ID\"\n\nec2 describe-route-tables \\\n  --route-table-ids \"$PUBLIC_RT_ID\" \"$PRIVATE_RT_ID\" \"$ISOLATED_RT_ID\" \\\n  --query 'RouteTables[].{Table:RouteTableId,Subnets:Associations[].SubnetId,Routes:Routes[].{CIDR:DestinationCidrBlock,Gateway:GatewayId,NAT:NatGatewayId,State:State}}' \\\n  --output json<\/code><\/pre>\n<p><code>allocate-address<\/code> reserves an Elastic IP for the public NAT Gateway created in <code>public-egress<\/code>. <code>wait<\/code> waits for <code>available<\/code>, producing no output on success. Failure stops execution before adding the private-app route. Inspect using <code>\/home\/ubuntu\/vpc-lab\/state.env<\/code> rather than restarting; it stores only nonsecret resource IDs.<\/p>\n<p>Expect the final JSON to show each table&#8217;s subnet association and automatic <code>10.20.0.0\/16 \u2192 local<\/code> route. Public-egress should also show <code>0.0.0.0\/0 \u2192 Internet Gateway<\/code>; private-app, <code>0.0.0.0\/0 \u2192 NAT Gateway<\/code>. Isolated-data keeps only local; no <code>create-route<\/code> targets it. Routes should be <code>active<\/code>, but that does not prove end-to-end connectivity.<\/p>\n<p>An Internet Gateway route alone cannot give a private-only machine internet access: direct IPv4 egress requires a public IPv4 or Elastic IP mapping. Neither test machine receives public IPv4. <code>10.20.10.10<\/code> can initiate outbound connections through NAT, which permits return traffic-not new connections initiated from outside. <code>10.20.20.10<\/code> has no internet route. Their <code>local<\/code> route provides a path, not permission. Check security groups and network ACLs before testing connectivity.<\/p>\n<div class=\"aiw-callout aiw-callout-warn\">\n<p class=\"aiw-callout-label\">Caution<\/p>\n<p>Adding a default route to an Internet Gateway does not give an EC2 instance with only a private IPv4 address direct internet access. In this lab, the application instance reaches the internet through a public NAT Gateway. That NAT Gateway is not an entry point for new connections initiated from the internet.<\/p>\n<\/div>\n<h2 id=\"routes-enable-connectivity-security-rules-restrict-it\">Routes Enable Connectivity; Security Rules Restrict It<\/h2>\n<p><code>isolated-data<\/code> is a name, not a filter. In this hypothetical lab, the <code>10.20.0.0\/16<\/code> local route connects <code>10.20.10.10<\/code> and <code>10.20.20.10<\/code>. Separate route tables retain it, even without a default route. RFC 1918 reserves <code>10.0.0.0\/8<\/code> for private addressing; it does not define access authorization. Names are not enough.<\/p>\n<p>Create <code>vpc-lab-app<\/code> and <code>vpc-lab-data<\/code> security groups. Allow data-layer TCP <code>5432<\/code> from the application group, not the VPC. Referencing a group permits traffic from its attached interfaces&#8217; private addresses; it does not copy rules. Neither instance gets public IPv4. Expose neither TCP <code>8080<\/code> nor SSH to the internet.<\/p>\n<p>The example uses Ubuntu Server 24.04 LTS, AWS CLI v2 and EC2 API model <code>2016-11-15<\/code>. Define <code>VPC_ID<\/code> in <code>\/home\/ubuntu\/vpc-lab\/state.env<\/code>. IAM Identity Center authenticates profile <code>vpc-lab<\/code> without saving permanent access keys. Resource IDs enter that same file; request JSON goes under <code>config\/<\/code>. Existing group names can make reruns fail.<\/p>\n<pre><code>cd \/home\/ubuntu\/vpc-lab\/\nsource .\/state.env\n: \"${VPC_ID:?state.env i\u00e7inde VPC_ID tan\u0131ml\u0131 olmal\u0131}\"\nexport AWS_PROFILE=vpc-lab\nexport AWS_REGION=eu-central-1\naws sso login --profile vpc-lab\nmkdir -p config\n\nAPP_SG_ID=$(aws ec2 create-security-group \\\n  --vpc-id \"$VPC_ID\" --group-name vpc-lab-app \\\n  --description 'Application lab instances' \\\n  --query GroupId --output text) || exit 1\n\nDATA_SG_ID=$(aws ec2 create-security-group \\\n  --vpc-id \"$VPC_ID\" --group-name vpc-lab-data \\\n  --description 'Data lab instances' \\\n  --query GroupId --output text) || exit 1\n\nprintf '\\nAPP_SG_ID=%s\\nDATA_SG_ID=%s\\n' \\\n  \"$APP_SG_ID\" \"$DATA_SG_ID\" &gt;&gt; state.env\n\ncat &gt; config\/data-ingress.json &lt;&lt;EOF\n[\n  {\n    \"IpProtocol\": \"tcp\",\n    \"FromPort\": 5432,\n    \"ToPort\": 5432,\n    \"UserIdGroupPairs\": [{\"GroupId\": \"$APP_SG_ID\"}]\n  }\n]\nEOF\n\naws ec2 authorize-security-group-ingress \\\n  --group-id \"$DATA_SG_ID\" \\\n  --ip-permissions file:\/\/config\/data-ingress.json\n\naws ec2 describe-security-groups \\\n  --group-ids \"$DATA_SG_ID\" \\\n  --query 'SecurityGroups[0].IpPermissions' --output json<\/code><\/pre>\n<p>Expect <code>tcp<\/code>, both port fields <code>5432<\/code>, and the application group ID as source. These commands do not attach groups: assign each to its corresponding instance interface. Remove broadly permissive additional groups; permissions combine. Default allow-all outbound rules remain.<\/p>\n<p>Security groups are <strong>stateful<\/strong>: allowed connections need no separate return-traffic rule. Network ACLs are <strong>stateless<\/strong>; restrictive ACLs need explicit return-direction permissions, including client ephemeral ports. Ranges depend on operating system and NAT usage. I would leave this lab&#8217;s default ACL unchanged so another filter does not obscure security-group tests.<\/p>\n<p>Manage the application instance through Systems Manager Session Manager. You need a running SSM Agent, an instance IAM role granting <code>AmazonSSMManagedInstanceCore<\/code> permissions, operator authorization, and HTTPS <code>443<\/code> access to required regional Systems Manager endpoints. The <code>private-app<\/code> NAT route can provide this access. Test TCP <code>8080<\/code> through Session Manager port forwarding, with the Session Manager plugin installed on your CLI client-not an internet-facing inbound rule.<\/p>\n<div class=\"aiw-callout aiw-callout-tip\">\n<p class=\"aiw-callout-label\">Tip<\/p>\n<p>Security group rules are stateful; network ACL rules are stateless. If you tighten ACL rules, account for return traffic and the ephemeral port ranges in use. The name isolated-data does not block application-tier access; the local route and permissive security rules can allow that communication.<\/p>\n<\/div>\n<h2 id=\"verifying-isolation-with-a-connectivity-matrix\">Verifying Isolation with a Connectivity Matrix<\/h2>\n<p>One successful connection does not prove isolation. Write expectations first. I would use this matrix for the hypothetical <code>eu-central-1<\/code> lab; these are requirements, not measurements.<\/p>\n<table>\n<thead>\n<tr>\n<th>Source \u2192 destination<\/th>\n<th>Expected behavior<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>10.20.10.10 \u2192 10.20.20.10 TCP 5432<\/td>\n<td>TCP connection succeeds<\/td>\n<\/tr>\n<tr>\n<td>10.20.10.10 \u2192 internet TCP 443<\/td>\n<td>HTTPS completes through NAT<\/td>\n<\/tr>\n<tr>\n<td>Internet \u2192 private machines TCP 8080\/5432<\/td>\n<td>No direct access<\/td>\n<\/tr>\n<tr>\n<td>10.20.20.10 \u2192 internet TCP 443<\/td>\n<td>Connection fails<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Before Session Manager access, verify SSM Agent is running and the application&#8217;s instance-profile IAM role has <code>AmazonSSMManagedInstanceCore<\/code> permissions. Regional <code>ssm<\/code> and <code>ssmmessages<\/code> endpoints require DNS resolution and outbound TCP 443 through NAT, not inbound SSH. On your Ubuntu Server 24.04 LTS client, authenticate AWS CLI v2 through IAM Identity Center; never save permanent keys. CLI sessions also require the Session Manager plugin.<\/p>\n<pre><code>cd \/home\/ubuntu\/vpc-lab\/\naws sso login --profile vpc-lab<\/code><\/pre>\n<p>Keep <code>isolated-data<\/code> without an internet route. EC2 Serial Console requires a supported Nitro instance type, account-level enablement, IAM permissions, Ubuntu serial-console configuration, and a password-enabled OS user for interactive login. Alternatively, prepare a startup script that backgrounds the listener and records test output locally.<\/p>\n<p>Start Python 3.12 listeners in separate sessions on the respective machines; neither is a real application or PostgreSQL deployment. Preserved Turkish labels identify the application and data machines. Run commands beneath them, not the un-commented <code>Veri makinesinde:<\/code> label.<\/p>\n<pre><code># Uygulama makinesinde:\npython3 -m http.server 8080 --bind 10.20.10.10\n\nVeri makinesinde:\npython3 -m http.server 5432 --bind 10.20.20.10<\/code><\/pre>\n<p>With listeners running, use other sessions for these probes. Preinstalled <code>nc<\/code> and <code>curl<\/code> have explicit timeouts:<\/p>\n<pre><code># Uygulama makinesinde:\nnc -zv -w 5 10.20.20.10 5432\ncurl --connect-timeout 5 --max-time 10 -sS -o \/dev\/null https:\/\/aws.amazon.com\/ &amp;&amp; printf 'HTTPS_OK\\n'\n\nVeri makinesinde:\ncurl --connect-timeout 5 --max-time 10 -sS -o \/dev\/null https:\/\/aws.amazon.com\/\nprintf 'curl_exit=%s\\n' \"$?\"<\/code><\/pre>\n<p><strong>Expected examples, not observed output:<\/strong> application-side <code>nc<\/code> reports <code>succeeded!<\/code>; HTTPS prints <code>HTTPS_OK<\/code>; data-side <code>curl_exit<\/code> is nonzero. DNS failure does not prove route isolation. RFC 1918 places <code>10.20.0.0\/16<\/code> inside private <code>10.0.0.0\/8<\/code>, not public documentation space. Beyond failed internet probes, verify neither machine has public IPv4. Public NAT Gateway does not forward internet-initiated connections to them.<\/p>\n<p>Check route tables, security groups, ACLs, then OS listeners. ACLs must permit return traffic; <code>ss -lnt<\/code> shows listening addresses. VPC Flow Logs ACCEPT\/REJECT records cannot prove application responses. Reachability Analyzer examines configured paths without sending packets or verifying listeners. I would not count an unexplained failure as successful isolation.<\/p>\n<div class=\"aiw-callout aiw-callout-tip\">\n<p class=\"aiw-callout-label\">Tip<\/p>\n<p>Write down the expected allowed and denied flows before testing connectivity. A successful TCP 5432 connection demonstrates only that the test listener is reachable; it does not prove PostgreSQL is installed or authentication works. Do not confuse expected example output with actual test results.<\/p>\n<\/div>\n<h2 id=\"closing-the-lab-costs-dependencies-and-the-next-architecture\">Closing the Lab: Costs, Dependencies, and the Next Architecture<\/h2>\n<p>Stopping instances is not enough. This hypothetical lab incurs separate charges for NAT Gateway hours and data processing, public IPv4, EC2, EBS volumes, and optional logging or analytics. Check current prices; I treat cleanup as part of <a href=\"https:\/\/www.vps.tc\/blog\/en\/what-is-finops-cloud-cost-management\/\">FinOps<\/a>. RFC 1918 identifies <code>10.20.0.0\/16<\/code> as private address space, not free infrastructure.<\/p>\n<p>Three subnets in <code>eu-central-1a<\/code> are not production high availability. I would consider multiple Availability Zones before multiple regions. Routing through a NAT Gateway in each workload&#8217;s own zone reduces dependence on another zone&#8217;s NAT. This increases gateway running costs but may reduce cross-zone transfers. Application replicas, data replication, and failover need separate designs.<\/p>\n<h3>Delete in dependency order<\/h3>\n<p>Deletion is irreversible. Back up necessary data. Verify the account using <code>aws sts get-caller-identity --profile vpc-lab<\/code>, then check resource IDs in <code>state.env<\/code> against tags.<\/p>\n<ol>\n<li>Terminate both test instances with <code>terminate-instances<\/code>; run <code>wait instance-terminated<\/code>. Inspect remaining interfaces; delete unnecessary user-managed ENIs, not service-managed interfaces.<\/li>\n<li>Delete the NAT Gateway, wait for deletion, then release its Elastic IP.<\/li>\n<li>Remove custom default routes with <code>delete-route<\/code> and explicit subnet associations with <code>disassociate-route-table<\/code>. Leave local routes alone.<\/li>\n<li>Run <code>detach-internet-gateway<\/code>, then <code>delete-internet-gateway<\/code>; delete subnets with <code>delete-subnet<\/code>.<\/li>\n<li>Remove security-group references; delete custom groups with <code>delete-security-group<\/code>, custom route tables with <code>delete-route-table<\/code>, then the VPC with <code>delete-vpc<\/code>.<\/li>\n<\/ol>\n<p>This second-stage example uses Ubuntu Server 24.04 LTS and AWS CLI v2. The trusted <code>\/home\/ubuntu\/vpc-lab\/state.env<\/code> must contain verified <code>NAT_GATEWAY_ID<\/code> and <code>EIP_ALLOCATION_ID<\/code> values. IAM Identity Center provides authentication; no permanent access keys are written.<\/p>\n<pre><code>#!\/usr\/bin\/env bash\nset -euo pipefail\ncd \/home\/ubuntu\/vpc-lab\/\nsource .\/state.env\n: \"${NAT_GATEWAY_ID:?NAT kimli\u011fi eksik}\"\n: \"${EIP_ALLOCATION_ID:?Elastic IP tahsis kimli\u011fi eksik}\"\nexport AWS_PAGER=\"\"\naws sso login --profile vpc-lab\n\naws_ec2() {\n  aws --profile vpc-lab --region eu-central-1 ec2 \"$@\"\n}\n\naws_ec2 delete-nat-gateway --nat-gateway-id \"$NAT_GATEWAY_ID\"\naws_ec2 wait nat-gateway-deleted --nat-gateway-ids \"$NAT_GATEWAY_ID\"\naws_ec2 release-address --allocation-id \"$EIP_ALLOCATION_ID\"\n<\/code><\/pre>\n<p>Expect the deletion response to include the NAT ID; successful waiting and address release produce no output. A waiter timeout stops the script. Verify deletion before proceeding. Finally, query using tags and resource IDs for unreleased EIPs, volumes, snapshots, and logging or analytics resources. VPC deletion does not prove billable leftovers are gone; billing views can lag.<\/p>\n<h2 id=\"checks-before-starting-and-closing-the-lab\">Checks Before Starting and Closing the Lab<\/h2>\n<ul class=\"aiw-checklist\">\n<li>Sign in through IAM Identity Center using the vpc-lab profile in AWS CLI v2 on Ubuntu Server 24.04 LTS; verify the account and eu-central-1 region.<\/li>\n<li>Check that 10.20.0.0\/16 does not overlap with any VPN, peering, or corporate networks you plan to connect.<\/li>\n<li>Keep resource IDs in \/home\/ubuntu\/vpc-lab\/state.env and JSON requests under \/home\/ubuntu\/vpc-lab\/config\/; do not save long-lived access keys.<\/li>\n<li>Associate each subnet with its own route table and disable automatic public IPv4 assignment.<\/li>\n<li>Restrict inbound TCP 5432 to the application security group; verify the SSM Agent, IAM role, and HTTPS connectivity required for Session Manager.<\/li>\n<li>Test allowed and blocked flows with a connectivity matrix; do not add an internet route to manage the data tier.<\/li>\n<li>Remove resources in dependency order; release the Elastic IP after the NAT Gateway is deleted, then use tags and resource IDs to check for billable leftovers.<\/li>\n<\/ul>\n<div class=\"aiw-cta\">\n<p>Before creating resources, write the permitted flows between the application, data tier, and internet into a connectivity matrix. Your first verification should test not just the port that must be reachable, but also the path that must remain blocked.<\/p>\n<p class=\"aiw-cta-action\"><a href=\"https:\/\/www.vps.tc\/en\/vps\">Explore VPS plans<\/a><\/p>\n<\/div>\n<h2 id=\"frequently-asked-questions\">Frequently Asked Questions<\/h2>\n<div class=\"aiw-faq\">\n<details class=\"aiw-faq-item\" open>\n<summary>What is a VPC, and is it the same as a private cloud?<\/summary>\n<p>A VPC is a logically separated virtual network created for your resources at a cloud provider. A private cloud is a deployment model in which cloud infrastructure is reserved for one organization. Creating a VPC does not mean physical servers are dedicated to you or traffic is automatically encrypted. In AWS, a VPC is regional, while each subnet belongs to a single Availability Zone.<\/p>\n<\/details>\n<details class=\"aiw-faq-item\">\n<summary>What is the difference between public, private, and isolated subnets?<\/summary>\n<p>The distinction comes from the associated route table, not the subnet&#039;s name. In the hypothetical lab, public-egress has a direct default route to an Internet Gateway, while private-app uses a NAT Gateway for outbound access. Isolated-data has only the VPC-local route. Calling a subnet isolated does not automatically block access from the application subnet; security rules determine the access boundary between tiers.<\/p>\n<\/details>\n<details class=\"aiw-faq-item\">\n<summary>How does an EC2 instance in a private subnet access the internet?<\/summary>\n<p>In this IPv4 lab, the private-app subnet&#039;s 0.0.0.0\/0 route points to a public NAT Gateway in public-egress. The NAT Gateway uses an Elastic IP, and its subnet&#039;s default route points to an Internet Gateway. The EC2 instance does not need a public IPv4 address. Security rules and ACLs must allow the traffic; NAT does not permit new connections initiated from the internet.<\/p>\n<\/details>\n<details class=\"aiw-faq-item\">\n<summary>What is the difference between a security group and a network ACL?<\/summary>\n<p>A security group controls traffic for associated network interfaces using stateful rules; replies to permitted connections do not require a separate reverse-direction rule. A network ACL operates at the subnet boundary, is stateless, and supports allow and deny rules. Tightening an ACL requires accounting for return traffic and ephemeral ports separately. The lab leaves the default ACL unchanged and restricts access between tiers with separate security groups.<\/p>\n<\/details>\n<details class=\"aiw-faq-item\">\n<summary>Why does an AWS \/24 subnet have 251 usable IPv4 addresses?<\/summary>\n<p>A \/24 IPv4 block contains 256 addresses. AWS reserves the first four addresses and the last address in standard VPC subnets, leaving 251 usable addresses in each \/24 used here. This is the result of AWS reservation rules, not a general Ethernet subnet calculation. When planning capacity, account for services that create network interfaces as well as EC2 instances.<\/p>\n<\/details>\n<details class=\"aiw-faq-item\">\n<summary>Does creating a VPC cost money, and does NAT Gateway incur charges?<\/summary>\n<p>There is no additional charge for the VPC itself, but resources inside or attached to it can incur costs. NAT Gateway running time and processed data, public IPv4 addresses, EC2 instances, and enabled logging or analysis features are separate cost items. Stopping EC2 does not delete a NAT Gateway or release an Elastic IP. Check these resources separately when closing the lab.<\/p>\n<\/details>\n<\/div>\n<h2 id=\"sources\">Sources<\/h2>\n<ul class=\"aiw-sources\">\n<li><a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc1918\" target=\"_blank\" rel=\"noopener\">IETF RFC 1918 &#8211; Address Allocation for Private Internets<\/a> \u2014 rfc-editor.org<\/li>\n<li><a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc4632\" target=\"_blank\" rel=\"noopener\">IETF RFC 4632 &#8211; Classless Inter-domain Routing: Address Assignment and Aggregation<\/a> \u2014 rfc-editor.org<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Resources running at the same cloud provider do not automatically share a network. A hypothetical AWS lab explores VPC address planning, subnet routes, and access boundaries between application tiers.<\/p>\n","protected":false},"author":2,"featured_media":1127,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-1129","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-computing"],"lang":"en","translations":{"en":1129,"tr":1128},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/posts\/1129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/comments?post=1129"}],"version-history":[{"count":1,"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/posts\/1129\/revisions"}],"predecessor-version":[{"id":1131,"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/posts\/1129\/revisions\/1131"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/media\/1127"}],"wp:attachment":[{"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/media?parent=1129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/categories?post=1129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vps.tc\/blog\/wp-json\/wp\/v2\/tags?post=1129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}