<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rodolfo Henrique</title>
    <description>The latest articles on DEV Community by Rodolfo Henrique (@rodolfocoding).</description>
    <link>https://dev.to/rodolfocoding</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3137981%2F1df1eb0f-b5c2-4b76-a654-26c51dfc6e4f.jpg</url>
      <title>DEV Community: Rodolfo Henrique</title>
      <link>https://dev.to/rodolfocoding</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rodolfocoding"/>
    <language>en</language>
    <item>
      <title>How to connect multiple VPCs with AWS Transit Gateway</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:48:08 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/how-to-connect-multiple-vpcs-with-aws-transit-gateway-1o38</link>
      <guid>https://dev.to/rodolfocoding/how-to-connect-multiple-vpcs-with-aws-transit-gateway-1o38</guid>
      <description>&lt;p&gt;Portuguese version: &lt;a href="https://dev.to/rodolfocoding/como-conectar-varias-vpcs-com-o-aws-transit-gateway-1566-temp-slug-9497365"&gt;Como conectar várias VPCs com o AWS Transit Gateway&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two applications on AWS. Each one lives in its own network. One day a development server needs to reach a directory that lives in another VPC, the shared-services network. The question sounds simple: how do you join those networks?&lt;/p&gt;

&lt;p&gt;AWS gives you more than one answer. VPC Peering handles two networks cleanly. When you add a staging VPC, a production VPC, and a shared-services VPC, the same pattern turns into a mesh. AWS Transit Gateway shows up at that point: a hub in the middle, instead of a cable between every pair.&lt;/p&gt;

&lt;p&gt;This is not a console click-through. It is the topology: what each piece does, where the packet goes, and when Peering is still the right tool.&lt;/p&gt;

&lt;p&gt;The rest of this article uses a few terms over and over. Here they are.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;VPC&lt;/strong&gt; (Virtual Private Cloud) is the virtual network for your account in one &lt;strong&gt;Region&lt;/strong&gt;. A Region is a geographic cluster of data centers, for example &lt;code&gt;us-east-1&lt;/code&gt; (N. Virginia). Instances, load balancers, and databases live inside the VPC. One VPC does not talk to another VPC by default. They are isolated by default.&lt;/p&gt;

&lt;p&gt;AWS splits each Region into &lt;strong&gt;Availability Zones&lt;/strong&gt;: separate data centers in the same Region. If one zone fails, another can keep running. The letter at the end of the name (&lt;code&gt;us-east-1a&lt;/code&gt;, &lt;code&gt;us-east-1b&lt;/code&gt;) is the zone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CIDR&lt;/strong&gt; is how you write that network's IP range. In &lt;code&gt;10.0.0.0/16&lt;/code&gt;, the first 16 bits identify the network. The remaining 16 bits identify hosts: 65,536 addresses, from &lt;code&gt;10.0.0.0&lt;/code&gt; to &lt;code&gt;10.0.255.255&lt;/code&gt;. The &lt;code&gt;10.&lt;/code&gt; prefix is private. It is not a public internet address. Two VPCs that must communicate cannot share the same block. If the ranges overlap, Peering refuses the connection. Transit Gateway may still accept the attachment, but it &lt;strong&gt;does not propagate&lt;/strong&gt; the overlapping CIDR and &lt;strong&gt;does not route&lt;/strong&gt; between identical or overlapping CIDRs. In both cases those two networks never talk.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;subnet&lt;/strong&gt; is a slice of the VPC in one Availability Zone. An EC2 instance does not "live in the VPC" in the abstract. It gets an &lt;strong&gt;elastic network interface&lt;/strong&gt; (ENI), a virtual network adapter, and that interface sits in a subnet.&lt;/p&gt;

&lt;p&gt;The VPC &lt;strong&gt;route table&lt;/strong&gt; is the list a subnet consults for the next hop. Destination &lt;code&gt;10.0.0.0/16&lt;/code&gt; with target &lt;code&gt;local&lt;/code&gt; means: this address is in this VPC, deliver it here. Any other destination needs another row. Without that row, the packet does not leave.&lt;/p&gt;

&lt;p&gt;These are the four VPCs used throughout. The CIDRs below are the lab CIDRs. When an official AWS diagram shows &lt;code&gt;VPC A&lt;/code&gt; and &lt;code&gt;10.1.0.0/16&lt;/code&gt;, ignore the numbers in the drawing and use this table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;VPC&lt;/th&gt;
&lt;th&gt;CIDR&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-DEV&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;development&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-HML&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;staging&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-PROD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-SHARED&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;shared services (a repository or a directory, for example)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  1. Two VPCs: VPC Peering is enough
&lt;/h2&gt;

&lt;p&gt;Start with &lt;code&gt;VPC-DEV&lt;/code&gt; (&lt;code&gt;10.0.0.0/16&lt;/code&gt;) and &lt;code&gt;VPC-SHARED&lt;/code&gt; (&lt;code&gt;10.3.0.0/16&lt;/code&gt;). A service in DEV needs the directory in SHARED. Both networks are in the same Region. The CIDRs do not overlap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VPC Peering&lt;/strong&gt; is a network connection between exactly two VPCs. Traffic uses private IP addresses. It does not traverse the public internet. AWS builds it on the existing VPC infrastructure: it is not a VPN, it is not extra hardware in the path, and the documentation treats the connection as having no single point of failure and no bandwidth bottleneck of its own.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frxc2yv6m0uolqxt81qv0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frxc2yv6m0uolqxt81qv0.png" alt="Two VPCs joined by a VPC peering connection." width="314" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;VPC peering configurations with routes to an entire VPC&lt;/a&gt;, Amazon VPC. In the diagram, VPC A and VPC B. Read A as &lt;code&gt;VPC-DEV&lt;/code&gt; and B as &lt;code&gt;VPC-SHARED&lt;/code&gt;. Lab CIDRs are the ones in the table above, not whatever the official drawing happens to show.&lt;/p&gt;

&lt;p&gt;Peering by itself does not move any packets. Each VPC needs a route that sends the other VPC's CIDR to the peering connection (the identifier starts with &lt;code&gt;pcx-&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;VPC-DEV&lt;/code&gt; route table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;td&gt;traffic for this VPC stays here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pcx-…&lt;/code&gt; (peering to SHARED)&lt;/td&gt;
&lt;td&gt;anything for SHARED leaves through Peering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;VPC-SHARED&lt;/code&gt; route table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;td&gt;traffic for this VPC stays here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pcx-…&lt;/code&gt; (peering to DEV)&lt;/td&gt;
&lt;td&gt;anything for DEV leaves through Peering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Path of a packet from server &lt;code&gt;10.0.10.20&lt;/code&gt; in DEV to directory &lt;code&gt;10.3.10.5&lt;/code&gt; in SHARED:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The DEV subnet consults the VPC route table.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;10.3.10.5&lt;/code&gt; matches &lt;code&gt;10.3.0.0/16&lt;/code&gt;. The target is the peering connection.&lt;/li&gt;
&lt;li&gt;AWS delivers the packet into &lt;code&gt;VPC-SHARED&lt;/code&gt; on the private path.&lt;/li&gt;
&lt;li&gt;In SHARED, &lt;code&gt;10.3.10.5&lt;/code&gt; is local. The directory interface receives it.&lt;/li&gt;
&lt;li&gt;The reply comes back through the same peering connection, because the SHARED table has the reverse route.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For two VPCs, that is enough. There is no hub in the middle. There is no extra route table beyond the VPC tables. Control is pairwise: if a route is missing, the networks do not talk.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. More VPCs: the Peering mesh
&lt;/h2&gt;

&lt;p&gt;Add &lt;code&gt;VPC-HML&lt;/code&gt; (&lt;code&gt;10.1.0.0/16&lt;/code&gt;) and &lt;code&gt;VPC-PROD&lt;/code&gt; (&lt;code&gt;10.2.0.0/16&lt;/code&gt;). Now all four networks need to talk. The DEV-SHARED peering from section 1 is still there. You still need the other connections.&lt;/p&gt;

&lt;p&gt;This is the rule that changes the design. &lt;strong&gt;VPC Peering is not transitive.&lt;/strong&gt; If DEV is peered with SHARED and DEV is peered with PROD, SHARED and PROD &lt;strong&gt;do not&lt;/strong&gt; talk through DEV. AWS does not let a VPC act as a bridge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh4iqm0egbl92fpuuy9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh4iqm0egbl92fpuuy9b.png" alt="One central VPC peered to two others, with no peering between the spokes." width="481" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;One VPC peered with two VPCs&lt;/a&gt;, Amazon VPC. VPC B and VPC C do not exchange traffic through VPC A.&lt;/p&gt;

&lt;p&gt;In the diagram the center looks like a hub. It is not. Each line is a separate peering connection. Without the third line, the two spokes cannot reach each other.&lt;/p&gt;

&lt;p&gt;Three networks that all talk need three connections. After section 1 you already have DEV-SHARED. A full mesh of four VPCs needs six. The formula is &lt;code&gt;n × (n − 1) / 2&lt;/code&gt;. Three VPCs: three connections. Four VPCs: &lt;strong&gt;six&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuky7zqii3o0v93ca7mn0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuky7zqii3o0v93ca7mn0.png" alt="Three VPCs in a full VPC Peering mesh." width="481" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;Three VPCs peered together&lt;/a&gt;, Amazon VPC. Three connections, one between each pair. Four VPCs follow the same pattern, with six lines. AWS does not publish a diagram that uses exactly &lt;code&gt;VPC-DEV&lt;/code&gt;, &lt;code&gt;VPC-HML&lt;/code&gt;, &lt;code&gt;VPC-PROD&lt;/code&gt;, and &lt;code&gt;VPC-SHARED&lt;/code&gt;. A custom drawing of those four boxes would make the count obvious. Until that drawing exists, use the table below and, to see the mesh actually explode, the official seven-VPC diagram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpk67z89x6m45c1dr6i36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpk67z89x6m45c1dr6i36.png" alt="Full VPC Peering mesh among seven VPCs." width="401" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;Multiple VPCs peered together&lt;/a&gt;, Amazon VPC. Seven VPCs, 21 connections.&lt;/p&gt;

&lt;p&gt;Mesh for the four VPCs in this article:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Connection&lt;/th&gt;
&lt;th&gt;CIDRs the routes must cover&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DEV-HML&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.0.0.0/16&lt;/code&gt; and &lt;code&gt;10.1.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DEV-PROD&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.0.0.0/16&lt;/code&gt; and &lt;code&gt;10.2.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DEV-SHARED&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.0.0.0/16&lt;/code&gt; and &lt;code&gt;10.3.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HML-PROD&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.1.0.0/16&lt;/code&gt; and &lt;code&gt;10.2.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HML-SHARED&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.1.0.0/16&lt;/code&gt; and &lt;code&gt;10.3.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PROD-SHARED&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.2.0.0/16&lt;/code&gt; and &lt;code&gt;10.3.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;VPC-DEV&lt;/code&gt; route table, in this design, is no longer one extra row. It has three: HML, PROD, and SHARED, each with its own &lt;code&gt;pcx-&lt;/code&gt;. When a fifth VPC arrives, each of the four existing ones gains another route and another peering connection. Operations grow with the product, not the sum.&lt;/p&gt;

&lt;p&gt;Peering is still the right tool for a pair, or for a hub VPC that other VPCs reach without needing to reach each other (the "one peered with two" drawing, with no spoke-to-spoke traffic). It stops scaling well once every VPC must talk to every other VPC.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The same VPCs, now on a hub
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;AWS Transit Gateway&lt;/strong&gt; is a Regional virtual router. It forwards packets by &lt;strong&gt;destination IP address&lt;/strong&gt; (layer 3), not by the adapter's MAC address. VPCs no longer connect to each other. Each one connects once to the gateway. Traffic between them goes through that center. AWS calls this a &lt;strong&gt;hub-and-spoke&lt;/strong&gt; topology: the Transit Gateway is the hub, each VPC is a spoke.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;attachment&lt;/strong&gt; is how a resource joins the Transit Gateway. For this article, the attachment that matters is the VPC attachment. AWS also accepts Site-to-Site VPN, Direct Connect gateways, Connect (SD-WAN), Transit Gateway peering, and, in newer scenarios, network function attachments. We will not configure those other types here. They exist so you do not assume Transit Gateway only talks to VPCs.&lt;/p&gt;

&lt;p&gt;When you create a VPC attachment, you pick &lt;strong&gt;one subnet per Availability Zone&lt;/strong&gt;. AWS places an ENI in that subnet. That ENI is the Transit Gateway's entry and exit in that zone. A resource in a zone with no attachment &lt;strong&gt;cannot reach&lt;/strong&gt; the gateway. The documentation recommends enabling more than one zone.&lt;/p&gt;

&lt;p&gt;That attachment subnet does &lt;strong&gt;not&lt;/strong&gt; have to be the application subnet. AWS's design guidance is a small subnet, for example &lt;code&gt;/28&lt;/code&gt;, used only by Transit Gateway, in each zone you enable. Keep the network ACL on that subnet open. Workloads stay in their own subnets. Those workload subnets, in the same zone, still need a route to &lt;code&gt;tgw-&lt;/code&gt; in the VPC route table. Without that route, the application's packet never reaches the gateway ENI.&lt;/p&gt;

&lt;p&gt;Transit Gateway is highly available by design. A second gateway in the same Region is not what makes it available. You add another gateway for a separate routing domain, to limit the blast radius of a bad change, or for another Region (disaster recovery).&lt;/p&gt;

&lt;p&gt;The attachment, by itself, still does not move any packets. You need two different kinds of route table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VPC route table.&lt;/strong&gt; It still sits on the subnet, as with Peering. Instead of target &lt;code&gt;pcx-&lt;/code&gt;, the target is now the Transit Gateway (&lt;code&gt;tgw-…&lt;/code&gt;). Without that route, the packet never leaves the VPC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transit Gateway route table.&lt;/strong&gt; This is a different table, inside the gateway. It does not replace the VPC table. The VPC table answers: "should this packet go to the Transit Gateway?" The Transit Gateway table answers: "it arrived; which attachment do I send it to?"&lt;/p&gt;

&lt;p&gt;By default the Transit Gateway comes with a default route table. That table is the default association table and the default propagation table. If you turn both options off at creation time, AWS does not create a default table. Each attachment is &lt;strong&gt;associated&lt;/strong&gt; with exactly one gateway route table. The same attachment can &lt;strong&gt;propagate&lt;/strong&gt; the VPC CIDR into one or more tables. Association is the map the attachment reads when a packet &lt;strong&gt;arrives from it&lt;/strong&gt;. Propagation is the advertisement: "this network exists, install the CIDR in this table."&lt;/p&gt;

&lt;p&gt;The official centralized-router diagram shows three VPCs and, in the same drawing, a VPN. The VPN is extra. This lab needs the hub and the spokes. Ignore the CIDRs in the screenshot (&lt;code&gt;10.1&lt;/code&gt;, &lt;code&gt;10.2&lt;/code&gt;, &lt;code&gt;10.3&lt;/code&gt;, &lt;code&gt;10.99.99&lt;/code&gt;). Use &lt;code&gt;10.0&lt;/code&gt;, &lt;code&gt;10.1&lt;/code&gt;, &lt;code&gt;10.2&lt;/code&gt;, and &lt;code&gt;10.3&lt;/code&gt; from the lab table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftn2walpa9mecmcb1j8ry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftn2walpa9mecmcb1j8ry.png" alt="Three VPCs and a VPN attached to a Transit Gateway." width="445" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/how-transit-gateways-work.html" rel="noopener noreferrer"&gt;How AWS Transit Gateway works&lt;/a&gt;, Amazon VPC. The official drawing has three VPCs and a VPN. The fourth VPC in this article (&lt;code&gt;VPC-SHARED&lt;/code&gt;) joins the same way: one more attachment, one more row in the gateway table. There is no official diagram with exactly these four boxes; the pattern is hub-and-spoke.&lt;/p&gt;

&lt;p&gt;With four attachments, the default table, and default association and propagation enabled, the Transit Gateway route table looks like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-DEV&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-HML&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-PROD&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-SHARED&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In &lt;code&gt;VPC-DEV&lt;/code&gt;, the workload subnet route table (no default route to the gateway):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The centralized-router example in the docs uses &lt;code&gt;0.0.0.0/0&lt;/code&gt; pointed at the Transit Gateway because that example also has a VPN: anything that is not local goes to the gateway and, from there, can continue to the office. With no VPN and no matching route on the gateway, a &lt;code&gt;0.0.0.0/0&lt;/code&gt; to &lt;code&gt;tgw-&lt;/code&gt; blackholes the VPC's internet traffic. That is why this lab lists the other VPCs' CIDRs one by one.&lt;/p&gt;

&lt;p&gt;Path from &lt;code&gt;10.0.10.20&lt;/code&gt; in DEV to &lt;code&gt;10.2.10.8&lt;/code&gt; in PROD, now through the hub:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The subnet table in DEV sees &lt;code&gt;10.2.0.0/16&lt;/code&gt; → &lt;code&gt;tgw-…&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The packet enters the Transit Gateway on the DEV attachment.&lt;/li&gt;
&lt;li&gt;The gateway looks up the route table &lt;strong&gt;associated&lt;/strong&gt; with that attachment. On the default table, it finds &lt;code&gt;10.2.0.0/16&lt;/code&gt; → PROD attachment.&lt;/li&gt;
&lt;li&gt;If the PROD attachment exists in the same Availability Zone the packet came from, the gateway uses that zone. If it does not, the gateway picks a zone where the PROD attachment is present.&lt;/li&gt;
&lt;li&gt;In PROD, the VPC table delivers &lt;code&gt;10.2.10.8&lt;/code&gt; as local.&lt;/li&gt;
&lt;li&gt;The reply takes the reverse path: PROD subnet table → Transit Gateway → DEV attachment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Four VPCs, four attachments. A fifth VPC needs a fifth attachment, a route on the gateway (often just CIDR propagation), and a row in the VPC tables that should reach it. You no longer manage &lt;code&gt;n × (n − 1) / 2&lt;/code&gt; connections. You manage &lt;code&gt;n&lt;/code&gt; spokes.&lt;/p&gt;

&lt;p&gt;The AWS VPC-to-VPC connectivity whitepaper shows the same hub, including Transit Gateways in more than one Region joined by peering. That drawing is the next step: a Transit Gateway is a &lt;strong&gt;Regional&lt;/strong&gt; resource; another Region needs another gateway and a peering attachment between them. Treat it as background, not as the topology this article builds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn171s6ohs8t89w0rad81.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn171s6ohs8t89w0rad81.png" alt="Transit Gateways in more than one Region, each with attached VPCs." width="800" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://docs.aws.amazon.com/whitepapers/latest/aws-vpc-connectivity-options/aws-transit-gateway.html" rel="noopener noreferrer"&gt;AWS Transit Gateway&lt;/a&gt;, &lt;em&gt;Amazon VPC Connectivity Options&lt;/em&gt; whitepaper.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Keep environments apart without removing the hub
&lt;/h2&gt;

&lt;p&gt;In the previous scenario, DEV can reach PROD. In many accounts that is exactly what you &lt;strong&gt;do not&lt;/strong&gt; want. Staging should not write to the production database. Production should not depend on a developer instance.&lt;/p&gt;

&lt;p&gt;Transit Gateway does not isolate by magic. The default table, with every attachment associated and every CIDR propagated, is a single router: if you are attached, you can talk. Isolation comes from &lt;strong&gt;more than one route table on the gateway&lt;/strong&gt;, choosing what each attachment reads and what each attachment advertises.&lt;/p&gt;

&lt;p&gt;AWS calls this "isolated routers that use a shared service". Three workload VPCs do not talk to each other. All of them talk to a shared-services VPC (and, in the official drawing, also to a VPN).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy9lrlg533636f1w36u18.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy9lrlg533636f1w36u18.png" alt="Isolated VPCs and a shared-services VPC on the same Transit Gateway." width="512" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/how-transit-gateways-work.html" rel="noopener noreferrer"&gt;Example: Isolated VPCs with shared services&lt;/a&gt;, Amazon VPC. &lt;strong&gt;Ignore the CIDRs in this screenshot.&lt;/strong&gt; In the official drawing, VPC A &lt;code&gt;10.1.0.0/16&lt;/code&gt;, VPC B &lt;code&gt;10.2.0.0/16&lt;/code&gt;, and VPC C &lt;code&gt;10.3.0.0/16&lt;/code&gt; are isolated; VPC D &lt;code&gt;10.4.0.0/16&lt;/code&gt; is shared services; there is a VPN &lt;code&gt;10.99.99.0/24&lt;/code&gt;. In this lab: A/B/C are &lt;code&gt;VPC-DEV&lt;/code&gt; (&lt;code&gt;10.0.0.0/16&lt;/code&gt;), &lt;code&gt;VPC-HML&lt;/code&gt; (&lt;code&gt;10.1.0.0/16&lt;/code&gt;), and &lt;code&gt;VPC-PROD&lt;/code&gt; (&lt;code&gt;10.2.0.0/16&lt;/code&gt;). D is &lt;code&gt;VPC-SHARED&lt;/code&gt; (&lt;code&gt;10.3.0.0/16&lt;/code&gt;). The &lt;code&gt;10.3&lt;/code&gt; in the screenshot is isolated VPC C, not SHARED. The VPN in the screenshot is not part of the lab. The &lt;code&gt;0.0.0.0/0&lt;/code&gt; that the docs put in the VPC tables for that example exists because of the VPN. With no VPN, do not point &lt;code&gt;0.0.0.0/0&lt;/code&gt; at &lt;code&gt;tgw-&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two route tables on the Transit Gateway:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;RT-ISOLATED&lt;/code&gt;, associated with the DEV, HML, and PROD attachments.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RT-SHARED&lt;/code&gt;, associated with the SHARED attachment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Propagation, following the same pattern as the documentation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DEV, HML, and PROD &lt;strong&gt;propagate&lt;/strong&gt; only to &lt;code&gt;RT-SHARED&lt;/code&gt;. SHARED then learns &lt;code&gt;10.0.0.0/16&lt;/code&gt;, &lt;code&gt;10.1.0.0/16&lt;/code&gt;, and &lt;code&gt;10.2.0.0/16&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;SHARED &lt;strong&gt;propagates&lt;/strong&gt; to &lt;code&gt;RT-ISOLATED&lt;/code&gt;. The three workload VPCs then learn &lt;code&gt;10.3.0.0/16&lt;/code&gt;. The docs also propagate SHARED into the shared table. SHARED's own CIDR on &lt;code&gt;RT-SHARED&lt;/code&gt; is not what forwards the return path: traffic already inside SHARED uses the VPC &lt;code&gt;local&lt;/code&gt; route.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;RT-ISOLATED&lt;/code&gt; (what DEV, HML, and PROD read):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-SHARED&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;There is no row for &lt;code&gt;10.0.0.0/16&lt;/code&gt;, &lt;code&gt;10.1.0.0/16&lt;/code&gt;, or &lt;code&gt;10.2.0.0/16&lt;/code&gt;. A packet from DEV to PROD hits the gateway, the associated table has no route, and the traffic does not continue. The documentation describes that case as packets that "are blocked because there is no route for them in the transit gateway route table".&lt;/p&gt;

&lt;p&gt;&lt;code&gt;RT-SHARED&lt;/code&gt; (what SHARED reads):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-DEV&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-HML&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;VPC-PROD&lt;/code&gt; attachment&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are the VPC route tables for this scenario. DEV, HML, and PROD only know SHARED via &lt;code&gt;tgw-&lt;/code&gt;. SHARED knows all three.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;VPC-DEV&lt;/code&gt; (HML and PROD look the same, with a different &lt;code&gt;local&lt;/code&gt; CIDR):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;VPC-SHARED&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destination&lt;/th&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Allowed path, DEV → SHARED (&lt;code&gt;10.0.10.20&lt;/code&gt; to &lt;code&gt;10.3.10.5&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;VPC table in DEV: &lt;code&gt;10.3.0.0/16&lt;/code&gt; → &lt;code&gt;tgw-…&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The packet enters on the DEV attachment. The gateway reads &lt;code&gt;RT-ISOLATED&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Destination &lt;code&gt;10.3.10.5&lt;/code&gt; matches &lt;code&gt;10.3.0.0/16&lt;/code&gt; → SHARED attachment.&lt;/li&gt;
&lt;li&gt;In SHARED, the VPC table delivers &lt;code&gt;10.3.10.5&lt;/code&gt; as local.&lt;/li&gt;
&lt;li&gt;The reply: the VPC table in SHARED sees &lt;code&gt;10.0.0.0/16&lt;/code&gt; → &lt;code&gt;tgw-…&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The packet enters on the SHARED attachment. The gateway reads &lt;code&gt;RT-SHARED&lt;/code&gt;, finds &lt;code&gt;10.0.0.0/16&lt;/code&gt; → DEV.&lt;/li&gt;
&lt;li&gt;In DEV, &lt;code&gt;10.0.10.20&lt;/code&gt; is local.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Blocked path, DEV → PROD (&lt;code&gt;10.0.10.20&lt;/code&gt; to &lt;code&gt;10.2.10.8&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;VPC-DEV&lt;/code&gt; table in this scenario has &lt;strong&gt;no&lt;/strong&gt; route for &lt;code&gt;10.2.0.0/16&lt;/code&gt;. The packet never leaves the VPC.&lt;/li&gt;
&lt;li&gt;If someone adds that route by mistake, the packet reaches the gateway and &lt;code&gt;RT-ISOLATED&lt;/code&gt; has no &lt;code&gt;10.2.0.0/16&lt;/code&gt;. The Transit Gateway does not forward it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Two notes the documentation keeps repeating and beginners keep mixing up.&lt;/p&gt;

&lt;p&gt;First: &lt;strong&gt;associate&lt;/strong&gt; and &lt;strong&gt;propagate&lt;/strong&gt; are not the same action. An attachment associated with &lt;code&gt;RT-ISOLATED&lt;/code&gt; does not automatically install its CIDR in &lt;code&gt;RT-ISOLATED&lt;/code&gt;. If DEV, HML, and PROD also propagated into &lt;code&gt;RT-ISOLATED&lt;/code&gt;, the three would see each other again. Isolation in this scenario exists because the workload VPCs &lt;strong&gt;do not&lt;/strong&gt; propagate into the table they themselves read.&lt;/p&gt;

&lt;p&gt;Second: the VPC table and the Transit Gateway table work in sequence, not in parallel. The VPC decides whether the packet leaves toward &lt;code&gt;tgw-&lt;/code&gt;. The Transit Gateway decides the destination attachment. Security groups and network ACLs still apply on the instance interface. A route on the gateway does not open port 3306 by itself.&lt;/p&gt;

&lt;p&gt;AWS also lets you install a &lt;strong&gt;blackhole&lt;/strong&gt; route in a Transit Gateway table: the prefix matches and the packet is dropped on purpose. That is extra insurance, not the main mechanism in this scenario.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Peering or Transit Gateway
&lt;/h2&gt;

&lt;p&gt;Transit Gateway is not a strict upgrade from Peering. The right tool depends on the design.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;VPC Peering&lt;/th&gt;
&lt;th&gt;Transit Gateway&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;What it is&lt;/td&gt;
&lt;td&gt;a one-to-one connection between two VPCs&lt;/td&gt;
&lt;td&gt;a Regional virtual router, hub-and-spoke&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Transitive routing&lt;/td&gt;
&lt;td&gt;no. Without a third connection, the spokes do not talk&lt;/td&gt;
&lt;td&gt;yes, among attachments that the gateway table can reach&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Growth&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;n × (n − 1) / 2&lt;/code&gt; connections for a full mesh&lt;/td&gt;
&lt;td&gt;one attachment per VPC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where you edit routes&lt;/td&gt;
&lt;td&gt;VPC route tables only&lt;/td&gt;
&lt;td&gt;VPC tables and gateway tables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Isolating environments&lt;/td&gt;
&lt;td&gt;omit the peering for that pair&lt;/td&gt;
&lt;td&gt;different tables, associations, and propagations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Region&lt;/td&gt;
&lt;td&gt;intra-Region or inter-Region peering, directly between two VPCs&lt;/td&gt;
&lt;td&gt;the gateway is Regional; another Region needs another gateway and peering between gateways&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overlapping CIDR&lt;/td&gt;
&lt;td&gt;the peering connection fails; the path never exists&lt;/td&gt;
&lt;td&gt;the attachment can exist; the overlapping CIDR is not propagated and the gateway does not route between those blocks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;When it usually fits&lt;/td&gt;
&lt;td&gt;a pair, or a hub VPC that other VPCs reach without needing to reach each other&lt;/td&gt;
&lt;td&gt;many VPCs, hybrid (VPN / Direct Connect), segmentation on the same hub&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost (the model, not a number)&lt;/td&gt;
&lt;td&gt;no hourly attachment; data transfer applies, including when traffic crosses an Availability Zone&lt;/td&gt;
&lt;td&gt;hourly per attachment and processing per GB sent to the gateway; see the &lt;a href="https://aws.amazon.com/transit-gateway/pricing/" rel="noopener noreferrer"&gt;pricing page&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Peering is still the better fit when the problem is "these two VPCs need to talk" and you do not expect a mesh. There is no hourly attachment. Bandwidth between the two VPCs does not take an extra hop through a managed router.&lt;/p&gt;

&lt;p&gt;Transit Gateway starts to earn its keep when the question changes: "these ten VPCs, and the ones that will show up later, need one place for the policy of who talks to whom." Then the extra hop and the attachment charge are the cost of not keeping twenty-one &lt;code&gt;pcx-&lt;/code&gt; connections.&lt;/p&gt;

&lt;p&gt;Two limits worth knowing, both from the documentation, without turning the article into a quota sheet:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Transit Gateway cannot have two VPC attachments to the &lt;strong&gt;same&lt;/strong&gt; VPC.&lt;/li&gt;
&lt;li&gt;The default quota is 5,000 attachments per gateway and 20 route tables per gateway, both adjustable. In a small account, the thing that bites first is a bad design: one default table with everything mixed together.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is also an MTU difference. An intra-Region VPC peering connection supports up to 9001 bytes. Between VPCs, Direct Connect, Connect, and Transit Gateway peering, the gateway works with an MTU of 8500 bytes. VPN stays at 1500. When you migrate from Peering to Transit Gateway, a jumbo packet sent one way and returned the other can be dropped. AWS tells you to update both sides together.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you have now
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;VPC-DEV&lt;/code&gt;, &lt;code&gt;VPC-HML&lt;/code&gt;, &lt;code&gt;VPC-PROD&lt;/code&gt;, and &lt;code&gt;VPC-SHARED&lt;/code&gt; are four isolated networks until someone builds a path. Peering builds the path for one pair. With no transitivity, a mesh needs one connection per pair. Transit Gateway swaps that mesh for spokes on a hub. The VPC route table still decides whether the packet leaves. The Transit Gateway route table decides which attachment it goes to. Association and propagation, used with two tables, keep DEV, HML, and PROD apart and still let all three reach SHARED.&lt;/p&gt;

&lt;p&gt;The service is not mandatory in a two-VPC account. It starts to make sense when most of the operational load is keeping &lt;code&gt;pcx-&lt;/code&gt; connections, or when the policy "production does not talk to development, both talk to shared" needs to live in one place.&lt;/p&gt;

&lt;p&gt;Official references used in this article: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html" rel="noopener noreferrer"&gt;What is VPC peering?&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/vpc-peering-basics.html" rel="noopener noreferrer"&gt;How VPC peering connections work&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;VPC peering configurations&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html" rel="noopener noreferrer"&gt;What is a transit gateway?&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/how-transit-gateways-work.html" rel="noopener noreferrer"&gt;How AWS Transit Gateway works&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-vpc-attachments.html" rel="noopener noreferrer"&gt;Amazon VPC attachments&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-route-tables.html" rel="noopener noreferrer"&gt;Transit gateway route tables&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-best-design-practices.html" rel="noopener noreferrer"&gt;Transit gateway design best practices&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/transit-gateway-quotas.html" rel="noopener noreferrer"&gt;AWS Transit Gateway quotas&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/transit-gateway.html" rel="noopener noreferrer"&gt;AWS Transit Gateway&lt;/a&gt; in the multi-VPC whitepaper, &lt;a href="https://docs.aws.amazon.com/whitepapers/latest/aws-vpc-connectivity-options/aws-transit-gateway.html" rel="noopener noreferrer"&gt;Amazon VPC Connectivity Options&lt;/a&gt;, and &lt;a href="https://aws.amazon.com/transit-gateway/pricing/" rel="noopener noreferrer"&gt;AWS Transit Gateway pricing&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>vpc</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Como conectar várias VPCs com o AWS Transit Gateway</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:47:54 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/como-conectar-varias-vpcs-com-o-aws-transit-gateway-3mna</link>
      <guid>https://dev.to/rodolfocoding/como-conectar-varias-vpcs-com-o-aws-transit-gateway-3mna</guid>
      <description>&lt;p&gt;English version: &lt;a href="https://dev.to/rodolfocoding/how-to-connect-multiple-vpcs-with-aws-transit-gateway-4gb4-temp-slug-6178478"&gt;How to connect multiple VPCs with AWS Transit Gateway&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Duas aplicações na AWS. Cada uma vive na própria rede. Um dia um servidor de desenvolvimento precisa alcançar um diretório que mora em outra VPC, a de serviços compartilhados. A pergunta parece simples: como ligar essas redes?&lt;/p&gt;

&lt;p&gt;A AWS oferece mais de um jeito. O primeiro, o VPC Peering, resolve bem o caso de duas redes. Quando a conta ganha homologação, produção e mais um serviço compartilhado, o mesmo desenho vira uma teia. O AWS Transit Gateway entra exatamente nesse ponto: um hub no meio, em vez de um cabo entre cada par.&lt;/p&gt;

&lt;p&gt;Este texto não é um clique a clique no console. É o mapa da topologia: o que cada peça faz, por onde o pacote anda e quando o Peering ainda basta.&lt;/p&gt;

&lt;p&gt;Antes dos desenhos, as palavras que o restante do artigo usa o tempo todo.&lt;/p&gt;

&lt;p&gt;Uma &lt;strong&gt;VPC&lt;/strong&gt; (Virtual Private Cloud) é a rede virtual da sua conta em uma &lt;strong&gt;região&lt;/strong&gt;. Região é o conjunto de datacenters de um lugar, por exemplo &lt;code&gt;us-east-1&lt;/code&gt; (Norte da Virgínia). Dentro da VPC ficam as máquinas, os balanceadores, os bancos. Uma VPC não conversa com outra VPC por acaso. Elas nascem isoladas.&lt;/p&gt;

&lt;p&gt;A AWS divide cada região em &lt;strong&gt;zonas de disponibilidade&lt;/strong&gt; (Availability Zones): datacenters separados dentro da mesma região. Se uma zona cai, a outra continua. A letra no final do nome (&lt;code&gt;us-east-1a&lt;/code&gt;, &lt;code&gt;us-east-1b&lt;/code&gt;) é a zona.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CIDR&lt;/strong&gt; é a forma de escrever o intervalo de IPs da rede. Em &lt;code&gt;10.0.0.0/16&lt;/code&gt;, os primeiros 16 bits identificam a rede. Restam 16 bits para os hosts: 65.536 endereços, de &lt;code&gt;10.0.0.0&lt;/code&gt; a &lt;code&gt;10.0.255.255&lt;/code&gt;. O prefixo &lt;code&gt;10.&lt;/code&gt; é privado. Não serve como endereço na internet pública. Duas VPCs que vão se comunicar não podem usar o mesmo bloco. Se as faixas se sobrepõem, o Peering recusa a conexão. O Transit Gateway até aceita o attachment, mas &lt;strong&gt;não propaga&lt;/strong&gt; o CIDR sobreposto e &lt;strong&gt;não roteia&lt;/strong&gt; entre CIDRs iguais ou sobrepostos. Nos dois casos a conversa entre essas redes não acontece.&lt;/p&gt;

&lt;p&gt;Uma &lt;strong&gt;sub-rede&lt;/strong&gt; (subnet) é um pedaço da VPC em uma zona. A instância EC2 não “mora na VPC” de forma abstrata: ela recebe uma &lt;strong&gt;interface de rede elástica&lt;/strong&gt; (ENI), o adaptador de rede virtual, e essa interface fica em uma sub-rede.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;tabela de rotas&lt;/strong&gt; da VPC é a lista que a sub-rede consulta para saber o próximo salto. Destino &lt;code&gt;10.0.0.0/16&lt;/code&gt; com alvo &lt;code&gt;local&lt;/code&gt; significa: esse endereço é desta VPC, entregue aqui dentro. Qualquer outro destino precisa de uma linha extra. Sem essa linha, o pacote não sai.&lt;/p&gt;

&lt;p&gt;Os quatro nomes deste artigo. Estes CIDRs são os do laboratório. Quando um diagrama oficial da AWS mostrar &lt;code&gt;VPC A&lt;/code&gt; e &lt;code&gt;10.1.0.0/16&lt;/code&gt;, ignore os números do desenho e use a tabela:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;VPC&lt;/th&gt;
&lt;th&gt;CIDR&lt;/th&gt;
&lt;th&gt;Papel&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-DEV&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;desenvolvimento&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-HML&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;homologação&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-PROD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;produção&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;VPC-SHARED&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;serviços compartilhados (por exemplo um repositório ou um diretório)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  1. Duas VPCs: o VPC Peering resolve
&lt;/h2&gt;

&lt;p&gt;Comece com &lt;code&gt;VPC-DEV&lt;/code&gt; (&lt;code&gt;10.0.0.0/16&lt;/code&gt;) e &lt;code&gt;VPC-SHARED&lt;/code&gt; (&lt;code&gt;10.3.0.0/16&lt;/code&gt;). Um serviço em DEV precisa do diretório em SHARED. As duas redes estão na mesma região. Os CIDRs não se sobrepõem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VPC Peering&lt;/strong&gt; é uma conexão de rede entre exatamente duas VPCs. O tráfego usa IPs privados. Não passa pela internet pública. A AWS monta isso sobre a infraestrutura da VPC: não é um VPN, não é um hardware extra no meio do caminho, e a documentação trata a conexão como sem ponto único de falha e sem gargalo de banda próprio.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frxc2yv6m0uolqxt81qv0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frxc2yv6m0uolqxt81qv0.png" alt="Duas VPCs ligadas por uma conexão de VPC Peering." width="314" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fonte: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;VPC peering configurations with routes to an entire VPC&lt;/a&gt;, Amazon VPC. No diagrama, VPC A e VPC B. Leia A como &lt;code&gt;VPC-DEV&lt;/code&gt; e B como &lt;code&gt;VPC-SHARED&lt;/code&gt;. Os CIDRs do laboratório são os da tabela do início, não os que o desenho oficial eventualmente mostrar.&lt;/p&gt;

&lt;p&gt;O Peering, sozinho, não move pacote nenhum. Cada VPC precisa de uma rota apontando o CIDR da outra para a conexão de peering (o identificador começa com &lt;code&gt;pcx-&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Tabela de rotas da &lt;code&gt;VPC-DEV&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;th&gt;Significado&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;td&gt;tráfego desta VPC fica aqui&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pcx-…&lt;/code&gt; (peering com SHARED)&lt;/td&gt;
&lt;td&gt;o que for de SHARED sai pelo Peering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Tabela de rotas da &lt;code&gt;VPC-SHARED&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;th&gt;Significado&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;td&gt;tráfego desta VPC fica aqui&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;pcx-…&lt;/code&gt; (peering com DEV)&lt;/td&gt;
&lt;td&gt;o que for de DEV sai pelo Peering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;O caminho de um pacote, do servidor &lt;code&gt;10.0.10.20&lt;/code&gt; em DEV até o diretório &lt;code&gt;10.3.10.5&lt;/code&gt; em SHARED:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A sub-rede de DEV consulta a tabela de rotas da VPC.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;10.3.10.5&lt;/code&gt; cai em &lt;code&gt;10.3.0.0/16&lt;/code&gt;. O alvo é o Peering.&lt;/li&gt;
&lt;li&gt;A AWS entrega o pacote na &lt;code&gt;VPC-SHARED&lt;/code&gt; pelo caminho privado.&lt;/li&gt;
&lt;li&gt;Em SHARED, &lt;code&gt;10.3.10.5&lt;/code&gt; é local. A interface do diretório recebe.&lt;/li&gt;
&lt;li&gt;A resposta volta pelo mesmo Peering, porque a tabela de SHARED tem a rota inversa.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Para duas VPCs, isso é suficiente. Não há hub no meio. Não há tabela de rotas extra além das tabelas das VPCs. O controle é ponta a ponta: quem não tem a rota, não fala.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Várias VPCs: a teia do Peering
&lt;/h2&gt;

&lt;p&gt;Acrescente &lt;code&gt;VPC-HML&lt;/code&gt; (&lt;code&gt;10.1.0.0/16&lt;/code&gt;) e &lt;code&gt;VPC-PROD&lt;/code&gt; (&lt;code&gt;10.2.0.0/16&lt;/code&gt;). Agora as quatro redes precisam falar entre si. O Peering DEV-SHARED da seção 1 continua. Faltam as outras.&lt;/p&gt;

&lt;p&gt;Aqui aparece a regra que muda o desenho. &lt;strong&gt;O VPC Peering não é transitivo.&lt;/strong&gt; Se DEV está peered com SHARED e DEV está peered com PROD, SHARED e PROD &lt;strong&gt;não&lt;/strong&gt; se falam através de DEV. A AWS não deixa uma VPC servir de ponte.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh4iqm0egbl92fpuuy9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh4iqm0egbl92fpuuy9b.png" alt="Uma VPC central peered a outras duas, sem Peering entre as pontas." width="481" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fonte: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;One VPC peered with two VPCs&lt;/a&gt;, Amazon VPC. VPC B e VPC C não trocam tráfego pela VPC A.&lt;/p&gt;

&lt;p&gt;No diagrama, o centro parece um hub. Não é. Cada linha é um Peering separado. Sem a terceira linha, as pontas estão mudas uma para a outra.&lt;/p&gt;

&lt;p&gt;Com três redes se falando, o total é três conexões. Depois da seção 1 você já tem DEV-SHARED. Faltam, por exemplo, DEV-HML, DEV-PROD, HML-PROD, HML-SHARED e PROD-SHARED se a malha for das quatro. A conta da malha completa é &lt;code&gt;n × (n − 1) / 2&lt;/code&gt;. Três VPCs: três conexões. Quatro VPCs: &lt;strong&gt;seis&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuky7zqii3o0v93ca7mn0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuky7zqii3o0v93ca7mn0.png" alt="Três VPCs em malha completa de VPC Peering." width="481" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fonte: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;Three VPCs peered together&lt;/a&gt;, Amazon VPC. Três conexões, uma entre cada par. O padrão para quatro VPCs é o mesmo, com seis linhas. A documentação oficial não publica um diagrama exatamente com &lt;code&gt;VPC-DEV&lt;/code&gt;, &lt;code&gt;VPC-HML&lt;/code&gt;, &lt;code&gt;VPC-PROD&lt;/code&gt; e &lt;code&gt;VPC-SHARED&lt;/code&gt;. Um diagrama próprio com essas quatro caixas deixaria a conta mais óbvia. Enquanto ele não existir, use a tabela abaixo e, para ver a teia crescer de verdade, o desenho oficial de sete VPCs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpk67z89x6m45c1dr6i36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpk67z89x6m45c1dr6i36.png" alt="Malha completa de VPC Peering entre sete VPCs." width="401" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fonte: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;Multiple VPCs peered together&lt;/a&gt;, Amazon VPC. Sete VPCs, 21 conexões.&lt;/p&gt;

&lt;p&gt;Malha das quatro VPCs deste artigo:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Conexão&lt;/th&gt;
&lt;th&gt;CIDRs que a rota precisa alcançar&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;DEV-HML&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.0.0.0/16&lt;/code&gt; e &lt;code&gt;10.1.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DEV-PROD&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.0.0.0/16&lt;/code&gt; e &lt;code&gt;10.2.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DEV-SHARED&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.0.0.0/16&lt;/code&gt; e &lt;code&gt;10.3.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HML-PROD&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.1.0.0/16&lt;/code&gt; e &lt;code&gt;10.2.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HML-SHARED&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.1.0.0/16&lt;/code&gt; e &lt;code&gt;10.3.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PROD-SHARED&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10.2.0.0/16&lt;/code&gt; e &lt;code&gt;10.3.0.0/16&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A tabela de rotas da &lt;code&gt;VPC-DEV&lt;/code&gt;, nesse desenho, deixa de ter uma linha extra. Ela passa a ter três: HML, PROD e SHARED, cada uma com o próprio &lt;code&gt;pcx-&lt;/code&gt;. Quando entra a quinta VPC, cada uma das quatro antigas ganha mais uma rota e mais um Peering. A operação cresce no produto, não na soma.&lt;/p&gt;

&lt;p&gt;O Peering continua certo para um par, ou para um centro que só precisa ser alcançado (o desenho “uma com duas”, sem as pontas se falarem). Ele deixa de ser o desenho confortável quando a malha vira regra.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. O mesmo conjunto, agora num hub
&lt;/h2&gt;

&lt;p&gt;O &lt;strong&gt;AWS Transit Gateway&lt;/strong&gt; é um roteador virtual da região. Ele encaminha pacotes pelo &lt;strong&gt;endereço IP de destino&lt;/strong&gt; (camada 3), não pelo endereço MAC da placa. As VPCs não se ligam mais umas às outras. Cada uma se liga uma vez ao gateway. O tráfego entre elas passa por esse centro. A AWS descreve isso como uma topologia &lt;strong&gt;hub-and-spoke&lt;/strong&gt;: o Transit Gateway é o cubo, cada VPC é um raio.&lt;/p&gt;

&lt;p&gt;Um &lt;strong&gt;attachment&lt;/strong&gt; é a ligação de um recurso ao Transit Gateway. Para este artigo, o attachment que importa é o de VPC. A AWS também aceita VPN Site-to-Site, Direct Connect gateway, Connect (SD-WAN), peering entre Transit Gateways e, em cenários mais novos, network function attachments. Não vamos configurar esses outros tipos aqui. Eles existem para você não achar que o Transit Gateway só fala com VPC.&lt;/p&gt;

&lt;p&gt;Quando você cria um VPC attachment, escolhe &lt;strong&gt;uma sub-rede por zona de disponibilidade&lt;/strong&gt;. A AWS coloca uma ENI nessa sub-rede. Essa ENI é a porta de entrada e de saída do Transit Gateway naquela zona. Recurso em zona sem attachment &lt;strong&gt;não alcança&lt;/strong&gt; o gateway. A recomendação da documentação é habilitar mais de uma zona.&lt;/p&gt;

&lt;p&gt;Essa sub-rede do attachment &lt;strong&gt;não&lt;/strong&gt; precisa ser a sub-rede da aplicação. A prática da AWS é reservar uma sub-rede pequena, por exemplo &lt;code&gt;/28&lt;/code&gt;, só para o Transit Gateway, em cada zona que você habilitar. O network ACL dessa sub-rede fica aberto. As máquinas continuam nas sub-redes de carga. Essas sub-redes de carga, na mesma zona, ainda precisam da rota para o &lt;code&gt;tgw-&lt;/code&gt; na tabela de rotas da VPC. Sem essa rota, o pacote da aplicação não chega na ENI do gateway.&lt;/p&gt;

&lt;p&gt;O Transit Gateway é altamente disponível por desenho. Um segundo gateway na mesma região não é o que garante a disponibilidade. Serve para outro domínio de roteamento, para reduzir o raio de um erro de configuração, ou para outra região (disaster recovery).&lt;/p&gt;

&lt;p&gt;O attachment, sozinho, também não move pacote. Faltam duas tabelas, de tipos diferentes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tabela de rotas da VPC.&lt;/strong&gt; Continua na sub-rede, como no Peering. Em vez do alvo &lt;code&gt;pcx-&lt;/code&gt;, o alvo passa a ser o Transit Gateway (&lt;code&gt;tgw-…&lt;/code&gt;). Sem essa rota, o pacote nem sai da VPC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tabela de rotas do Transit Gateway.&lt;/strong&gt; É outra tabela, dentro do gateway. Ela não substitui a da VPC. A da VPC responde: “este pacote deve ir ao Transit Gateway?”. A do Transit Gateway responde: “chegou aqui; para qual attachment mando?”.&lt;/p&gt;

&lt;p&gt;Por padrão, o Transit Gateway nasce com uma tabela de rotas default. Essa tabela é a de associação default e a de propagação default. Se você desligar as duas opções na criação, a AWS não cria tabela default. Cada attachment se &lt;strong&gt;associa&lt;/strong&gt; a exatamente uma tabela do gateway. O mesmo attachment pode &lt;strong&gt;propagar&lt;/strong&gt; o CIDR da VPC para uma ou mais tabelas. Associação é o mapa que o attachment lê quando um pacote &lt;strong&gt;chega dele&lt;/strong&gt;. Propagação é o anúncio: “esta rede existe, grave o CIDR nesta tabela”.&lt;/p&gt;

&lt;p&gt;A documentação oficial do “roteador centralizado” mostra três VPCs e, no mesmo desenho, um VPN. O VPN não faz parte do laboratório das quatro VPCs. O cubo e os raios, sim. Ignore os CIDRs do print (&lt;code&gt;10.1&lt;/code&gt;, &lt;code&gt;10.2&lt;/code&gt;, &lt;code&gt;10.3&lt;/code&gt;, &lt;code&gt;10.99.99&lt;/code&gt;). Use &lt;code&gt;10.0&lt;/code&gt;, &lt;code&gt;10.1&lt;/code&gt;, &lt;code&gt;10.2&lt;/code&gt; e &lt;code&gt;10.3&lt;/code&gt; da tabela do laboratório.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftn2walpa9mecmcb1j8ry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftn2walpa9mecmcb1j8ry.png" alt="Três VPCs e um VPN ligados a um Transit Gateway." width="445" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fonte: &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/how-transit-gateways-work.html" rel="noopener noreferrer"&gt;How AWS Transit Gateway works&lt;/a&gt;, Amazon VPC. O desenho oficial tem três VPCs e um VPN. A quarta VPC deste artigo (&lt;code&gt;VPC-SHARED&lt;/code&gt;) entra do mesmo jeito: mais um attachment, mais uma linha na tabela do gateway. Não existe diagrama oficial com exatamente essas quatro caixas; o padrão é o hub-and-spoke.&lt;/p&gt;

&lt;p&gt;Quatro attachments, uma tabela default, associação e propagação default ligadas. A tabela do Transit Gateway fica assim:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;th&gt;Tipo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-DEV&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-HML&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-PROD&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-SHARED&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Na &lt;code&gt;VPC-DEV&lt;/code&gt;, a tabela da sub-rede de carga (sem mandar a internet inteira para o gateway):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A documentação do cenário centralizado usa &lt;code&gt;0.0.0.0/0&lt;/code&gt; apontando para o Transit Gateway porque aquele exemplo também tem VPN: o que não for local vai ao gateway e, de lá, pode seguir ao escritório. Sem VPN e sem rota correspondente no gateway, um &lt;code&gt;0.0.0.0/0&lt;/code&gt; para o &lt;code&gt;tgw-&lt;/code&gt; engole o tráfego de internet da VPC e o derruba. Por isso o exemplo daqui lista os CIDRs vizinhos, um a um.&lt;/p&gt;

&lt;p&gt;Caminho de &lt;code&gt;10.0.10.20&lt;/code&gt; em DEV até &lt;code&gt;10.2.10.8&lt;/code&gt; em PROD, agora pelo hub:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A tabela da sub-rede em DEV vê &lt;code&gt;10.2.0.0/16&lt;/code&gt; → &lt;code&gt;tgw-…&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;O pacote entra no Transit Gateway pelo attachment de DEV.&lt;/li&gt;
&lt;li&gt;O gateway consulta a tabela &lt;strong&gt;associada&lt;/strong&gt; a esse attachment. Com a default, encontra &lt;code&gt;10.2.0.0/16&lt;/code&gt; → attachment de PROD.&lt;/li&gt;
&lt;li&gt;Se o attachment de PROD existe na mesma zona de onde o pacote veio, o gateway usa essa zona. Se não existe, escolhe uma zona em que o attachment de PROD esteja presente.&lt;/li&gt;
&lt;li&gt;Em PROD, a tabela da VPC entrega &lt;code&gt;10.2.10.8&lt;/code&gt; como local.&lt;/li&gt;
&lt;li&gt;A resposta faz o caminho inverso: tabela da sub-rede de PROD → Transit Gateway → attachment de DEV.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Quatro VPCs, quatro attachments. A quinta VPC pede o quinto attachment, uma rota no gateway (muitas vezes só a propagação do CIDR) e uma linha nas tabelas das VPCs que devem alcançá-la. A conta deixa de ser &lt;code&gt;n × (n − 1) / 2&lt;/code&gt; conexões e vira &lt;code&gt;n&lt;/code&gt; raios.&lt;/p&gt;

&lt;p&gt;O whitepaper de conectividade VPC-a-VPC da AWS resume o mesmo cubo, inclusive com Transit Gateways em mais de uma região ligados por peering. Esse desenho já é o passo seguinte: o Transit Gateway é um recurso &lt;strong&gt;regional&lt;/strong&gt;; outra região pede outro gateway e um peering entre eles. Fica como referência, não como o laboratório deste texto.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn171s6ohs8t89w0rad81.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn171s6ohs8t89w0rad81.png" alt="Transit Gateways em mais de uma região, cada um com VPCs ligadas." width="800" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fonte: &lt;a href="https://docs.aws.amazon.com/whitepapers/latest/aws-vpc-connectivity-options/aws-transit-gateway.html" rel="noopener noreferrer"&gt;AWS Transit Gateway&lt;/a&gt;, whitepaper &lt;em&gt;Amazon VPC Connectivity Options&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Separar ambientes sem desligar o hub
&lt;/h2&gt;

&lt;p&gt;No cenário anterior, DEV alcança PROD. Em muita conta isso é exatamente o que você &lt;strong&gt;não&lt;/strong&gt; quer. Homologação não deveria escrever no banco de produção. Produção não deveria depender de uma máquina de desenvolvimento.&lt;/p&gt;

&lt;p&gt;O Transit Gateway não isola por mágica. A tabela default, com tudo associado e tudo propagado, é um roteador único: quem está ligado, fala. O isolamento vem de &lt;strong&gt;mais de uma tabela de rotas no gateway&lt;/strong&gt;, escolhendo o que cada attachment lê e o que cada attachment anuncia.&lt;/p&gt;

&lt;p&gt;A documentação oficial chama isso de “isolated routers that use a shared service”. Três VPCs de carga não se falam. Todas falam com uma VPC de serviços compartilhados (e, no desenho oficial, também com um VPN).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy9lrlg533636f1w36u18.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy9lrlg533636f1w36u18.png" alt="VPCs isoladas e uma VPC de serviços compartilhados no mesmo Transit Gateway." width="512" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fonte: &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/how-transit-gateways-work.html" rel="noopener noreferrer"&gt;Example: Isolated VPCs with shared services&lt;/a&gt;, Amazon VPC. &lt;strong&gt;Ignore os CIDRs deste print.&lt;/strong&gt; No desenho oficial, VPC A &lt;code&gt;10.1.0.0/16&lt;/code&gt;, VPC B &lt;code&gt;10.2.0.0/16&lt;/code&gt; e VPC C &lt;code&gt;10.3.0.0/16&lt;/code&gt; são as isoladas; VPC D &lt;code&gt;10.4.0.0/16&lt;/code&gt; é shared services; há um VPN &lt;code&gt;10.99.99.0/24&lt;/code&gt;. No laboratório: A/B/C são &lt;code&gt;VPC-DEV&lt;/code&gt; (&lt;code&gt;10.0.0.0/16&lt;/code&gt;), &lt;code&gt;VPC-HML&lt;/code&gt; (&lt;code&gt;10.1.0.0/16&lt;/code&gt;) e &lt;code&gt;VPC-PROD&lt;/code&gt; (&lt;code&gt;10.2.0.0/16&lt;/code&gt;). D é &lt;code&gt;VPC-SHARED&lt;/code&gt; (&lt;code&gt;10.3.0.0/16&lt;/code&gt;). O &lt;code&gt;10.3&lt;/code&gt; do print é a VPC C isolada, não a SHARED. O VPN do print não entra no laboratório. O &lt;code&gt;0.0.0.0/0&lt;/code&gt; que a documentação coloca nas tabelas das VPCs desse exemplo existe por causa do VPN. Sem VPN, não use &lt;code&gt;0.0.0.0/0&lt;/code&gt; para o &lt;code&gt;tgw-&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Duas tabelas no Transit Gateway:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;RT-ISOLATED&lt;/code&gt;, associada aos attachments de DEV, HML e PROD.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RT-SHARED&lt;/code&gt;, associada ao attachment de SHARED.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Propagação, no mesmo espírito da documentação:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DEV, HML e PROD &lt;strong&gt;propagam&lt;/strong&gt; só para &lt;code&gt;RT-SHARED&lt;/code&gt;. Assim SHARED aprende &lt;code&gt;10.0.0.0/16&lt;/code&gt;, &lt;code&gt;10.1.0.0/16&lt;/code&gt; e &lt;code&gt;10.2.0.0/16&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;SHARED &lt;strong&gt;propaga&lt;/strong&gt; para &lt;code&gt;RT-ISOLATED&lt;/code&gt;. Assim as três de carga aprendem &lt;code&gt;10.3.0.0/16&lt;/code&gt;. A documentação também propaga SHARED para a tabela shared. O CIDR de SHARED na própria &lt;code&gt;RT-SHARED&lt;/code&gt; não é o que encaminha o retorno: o tráfego que já está dentro de SHARED usa a rota &lt;code&gt;local&lt;/code&gt; da VPC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;RT-ISOLATED&lt;/code&gt; (o que DEV, HML e PROD leem):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;th&gt;Tipo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-SHARED&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Não há linha para &lt;code&gt;10.0.0.0/16&lt;/code&gt;, &lt;code&gt;10.1.0.0/16&lt;/code&gt; nem &lt;code&gt;10.2.0.0/16&lt;/code&gt;. Pacote de DEV para PROD chega ao gateway, a tabela associada não tem rota, o tráfego não segue. A documentação descreve esse caso: os pacotes “are blocked because there is no route for them in the transit gateway route table”.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;RT-SHARED&lt;/code&gt; (o que SHARED lê):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;th&gt;Tipo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-DEV&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-HML&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;attachment da &lt;code&gt;VPC-PROD&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;propagated&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Tabelas das VPCs neste cenário. DEV, HML e PROD só conhecem SHARED pelo &lt;code&gt;tgw-&lt;/code&gt;. SHARED conhece as três.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;VPC-DEV&lt;/code&gt; (HML e PROD iguais, trocando o &lt;code&gt;local&lt;/code&gt;):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;VPC-SHARED&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Destino&lt;/th&gt;
&lt;th&gt;Alvo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.3.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;local&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.0.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.1.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;10.2.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tgw-…&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Caminho permitido, DEV → SHARED (&lt;code&gt;10.0.10.20&lt;/code&gt; para &lt;code&gt;10.3.10.5&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tabela da VPC em DEV: &lt;code&gt;10.3.0.0/16&lt;/code&gt; → &lt;code&gt;tgw-…&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Pacote entra pelo attachment de DEV. O gateway lê &lt;code&gt;RT-ISOLATED&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Destino &lt;code&gt;10.3.10.5&lt;/code&gt; casa com &lt;code&gt;10.3.0.0/16&lt;/code&gt; → attachment de SHARED.&lt;/li&gt;
&lt;li&gt;Em SHARED, a tabela da VPC entrega &lt;code&gt;10.3.10.5&lt;/code&gt; como local.&lt;/li&gt;
&lt;li&gt;A resposta: tabela da VPC em SHARED vê &lt;code&gt;10.0.0.0/16&lt;/code&gt; → &lt;code&gt;tgw-…&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;O pacote entra pelo attachment de SHARED. O gateway lê &lt;code&gt;RT-SHARED&lt;/code&gt;, encontra &lt;code&gt;10.0.0.0/16&lt;/code&gt; → DEV.&lt;/li&gt;
&lt;li&gt;Em DEV, &lt;code&gt;10.0.10.20&lt;/code&gt; é local.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Caminho bloqueado, DEV → PROD (&lt;code&gt;10.0.10.20&lt;/code&gt; para &lt;code&gt;10.2.10.8&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A tabela da &lt;code&gt;VPC-DEV&lt;/code&gt; neste cenário &lt;strong&gt;não&lt;/strong&gt; tem rota para &lt;code&gt;10.2.0.0/16&lt;/code&gt;. O pacote nem sai da VPC.&lt;/li&gt;
&lt;li&gt;Se alguém acrescentar essa rota por engano, o pacote chega ao gateway e &lt;code&gt;RT-ISOLATED&lt;/code&gt; não tem &lt;code&gt;10.2.0.0/16&lt;/code&gt;. O Transit Gateway não encaminha.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Duas observações que a documentação insiste e o iniciante costuma misturar.&lt;/p&gt;

&lt;p&gt;Primeira: &lt;strong&gt;associar&lt;/strong&gt; e &lt;strong&gt;propagar&lt;/strong&gt; não são o mesmo clique. Um attachment associado a &lt;code&gt;RT-ISOLATED&lt;/code&gt; não instala, só por isso, o CIDR dele em &lt;code&gt;RT-ISOLATED&lt;/code&gt;. Se DEV, HML e PROD também propagassem para &lt;code&gt;RT-ISOLATED&lt;/code&gt;, as três voltariam a se ver. A isolação deste cenário existe porque a propagação das VPCs de carga &lt;strong&gt;não&lt;/strong&gt; cai na tabela que elas mesmas leem.&lt;/p&gt;

&lt;p&gt;Segunda: a tabela da VPC e a tabela do Transit Gateway trabalham em sequência, não em paralelo. A VPC decide se o pacote sai rumo ao &lt;code&gt;tgw-&lt;/code&gt;. O Transit Gateway decide o attachment de destino. Security groups e network ACLs continuam valendo na interface da instância. Rota no gateway não abre porta 3306 sozinha.&lt;/p&gt;

&lt;p&gt;A AWS ainda permite rota &lt;strong&gt;blackhole&lt;/strong&gt; na tabela do Transit Gateway: o prefixo casa e o pacote é descartado de propósito. É um reforço, não o mecanismo principal deste cenário.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Peering ou Transit Gateway
&lt;/h2&gt;

&lt;p&gt;Não é uma escada em que o Transit Gateway substitui o Peering em todo desenho.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;VPC Peering&lt;/th&gt;
&lt;th&gt;Transit Gateway&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;O que é&lt;/td&gt;
&lt;td&gt;conexão um-para-um entre duas VPCs&lt;/td&gt;
&lt;td&gt;roteador virtual da região, hub-and-spoke&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trânsito&lt;/td&gt;
&lt;td&gt;não. Sem a terceira conexão, as pontas não se falam&lt;/td&gt;
&lt;td&gt;sim, entre attachments que a tabela do gateway alcançar&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Crescimento&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;n × (n − 1) / 2&lt;/code&gt; conexões para malha completa&lt;/td&gt;
&lt;td&gt;um attachment por VPC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Onde você mexe nas rotas&lt;/td&gt;
&lt;td&gt;só nas tabelas das VPCs&lt;/td&gt;
&lt;td&gt;tabelas das VPCs e tabelas do gateway&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Isolar ambientes&lt;/td&gt;
&lt;td&gt;omitir o Peering daquele par&lt;/td&gt;
&lt;td&gt;tabelas, associações e propagações diferentes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Região&lt;/td&gt;
&lt;td&gt;Peering intra-região ou inter-região, direto entre duas VPCs&lt;/td&gt;
&lt;td&gt;o gateway é regional; outra região pede outro gateway e peering entre gateways&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CIDR sobreposto&lt;/td&gt;
&lt;td&gt;a conexão de Peering falha; o caminho não chega a existir&lt;/td&gt;
&lt;td&gt;o attachment pode existir; o CIDR sobreposto não propaga e o gateway não roteia entre esses blocos&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Quando costuma bastar&lt;/td&gt;
&lt;td&gt;um par, ou um centro que as outras só consomem&lt;/td&gt;
&lt;td&gt;muitas VPCs, híbrido (VPN / Direct Connect), segmentação no mesmo hub&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Custo (modelo, não o número)&lt;/td&gt;
&lt;td&gt;sem hora de attachment; há transferência de dados, inclusive ao cruzar zona de disponibilidade&lt;/td&gt;
&lt;td&gt;hora por attachment e processamento por GB enviado ao gateway; valores na &lt;a href="https://aws.amazon.com/transit-gateway/pricing/" rel="noopener noreferrer"&gt;página de preços&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;O Peering continua a escolha honesta quando o problema é “estas duas VPCs precisam se falar” e você não prevê uma malha. Ele não cobra o attachment por hora. A banda entre as duas VPCs não passa por um hop extra de roteador gerenciado.&lt;/p&gt;

&lt;p&gt;O Transit Gateway passa a valer quando a pergunta muda: “estas dez VPCs, e as que ainda vão nascer, precisam de um lugar só para a política de quem fala com quem”. Aí o hop extra e a cobrança por attachment são o preço de não manter vinte e uma conexões &lt;code&gt;pcx-&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Dois limites úteis, os dois da documentação, sem transformar o texto em lista de cota:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Um Transit Gateway não leva dois VPC attachments da &lt;strong&gt;mesma&lt;/strong&gt; VPC.&lt;/li&gt;
&lt;li&gt;A cota default é 5.000 attachments por gateway e 20 tabelas de rotas por gateway, ambas ajustáveis. O que encosta mais cedo, em conta pequena, é o desenho ruim: uma tabela default com tudo misturado.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Há também diferença de MTU. Uma conexão de VPC Peering na mesma região aceita até 9001 bytes. Entre VPCs, Direct Connect, Connect e peering de Transit Gateway, o gateway trabalha com MTU de 8500 bytes. VPN fica em 1500. Na migração de Peering para Transit Gateway, pacote jumbo que vai por um caminho e volta por outro pode cair. A AWS pede para atualizar os dois lados juntos.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que ficou
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;VPC-DEV&lt;/code&gt;, &lt;code&gt;VPC-HML&lt;/code&gt;, &lt;code&gt;VPC-PROD&lt;/code&gt; e &lt;code&gt;VPC-SHARED&lt;/code&gt; são quatro redes isoladas até alguém criar um caminho. O Peering cria o caminho de um par. Sem transitividade, a malha pede uma conexão para cada par. O Transit Gateway troca essa malha por raios em um hub. A tabela de rotas da VPC ainda decide se o pacote sai. A tabela de rotas do Transit Gateway decide para qual attachment ele vai. Associação e propagação, usadas com duas tabelas, separam DEV, HML e PROD e ainda deixam as três chegarem em SHARED.&lt;/p&gt;

&lt;p&gt;O serviço não é obrigatório em conta de duas VPCs. Ele passa a fazer sentido quando a teia de &lt;code&gt;pcx-&lt;/code&gt; vira o trabalho, ou quando a política “produção não fala com desenvolvimento, as duas falam com o compartilhado” precisa viver em um lugar só.&lt;/p&gt;

&lt;p&gt;Referências oficiais usadas neste texto: &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html" rel="noopener noreferrer"&gt;What is VPC peering?&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/vpc-peering-basics.html" rel="noopener noreferrer"&gt;How VPC peering connections work&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-full-access.html" rel="noopener noreferrer"&gt;VPC peering configurations&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html" rel="noopener noreferrer"&gt;What is a transit gateway?&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/how-transit-gateways-work.html" rel="noopener noreferrer"&gt;How AWS Transit Gateway works&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-vpc-attachments.html" rel="noopener noreferrer"&gt;Amazon VPC attachments&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-route-tables.html" rel="noopener noreferrer"&gt;Transit gateway route tables&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-best-design-practices.html" rel="noopener noreferrer"&gt;Transit gateway design best practices&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/tgw/transit-gateway-quotas.html" rel="noopener noreferrer"&gt;AWS Transit Gateway quotas&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/transit-gateway.html" rel="noopener noreferrer"&gt;AWS Transit Gateway&lt;/a&gt; no whitepaper de multi-VPC, &lt;a href="https://docs.aws.amazon.com/whitepapers/latest/aws-vpc-connectivity-options/aws-transit-gateway.html" rel="noopener noreferrer"&gt;Amazon VPC Connectivity Options&lt;/a&gt; e &lt;a href="https://aws.amazon.com/transit-gateway/pricing/" rel="noopener noreferrer"&gt;AWS Transit Gateway pricing&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>vpc</category>
      <category>networking</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to associate an EC2 instance with a custom VPC</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Fri, 06 Nov 2026 17:27:16 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/how-to-associate-an-ec2-instance-with-a-custom-vpc-5ahb</link>
      <guid>https://dev.to/rodolfocoding/how-to-associate-an-ec2-instance-with-a-custom-vpc-5ahb</guid>
      <description>&lt;p&gt;Before we begin, a quick note: the screenshots in this tutorial are in Brazilian Portuguese (pt-BR). However, the navigation flow, configuration options, and steps follow the same logic in the English version of the AWS Console. Sorry for any inconvenience, and I hope you enjoy the tutorial!&lt;/p&gt;

&lt;p&gt;Portuguese version: &lt;a href="https://dev.to/rodolfocoding/como-associar-uma-instancia-ec2-a-uma-vpc-personalizada-2g15"&gt;Como associar uma instância EC2 a uma VPC personalizada&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this lab you create an isolated network in AWS and launch an EC2 instance inside it. When you finish, three resources are tied together: VPC &lt;code&gt;VPC-01&lt;/code&gt;, subnet &lt;code&gt;my-subnet-01&lt;/code&gt;, and instance &lt;code&gt;my-server&lt;/code&gt;. The instance should not land in the account's default network.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;VPC&lt;/strong&gt; (Virtual Private Cloud) is the virtual network for your account in one Region. You define the IP address range, the subnets, and the traffic rules. An EC2 instance does not "connect to the cloud" in the abstract. It gets a network interface, and that interface has to live in a subnet. The subnet belongs to a VPC.&lt;/p&gt;

&lt;p&gt;AWS already creates a default VPC in each Region. If you launch an EC2 instance without changing the network settings, it goes into that default VPC. That is fine for a quick test. For a lab, it dumps everything into the same address block. A &lt;strong&gt;custom VPC&lt;/strong&gt; fixes that: you create a network just for this exercise and, in the launch wizard, you put the instance in that network.&lt;/p&gt;

&lt;p&gt;The address range for this network is &lt;code&gt;10.0.0.0/24&lt;/code&gt;. That notation is CIDR. It describes 256 private IP addresses, from &lt;code&gt;10.0.0.0&lt;/code&gt; to &lt;code&gt;10.0.0.255&lt;/code&gt;. They do not work as addresses on the public internet. They are for machines talking inside the VPC. Section 1 shows exactly where to type this value.&lt;/p&gt;

&lt;p&gt;You do not attach the VPC after the instance exists. You do it in the Launch Wizard: select &lt;code&gt;VPC-01&lt;/code&gt; and subnet &lt;code&gt;my-subnet-01&lt;/code&gt; &lt;strong&gt;before&lt;/strong&gt; you click Launch instance. The instance's network interface is born in that subnet, and therefore in the custom VPC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before any other click&lt;/strong&gt;, check the Region in the upper-right corner of the console. This lab uses &lt;strong&gt;US East (N. Virginia)&lt;/strong&gt;, code &lt;code&gt;us-east-1&lt;/code&gt;. In the screenshots that label is &lt;strong&gt;Estados Unidos (Norte da Virgínia)&lt;/strong&gt;. If the selector shows São Paulo or another Region, open the list and switch. VPCs and EC2 instances do not cross Regions.&lt;/p&gt;

&lt;p&gt;Resource IDs (&lt;code&gt;vpc-…&lt;/code&gt;, &lt;code&gt;subnet-…&lt;/code&gt;, &lt;code&gt;ami-…&lt;/code&gt;) change by account and by date. Follow the names and the values in the table, not the IDs in the screenshots. In some captures the Owner field (&lt;strong&gt;Proprietário&lt;/strong&gt;) is hidden: that is the AWS account ID, not a lab parameter.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Resource&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Lab settings&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;VPC&lt;/td&gt;
&lt;td&gt;&lt;code&gt;VPC-01&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;IPv4 &lt;code&gt;10.0.0.0/24&lt;/code&gt;, VPC only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subnet&lt;/td&gt;
&lt;td&gt;&lt;code&gt;my-subnet-01&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Zone &lt;code&gt;us-east-1a&lt;/code&gt;, IPv4 &lt;code&gt;10.0.0.0/24&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EC2 instance&lt;/td&gt;
&lt;td&gt;&lt;code&gt;my-server&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Amazon Linux 2023, type &lt;code&gt;t2.micro&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Key pair&lt;/td&gt;
&lt;td&gt;whichever you select&lt;/td&gt;
&lt;td&gt;the screenshot shows &lt;code&gt;aws-server&lt;/code&gt;; yours can be different&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This article does not configure an internet gateway, a route table, or SSH. The goal is to create the VPC and place the EC2 instance in it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create the custom VPC
&lt;/h2&gt;

&lt;p&gt;The first object is the network. Without it, the EC2 wizard has no custom destination to offer.&lt;/p&gt;

&lt;p&gt;In the search bar at the top of the console, type &lt;strong&gt;VPC&lt;/strong&gt;. Open the &lt;strong&gt;VPC&lt;/strong&gt; service (Isolated Cloud Resources).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd55eow1sghi2aoqpbwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd55eow1sghi2aoqpbwg.png" alt="Console search bar with the term VPC and the Isolated Cloud Resources service card." width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You land on the VPC dashboard. In the left menu, click &lt;strong&gt;Your VPCs&lt;/strong&gt; (&lt;strong&gt;Suas VPCs&lt;/strong&gt; in the screenshot). That page lists networks in the current Region. You may see the default VPC and other test networks. Do not use them. In the upper-right corner, click &lt;strong&gt;Create VPC&lt;/strong&gt; (&lt;strong&gt;Criar VPC&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnjqgzhrk55en7ketxnv7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnjqgzhrk55en7ketxnv7.png" alt="Your VPCs page, with the Create VPC button highlighted on the right." width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The wizard asks which creation mode to use. &lt;strong&gt;VPC and more&lt;/strong&gt; (&lt;strong&gt;VPC e muito mais&lt;/strong&gt;) creates the VPC and already adds subnets, a path to the internet, and the matching routes. That is the shortcut. &lt;strong&gt;VPC only&lt;/strong&gt; (&lt;strong&gt;Somente VPC&lt;/strong&gt;) creates the VPC and nothing else. Subnets are on you. This lab uses &lt;strong&gt;VPC only&lt;/strong&gt; so the subnet shows up as an explicit step, at the moment EC2 needs it. Select &lt;strong&gt;VPC only&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Before you fill in the addresses, the field notation: &lt;strong&gt;CIDR&lt;/strong&gt; is how you write an IP range. In &lt;code&gt;10.0.0.0/24&lt;/code&gt;, the first 24 bits identify the network and the remaining 8 bits identify hosts: 256 addresses, from &lt;code&gt;10.0.0.0&lt;/code&gt; to &lt;code&gt;10.0.0.255&lt;/code&gt;. The &lt;code&gt;10.&lt;/code&gt; prefix is private. It only exists inside the VPC. The console accepts blocks between &lt;code&gt;/16&lt;/code&gt; and &lt;code&gt;/28&lt;/code&gt;. &lt;code&gt;/24&lt;/code&gt; is the size for this lab.&lt;/p&gt;

&lt;p&gt;There are two ways to supply that block. &lt;strong&gt;IPv4 CIDR manual input&lt;/strong&gt; (&lt;strong&gt;Entrada manual de CIDR IPv4&lt;/strong&gt;) lets you type the range. The other option, IPAM, needs an AWS address manager this lab does not use. Select &lt;strong&gt;IPv4 CIDR manual input&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Fill in the rest as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name tag:&lt;/strong&gt; &lt;code&gt;VPC-01&lt;/code&gt;. In AWS the visible name of a VPC is the &lt;code&gt;Name&lt;/code&gt; tag. Without it, the list shows only a &lt;code&gt;vpc-…&lt;/code&gt; identifier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IPv4 CIDR:&lt;/strong&gt; &lt;code&gt;10.0.0.0/24&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IPv6 CIDR block:&lt;/strong&gt; leave &lt;strong&gt;No IPv6 CIDR block&lt;/strong&gt; (&lt;strong&gt;Nenhum bloco CIDR IPv6&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tenancy:&lt;/strong&gt; leave &lt;strong&gt;Default&lt;/strong&gt; (&lt;strong&gt;Padrão&lt;/strong&gt;). The instance uses ordinary shared EC2 hardware, not a dedicated host.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC encryption control:&lt;/strong&gt; leave &lt;strong&gt;None&lt;/strong&gt; (&lt;strong&gt;Nenhuma&lt;/strong&gt;). This lab does not use the paid encryption-monitoring feature.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff3ba70ekngj1m6977aos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff3ba70ekngj1m6977aos.png" alt="Create VPC form in VPC only mode, with the name VPC-01 and CIDR 10.0.0.0/24." width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the yellow &lt;strong&gt;Create VPC&lt;/strong&gt; (&lt;strong&gt;Criar VPC&lt;/strong&gt;) button in the lower-right corner. The console opens the details for &lt;code&gt;VPC-01&lt;/code&gt;. Confirm the state is &lt;strong&gt;Available&lt;/strong&gt;. To see the list, use &lt;strong&gt;Your VPCs&lt;/strong&gt; in the left menu.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;VPC-01&lt;/code&gt; still has no subnet. AWS splits each Region into &lt;strong&gt;Availability Zones&lt;/strong&gt;: separate data centers in the same Region. The subnet, created later, picks one of those zones and hands IP addresses to the EC2 network interface. Without a subnet, the instance has no zone and no IP in this VPC. Next we start the launch. The subnet will be created when the EC2 wizard asks for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Start launching the EC2 instance
&lt;/h2&gt;

&lt;p&gt;With the VPC created, the next resource is the virtual machine. Do not click Launch instance yet. First we fill in the name, image, type, and key. Networking is the following section.&lt;/p&gt;

&lt;p&gt;In the search bar, type &lt;strong&gt;EC2&lt;/strong&gt; and open the &lt;strong&gt;EC2&lt;/strong&gt; service (Virtual Servers in the Cloud).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft97zcuv44k2ioadv8i4u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft97zcuv44k2ioadv8i4u.png" alt="Console search bar with the term EC2 and the Virtual Servers in the Cloud card." width="799" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the left menu of the dashboard, click &lt;strong&gt;Instances&lt;/strong&gt; (&lt;strong&gt;Instâncias&lt;/strong&gt;). You see the virtual machines in N. Virginia.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnk4t5xppputuv39esklt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnk4t5xppputuv39esklt.png" alt="EC2 dashboard, with Instances highlighted in the left menu." width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the upper-right corner of the list, click &lt;strong&gt;Launch instances&lt;/strong&gt; (&lt;strong&gt;Executar instâncias&lt;/strong&gt;). If the table already has other machines, ignore them. They are not part of this lab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Famjryzvznb640ytfiq16.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Famjryzvznb640ytfiq16.png" alt="Instances list, with the Launch instances button highlighted." width="798" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Launch Wizard opens. Under &lt;strong&gt;Name and tags&lt;/strong&gt; (&lt;strong&gt;Nome e tags&lt;/strong&gt;), in the &lt;strong&gt;Name&lt;/strong&gt; field, type &lt;code&gt;my-server&lt;/code&gt;. That text becomes the &lt;code&gt;Name&lt;/code&gt; tag. It is not the Linux hostname and it is not DNS.&lt;/p&gt;

&lt;p&gt;Under &lt;strong&gt;Application and OS Images (Amazon Machine Image)&lt;/strong&gt; (&lt;strong&gt;Imagens de aplicação e de sistema operacional&lt;/strong&gt;), on the &lt;strong&gt;Quick Start&lt;/strong&gt; (&lt;strong&gt;Início rápido&lt;/strong&gt;) tab, choose &lt;strong&gt;Amazon Linux&lt;/strong&gt;. Confirm &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt;. In &lt;strong&gt;Architecture&lt;/strong&gt; (&lt;strong&gt;Arquitetura&lt;/strong&gt;), if it is set to &lt;strong&gt;64-bit (Arm)&lt;/strong&gt;, open the list and switch to &lt;strong&gt;64-bit (x86)&lt;/strong&gt;. After the switch, check again that the selected image is still &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt;: the console may reload the AMI. The &lt;code&gt;t2.micro&lt;/code&gt; type in this lab does not exist on Arm. The default user for that image is &lt;code&gt;ec2-user&lt;/code&gt;. The &lt;code&gt;ami-…&lt;/code&gt; ID changes by Region and by image updates. Pick the Amazon Linux 2023 the console shows today. Do not copy the ID from the screenshot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fubhjkwonunfmqcoaf63r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fubhjkwonunfmqcoaf63r.png" alt="Launch Wizard with the name my-server and the Amazon Linux 2023 AMI." width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under &lt;strong&gt;Instance type&lt;/strong&gt; (&lt;strong&gt;Tipo de instância&lt;/strong&gt;), select &lt;strong&gt;t2.micro&lt;/strong&gt; (1 vCPU, 1 GiB of memory). If the list does not show &lt;code&gt;t2.micro&lt;/code&gt;, turn on the &lt;strong&gt;All generations&lt;/strong&gt; (&lt;strong&gt;Todas as gerações&lt;/strong&gt;) toggle next to the field. The console shows the on-demand price for the Region. Read the value on the screen. It changes. This article does not record the number.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzjq7w6xbhzdn2bn3a8d4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzjq7w6xbhzdn2bn3a8d4.png" alt="Instance type section with t2.micro selected." width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before networking, the wizard requires a &lt;strong&gt;key pair&lt;/strong&gt; (&lt;strong&gt;Par de chaves&lt;/strong&gt;). That is two files: the public key is stored on the instance; the private key stays on your computer. The &lt;strong&gt;Launch instance&lt;/strong&gt; button stays blocked while the field is empty, even in this lab, where &lt;strong&gt;we will not open SSH&lt;/strong&gt;. The key pair exists because the console requires it. Connecting to the instance from the internet is not part of this walkthrough.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbica6btr2t40icgozz87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbica6btr2t40icgozz87.png" alt="Required Key pair name field, still empty, with the console error in red." width="800" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the list is empty, click &lt;strong&gt;Create new key pair&lt;/strong&gt; (&lt;strong&gt;Criar novo par de chaves&lt;/strong&gt;), pick a name, download the &lt;code&gt;.pem&lt;/code&gt; file, and select the pair you just created. Keep the &lt;code&gt;.pem&lt;/code&gt; out of Git.&lt;/li&gt;
&lt;li&gt;If you already have a pair and you still have the file, select that pair.&lt;/li&gt;
&lt;li&gt;The screenshot in this lab shows the name &lt;code&gt;aws-server&lt;/code&gt;. You do not need to reuse that name. You need a pair selected, with the file in your possession.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not launch the instance yet. The network block still points at the Region's default VPC, with public IP enabled and an offer to create a new security group (&lt;code&gt;launch-wizard-…&lt;/code&gt;) with SSH open to any address. The next section swaps that network for &lt;code&gt;VPC-01&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Select VPC-01 in the Launch Wizard
&lt;/h2&gt;

&lt;p&gt;If you click Launch instance now, &lt;code&gt;my-server&lt;/code&gt; is born in the default VPC. &lt;code&gt;VPC-01&lt;/code&gt; stays empty. The association starts here, on the &lt;strong&gt;Edit&lt;/strong&gt; (&lt;strong&gt;Editar&lt;/strong&gt;) button.&lt;/p&gt;

&lt;p&gt;Scroll to &lt;strong&gt;Network settings&lt;/strong&gt; (&lt;strong&gt;Configurações de rede&lt;/strong&gt;). On the right side of that block, click &lt;strong&gt;Edit&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F41itr6uf1kf0jme4e9ma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F41itr6uf1kf0jme4e9ma.png" alt="Network settings still on the default VPC, with the Edit button highlighted." width="799" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The block expands. Open the &lt;strong&gt;VPC&lt;/strong&gt; list. Select &lt;strong&gt;VPC-01&lt;/strong&gt;, with CIDR &lt;code&gt;10.0.0.0/24&lt;/code&gt;. The default VPC stays in the list, marked as default: that is AWS's default, not the network for this lab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1yku20ulaiijtlfwqmf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1yku20ulaiijtlfwqmf.png" alt="Launch Wizard VPC list, with VPC-01 (10.0.0.0/24) selected." width="800" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you change the VPC, the wizard looks for subnets inside it. &lt;code&gt;VPC-01&lt;/code&gt; still has none. Two red warnings appear: &lt;strong&gt;No subnet found&lt;/strong&gt; (&lt;strong&gt;Nenhuma sub-rede encontrada&lt;/strong&gt;) and a requirement to set &lt;strong&gt;Auto-assign public IP&lt;/strong&gt; (&lt;strong&gt;Atribuir IP público automaticamente&lt;/strong&gt;). Both are expected. The public IP is set after the subnet exists. The real blocker now is the subnet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzt0su0xdn5cfnvm0dvbx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzt0su0xdn5cfnvm0dvbx.png" alt="Two red warnings after choosing VPC-01: no subnet found, and public IP still unset. On the right, the Create new subnet shortcut." width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The firewall also switches to &lt;strong&gt;Select existing security group&lt;/strong&gt; (&lt;strong&gt;Selecionar grupo de segurança existente&lt;/strong&gt;), with the &lt;strong&gt;default&lt;/strong&gt; group of &lt;code&gt;VPC-01&lt;/code&gt;. A security group belongs to one VPC. The &lt;code&gt;launch-wizard-…&lt;/code&gt; group from the default VPC cannot be used on this network. Leave the &lt;strong&gt;default&lt;/strong&gt; group of &lt;code&gt;VPC-01&lt;/code&gt;. We come back to it after the subnet.&lt;/p&gt;

&lt;p&gt;On the right, click &lt;strong&gt;Create new subnet&lt;/strong&gt; (&lt;strong&gt;Criar nova sub-rede&lt;/strong&gt;). The link opens the subnet wizard in &lt;strong&gt;another browser tab&lt;/strong&gt;. Do not close the Launch Wizard tab, and do not reload that tab with F5: the &lt;code&gt;my-server&lt;/code&gt; form is lost. Leave it open.&lt;/p&gt;

&lt;p&gt;In the new tab, the &lt;strong&gt;VPC ID&lt;/strong&gt; field starts at &lt;strong&gt;Select a VPC&lt;/strong&gt; (&lt;strong&gt;Selecionar uma VPC&lt;/strong&gt;). The shortcut does not fill in &lt;code&gt;VPC-01&lt;/code&gt; for you. Open the list and select &lt;strong&gt;VPC-01&lt;/strong&gt; again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdhdqu3fchzffp9owls6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdhdqu3fchzffp9owls6.png" alt="Create subnet wizard with the VPC ID field still empty." width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that selection, the rest of the subnet form is enabled.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Create subnet my-subnet-01
&lt;/h2&gt;

&lt;p&gt;A subnet is a slice of the VPC in one &lt;strong&gt;Availability Zone&lt;/strong&gt;. The VPC covers the &lt;code&gt;us-east-1&lt;/code&gt; Region. The subnet picks a zone, in this lab &lt;code&gt;us-east-1a&lt;/code&gt;. The instance inherits that zone. There is no such thing as EC2 "only in the VPC": the network interface needs a subnet.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Subnet name&lt;/strong&gt; (&lt;strong&gt;Nome da sub-rede&lt;/strong&gt;), type &lt;code&gt;my-subnet-01&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1pvtag4q3gh3khpzudf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1pvtag4q3gh3khpzudf.png" alt="Subnet name field filled with my-subnet-01." width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Availability Zone&lt;/strong&gt; (&lt;strong&gt;Zona de disponibilidade&lt;/strong&gt;), open the list. Do not leave &lt;strong&gt;No preference&lt;/strong&gt; (&lt;strong&gt;Sem preferência&lt;/strong&gt;): AWS would pick the zone, and the lab would be hard to repeat. Find the row whose zone name is &lt;strong&gt;us-east-1a&lt;/strong&gt;. Next to it is a &lt;code&gt;use1-az…&lt;/code&gt; code. That code is different in every account. Do not pick by the &lt;code&gt;use1-az1&lt;/code&gt; column in the screenshot. Pick by the text &lt;strong&gt;us-east-1a&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F75ghy0cvgrqaw4qhj1vy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F75ghy0cvgrqaw4qhj1vy.png" alt="Availability Zone list for us-east-1." width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;IPv4 VPC CIDR block&lt;/strong&gt; (&lt;strong&gt;Bloco CIDR IPv4 da VPC&lt;/strong&gt;) should show &lt;code&gt;10.0.0.0/24&lt;/code&gt;. The subnet has to fit inside that range.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;IPv4 subnet CIDR block&lt;/strong&gt; (&lt;strong&gt;Bloco CIDR IPv4 da sub-rede&lt;/strong&gt;) field comes filled with &lt;code&gt;10.0.0.0/28&lt;/code&gt;. &lt;code&gt;/28&lt;/code&gt; is 16 addresses. AWS reserves five addresses in every subnet (network address, internal router, DNS, a future reservation, and broadcast). In a &lt;code&gt;/28&lt;/code&gt; that leaves 11 usable. &lt;strong&gt;Do not leave &lt;code&gt;/28&lt;/code&gt;&lt;/strong&gt;. Delete it and type &lt;strong&gt;&lt;code&gt;10.0.0.0/24&lt;/code&gt;&lt;/strong&gt;, the same block as the VPC. Only then does the subnet get 251 available addresses (256 minus the five reserved), matching this lab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpcxmmjdq36xyq7fab51p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpcxmmjdq36xyq7fab51p.png" alt="Subnet CIDR field still showing the suggested 10.0.0.0/28, which must be changed to 10.0.0.0/24." width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the lower-right corner, click &lt;strong&gt;Create subnet&lt;/strong&gt; (&lt;strong&gt;Criar sub-rede&lt;/strong&gt;). Wait for the green success banner. The list should show &lt;code&gt;my-subnet-01&lt;/code&gt;, state &lt;strong&gt;Available&lt;/strong&gt;, IPv4 CIDR &lt;strong&gt;10.0.0.0/24&lt;/strong&gt;, and &lt;strong&gt;251&lt;/strong&gt; available addresses. If you see &lt;code&gt;/28&lt;/code&gt; and about 11 addresses, the subnet was created with the form default. Select the row, open &lt;strong&gt;Actions&lt;/strong&gt; (&lt;strong&gt;Ações&lt;/strong&gt;), choose &lt;strong&gt;Delete subnet&lt;/strong&gt; (&lt;strong&gt;Excluir sub-rede&lt;/strong&gt;), confirm, and create it again with &lt;code&gt;10.0.0.0/24&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogoh1lx2h4m8gnqgs63u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogoh1lx2h4m8gnqgs63u.png" alt="Subnet my-subnet-01 created, Available, CIDR 10.0.0.0/24, 251 addresses." width="799" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;/24&lt;/code&gt; subnet inside a &lt;code&gt;/24&lt;/code&gt; VPC uses the entire space. There is no room left for a second subnet in another zone unless you add another CIDR to the VPC. For this one-zone lab, that is expected.&lt;/p&gt;

&lt;p&gt;Leave this tab as a check and &lt;strong&gt;go back to the Launch Wizard tab&lt;/strong&gt; (title &lt;strong&gt;Launch an instance&lt;/strong&gt; / &lt;strong&gt;Executar uma instância&lt;/strong&gt;). Do not press F5 on that tab.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Return to the Launch Wizard and launch the instance
&lt;/h2&gt;

&lt;p&gt;In the Launch Wizard, find the &lt;strong&gt;Subnet&lt;/strong&gt; (&lt;strong&gt;Sub-rede&lt;/strong&gt;) field. If the list is still empty, click the circular &lt;strong&gt;refresh&lt;/strong&gt; icon to the right of the VPC field or the Subnet field. Do not reload the page. &lt;code&gt;my-subnet-01&lt;/code&gt; should appear, in zone &lt;code&gt;us-east-1a&lt;/code&gt;, with CIDR &lt;code&gt;10.0.0.0/24&lt;/code&gt;. Select it.&lt;/p&gt;

&lt;p&gt;Under &lt;strong&gt;Auto-assign public IP&lt;/strong&gt;, choose &lt;strong&gt;Disable&lt;/strong&gt; (&lt;strong&gt;Desabilitar&lt;/strong&gt;). The red warning on that option goes away. The instance gets a &lt;strong&gt;private&lt;/strong&gt; IP in &lt;code&gt;10.0.0.0/24&lt;/code&gt;. It does not get a public address. Without a public address, you cannot SSH from your home network. That does not undo the association: the interface is still in &lt;code&gt;my-subnet-01&lt;/code&gt; and in &lt;code&gt;VPC-01&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For the instance to talk to the internet in this design, you would still need an internet gateway, a route to the whole internet (written &lt;code&gt;0.0.0.0/0&lt;/code&gt;, "any IPv4 address"), &lt;strong&gt;and&lt;/strong&gt; a public address (or NAT). With public IP set to Disable, a gateway and a route are not enough by themselves. This lab does not create those objects. The target here is the custom VPC, not public access.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr1qsc6dfsu732h1dhz6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr1qsc6dfsu732h1dhz6u.png" alt="Subnet my-subnet-01 selected and Auto-assign public IP set to Disable." width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under &lt;strong&gt;Firewall (security groups)&lt;/strong&gt; (&lt;strong&gt;Firewall (grupos de segurança)&lt;/strong&gt;), keep &lt;strong&gt;Select existing security group&lt;/strong&gt; and the &lt;strong&gt;default&lt;/strong&gt; group of &lt;code&gt;VPC-01&lt;/code&gt;. Do not switch back to creating a group with SSH sourced from &lt;code&gt;0.0.0.0/0&lt;/code&gt; in this lab: that source, the same "any address" as the internet route, opens port 22 to the entire internet.&lt;/p&gt;

&lt;p&gt;A security group is the traffic filter on the network interface. The default group of a new VPC, in the AWS documentation, allows traffic from the group itself and allows outbound traffic. It does not open SSH to the internet on its own. Reading the inbound rules later, under &lt;strong&gt;EC2 → Security groups&lt;/strong&gt; (&lt;strong&gt;Grupos de segurança&lt;/strong&gt;), is optional and is not part of the association.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqvg887taoegsr26q55n3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqvg887taoegsr26q55n3.png" alt="Default security group of VPC-01 selected." width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the summary on the right, check: Amazon Linux 2023, &lt;code&gt;t2.micro&lt;/code&gt;, firewall &lt;strong&gt;default&lt;/strong&gt;, one 8 GiB volume, key pair selected. Click &lt;strong&gt;Launch instance&lt;/strong&gt; (&lt;strong&gt;Executar instância&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr0erzj5wud3h40fm9nbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr0erzj5wud3h40fm9nbc.png" alt="Launch Wizard summary and the Launch instance button." width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The console shows a launch confirmation, usually with the instance ID. On that screen, click &lt;strong&gt;View all instances&lt;/strong&gt; (&lt;strong&gt;Ver todas as instâncias&lt;/strong&gt;). If that button is missing, use &lt;strong&gt;Instances&lt;/strong&gt; in the left menu. Do not use the browser Back button: you can land on an empty form again.&lt;/p&gt;

&lt;p&gt;In the list, click the name &lt;strong&gt;my-server&lt;/strong&gt;. The state moves from pending to running in a few seconds. Open the &lt;strong&gt;Networking&lt;/strong&gt; (&lt;strong&gt;Rede&lt;/strong&gt;) tab. The VPC should be &lt;code&gt;VPC-01&lt;/code&gt; and the subnet should be &lt;code&gt;my-subnet-01&lt;/code&gt;. This article does not include a screenshot of that page after the click. The success criterion for the association is exactly that VPC and subnet pair in the instance details.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you built
&lt;/h2&gt;

&lt;p&gt;From largest to smallest, the chain is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;VPC &lt;code&gt;VPC-01&lt;/code&gt; defines the &lt;code&gt;10.0.0.0/24&lt;/code&gt; block in Region &lt;code&gt;us-east-1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Subnet &lt;code&gt;my-subnet-01&lt;/code&gt; uses that block in zone &lt;code&gt;us-east-1a&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The network interface of &lt;code&gt;my-server&lt;/code&gt; gets a private IP in that subnet.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;default&lt;/strong&gt; group of &lt;code&gt;VPC-01&lt;/code&gt; filters traffic on that interface.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Creating the VPC by itself does not move the EC2 instance. Launching EC2 without &lt;strong&gt;Edit&lt;/strong&gt; on the network settings leaves the instance in the default VPC. The association happens when the &lt;code&gt;VPC-01&lt;/code&gt; subnet is selected in the Launch Wizard at the moment you click &lt;strong&gt;Launch instance&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;my-server&lt;/code&gt; is on the custom network. From the screenshots in this lab, it is not reachable from the internet. Exposing SSH would take a gateway, a route, a public address, and an inbound rule you chose on purpose. That is a different exercise.&lt;/p&gt;

&lt;p&gt;Official references for the concepts used here: &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html" rel="noopener noreferrer"&gt;What is Amazon VPC?&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/create-vpc.html" rel="noopener noreferrer"&gt;Create a VPC&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html" rel="noopener noreferrer"&gt;Subnet CIDR blocks&lt;/a&gt;, and &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-instance-wizard.html" rel="noopener noreferrer"&gt;Launch an Amazon EC2 instance&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>vpc</category>
      <category>ec2</category>
      <category>networking</category>
    </item>
    <item>
      <title>Como associar uma instância EC2 a uma VPC personalizada</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Fri, 06 Nov 2026 17:27:06 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/como-associar-uma-instancia-ec2-a-uma-vpc-personalizada-2g15</link>
      <guid>https://dev.to/rodolfocoding/como-associar-uma-instancia-ec2-a-uma-vpc-personalizada-2g15</guid>
      <description>&lt;p&gt;English version: &lt;a href="https://dev.to/rodolfocoding/how-to-associate-an-ec2-instance-with-a-custom-vpc-5ahb"&gt;How to associate an EC2 instance with a custom VPC&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Neste laboratório você cria uma rede isolada na AWS e lança uma instância EC2 dentro dela. No final existem três recursos ligados entre si: a VPC &lt;code&gt;VPC-01&lt;/code&gt;, a sub-rede &lt;code&gt;my-subnet-01&lt;/code&gt; e a instância &lt;code&gt;my-server&lt;/code&gt;. A máquina não deve ficar na rede padrão da conta.&lt;/p&gt;

&lt;p&gt;Uma &lt;strong&gt;VPC&lt;/strong&gt; (Virtual Private Cloud) é a rede virtual da sua conta em uma região. Nela você define o intervalo de endereços IP, as sub-redes e as regras de tráfego. A instância EC2 não se conecta “à nuvem” de forma genérica: ela recebe uma interface de rede, e essa interface precisa morar em uma sub-rede. A sub-rede, por sua vez, pertence a uma VPC.&lt;/p&gt;

&lt;p&gt;A AWS já cria uma VPC padrão em cada região. Se você lançar uma EC2 sem alterar a rede, a instância entra nessa VPC padrão. Isso funciona para um teste rápido. Para um laboratório, mistura tudo no mesmo bloco de endereços. Uma &lt;strong&gt;VPC personalizada&lt;/strong&gt; resolve isso: você cria uma rede só para esta atividade e, no assistente de lançamento, escolhe essa rede para a instância.&lt;/p&gt;

&lt;p&gt;O intervalo de endereços desta rede será &lt;code&gt;10.0.0.0/24&lt;/code&gt;. Essa notação, chamada CIDR, descreve 256 endereços IP privados, de &lt;code&gt;10.0.0.0&lt;/code&gt; a &lt;code&gt;10.0.0.255&lt;/code&gt;. Eles não funcionam como endereço na internet pública. Servem para as máquinas se comunicarem dentro da VPC. A seção 1 mostra exatamente onde preencher esse valor.&lt;/p&gt;

&lt;p&gt;A vinculação não acontece depois, com um botão de associar VPC. Ela acontece no Launch Wizard: você seleciona a &lt;code&gt;VPC-01&lt;/code&gt; e a sub-rede &lt;code&gt;my-subnet-01&lt;/code&gt; &lt;strong&gt;antes&lt;/strong&gt; de clicar em Executar instância. A interface de rede da EC2 nasce nessa sub-rede e, por isso, na VPC personalizada.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Antes de qualquer clique&lt;/strong&gt;, no canto superior direito do console, confira a região. Este laboratório usa &lt;strong&gt;Estados Unidos (Norte da Virgínia)&lt;/strong&gt;, código &lt;code&gt;us-east-1&lt;/code&gt;. Se o seletor mostrar São Paulo ou outra região, abra a lista e mude. VPC e EC2 não atravessam região. O idioma do console neste passo a passo é o português.&lt;/p&gt;

&lt;p&gt;Os identificadores (&lt;code&gt;vpc-…&lt;/code&gt;, &lt;code&gt;subnet-…&lt;/code&gt;, &lt;code&gt;ami-…&lt;/code&gt;) mudam de conta e de data. Siga os nomes e os valores da tabela, não os IDs dos prints. Em algumas capturas o campo Proprietário aparece oculto: é o identificador da conta, não um parâmetro do laboratório.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Recurso&lt;/th&gt;
&lt;th&gt;Nome&lt;/th&gt;
&lt;th&gt;Configuração deste laboratório&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;VPC&lt;/td&gt;
&lt;td&gt;&lt;code&gt;VPC-01&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;IPv4 &lt;code&gt;10.0.0.0/24&lt;/code&gt;, modo Somente VPC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sub-rede&lt;/td&gt;
&lt;td&gt;&lt;code&gt;my-subnet-01&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Zona &lt;code&gt;us-east-1a&lt;/code&gt;, IPv4 &lt;code&gt;10.0.0.0/24&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Instância EC2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;my-server&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Amazon Linux 2023, tipo &lt;code&gt;t2.micro&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Par de chaves&lt;/td&gt;
&lt;td&gt;o que você selecionar&lt;/td&gt;
&lt;td&gt;o print usa o nome &lt;code&gt;aws-server&lt;/code&gt;; o seu pode ser outro&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Não vamos configurar Internet Gateway, tabela de rotas nem SSH neste texto. O objetivo é criar a VPC e colocar a EC2 nela.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Criar a VPC personalizada
&lt;/h2&gt;

&lt;p&gt;O primeiro objeto é a rede. Sem ela, o assistente da EC2 não tem um destino personalizado para oferecer.&lt;/p&gt;

&lt;p&gt;Na barra de pesquisa no topo do console, digite &lt;strong&gt;VPC&lt;/strong&gt;. Nos resultados, abra o serviço &lt;strong&gt;VPC&lt;/strong&gt; (Isolated Cloud Resources).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd55eow1sghi2aoqpbwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd55eow1sghi2aoqpbwg.png" alt="Barra de pesquisa do console com o termo VPC e o cartão do serviço Isolated Cloud Resources." width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Você entra no painel da VPC. No menu à esquerda, clique em &lt;strong&gt;Suas VPCs&lt;/strong&gt;. Essa tela lista as redes da região atual. Pode aparecer a VPC padrão e outras redes de testes; não as use. No canto superior direito, clique em &lt;strong&gt;Criar VPC&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnjqgzhrk55en7ketxnv7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnjqgzhrk55en7ketxnv7.png" alt="Tela Suas VPCs, com o botão Criar VPC destacado à direita." width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;O assistente pergunta o modo de criação. &lt;strong&gt;VPC e muito mais&lt;/strong&gt; cria a VPC e já acrescenta sub-redes, um caminho para a internet e as rotas correspondentes. É um atalho. &lt;strong&gt;Somente VPC&lt;/strong&gt; cria só a VPC. As sub-redes ficam por sua conta. Este laboratório usa &lt;strong&gt;Somente VPC&lt;/strong&gt; para que a sub-rede apareça como etapa explícita, no momento em que a EC2 precisar dela. Selecione &lt;strong&gt;Somente VPC&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Antes de preencher os endereços, vale a notação do campo. &lt;strong&gt;CIDR&lt;/strong&gt; é a forma de escrever um intervalo de IPs. Em &lt;code&gt;10.0.0.0/24&lt;/code&gt;, os primeiros 24 bits identificam a rede e os 8 bits restantes identificam as máquinas: 256 endereços, de &lt;code&gt;10.0.0.0&lt;/code&gt; a &lt;code&gt;10.0.0.255&lt;/code&gt;. O prefixo &lt;code&gt;10.&lt;/code&gt; é privado, só vale dentro da VPC. O console aceita blocos entre &lt;code&gt;/16&lt;/code&gt; e &lt;code&gt;/28&lt;/code&gt;; &lt;code&gt;/24&lt;/code&gt; é o tamanho deste laboratório.&lt;/p&gt;

&lt;p&gt;Há duas formas de informar esse bloco. &lt;strong&gt;Entrada manual de CIDR IPv4&lt;/strong&gt; deixa você digitar o intervalo. A outra opção, IPAM, pede um gerenciador de endereços da AWS que este laboratório não usa. Marque &lt;strong&gt;Entrada manual de CIDR IPv4&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Preencha o restante assim:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tag de nome:&lt;/strong&gt; &lt;code&gt;VPC-01&lt;/code&gt;. Na AWS o nome visível da VPC é a tag &lt;code&gt;Name&lt;/code&gt;. Sem essa tag, a lista mostra apenas um identificador &lt;code&gt;vpc-…&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CIDR IPv4:&lt;/strong&gt; &lt;code&gt;10.0.0.0/24&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bloco CIDR IPv6:&lt;/strong&gt; deixe em &lt;strong&gt;Nenhum bloco CIDR IPv6&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Locação:&lt;/strong&gt; deixe &lt;strong&gt;Padrão&lt;/strong&gt;. A instância usa o hardware compartilhado usual da EC2, não um host dedicado.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Controle de criptografia da VPC:&lt;/strong&gt; deixe &lt;strong&gt;Nenhuma&lt;/strong&gt;. Este laboratório não usa o recurso pago de monitoramento de criptografia.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff3ba70ekngj1m6977aos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff3ba70ekngj1m6977aos.png" alt="Formulário Criar VPC no modo Somente VPC, com o nome VPC-01 e o CIDR 10.0.0.0/24." width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clique no botão amarelo &lt;strong&gt;Criar VPC&lt;/strong&gt;, no canto inferior direito. O console abre os detalhes da &lt;code&gt;VPC-01&lt;/code&gt;. Confirme o estado &lt;strong&gt;Available&lt;/strong&gt;. Se quiser ver a lista, use &lt;strong&gt;Suas VPCs&lt;/strong&gt; no menu esquerdo.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;VPC-01&lt;/code&gt; ainda não tem sub-rede. A AWS divide cada região em &lt;strong&gt;zonas de disponibilidade&lt;/strong&gt;: datacenters separados dentro da mesma região. A sub-rede, criada mais adiante, escolhe uma dessas zonas e entrega endereços IP para a interface da EC2. Sem sub-rede, a instância não tem zona nem IP nessa VPC. A seguir começamos o lançamento; a sub-rede será criada quando o assistente da EC2 pedir.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Iniciar o lançamento da instância EC2
&lt;/h2&gt;

&lt;p&gt;Com a VPC criada, o próximo recurso é a máquina virtual. Ainda não clique em Executar instância. Primeiro preenchemos nome, imagem, tipo e chave. A rede é a seção seguinte.&lt;/p&gt;

&lt;p&gt;Na barra de pesquisa, digite &lt;strong&gt;EC2&lt;/strong&gt; e abra o serviço &lt;strong&gt;EC2&lt;/strong&gt; (Virtual Servers in the Cloud).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft97zcuv44k2ioadv8i4u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft97zcuv44k2ioadv8i4u.png" alt="Barra de pesquisa do console com o termo EC2 e o cartão Virtual Servers in the Cloud." width="799" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No menu à esquerda do painel, clique em &lt;strong&gt;Instâncias&lt;/strong&gt;. Você vê as máquinas virtuais da região Norte da Virgínia.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnk4t5xppputuv39esklt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnk4t5xppputuv39esklt.png" alt="Painel do EC2, com o item Instâncias marcado no menu esquerdo." width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No canto superior direito da lista, clique em &lt;strong&gt;Executar instâncias&lt;/strong&gt;. Se a tabela já tiver outras máquinas, ignore-as. Elas não fazem parte deste laboratório.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Famjryzvznb640ytfiq16.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Famjryzvznb640ytfiq16.png" alt="Lista de instâncias, com o botão Executar instâncias destacado." width="798" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Abre o Launch Wizard. Em &lt;strong&gt;Nome e tags&lt;/strong&gt;, no campo &lt;strong&gt;Nome&lt;/strong&gt;, escreva &lt;code&gt;my-server&lt;/code&gt;. Esse texto vira a tag &lt;code&gt;Name&lt;/code&gt;. Não é o hostname Linux nem um nome DNS.&lt;/p&gt;

&lt;p&gt;Em &lt;strong&gt;Imagens de aplicação e de sistema operacional&lt;/strong&gt;, na aba &lt;strong&gt;Início rápido&lt;/strong&gt;, escolha &lt;strong&gt;Amazon Linux&lt;/strong&gt;. Confirme &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt;. No campo &lt;strong&gt;Arquitetura&lt;/strong&gt;, se estiver &lt;strong&gt;64 bits (Arm)&lt;/strong&gt;, abra a lista e mude para &lt;strong&gt;64 bits (x86)&lt;/strong&gt;. Depois da troca, confira de novo se a imagem selecionada continua &lt;strong&gt;Amazon Linux 2023&lt;/strong&gt;: o console pode recarregar a AMI. O tipo &lt;code&gt;t2.micro&lt;/code&gt; deste laboratório não existe na arquitetura Arm. O usuário padrão dessa imagem é &lt;code&gt;ec2-user&lt;/code&gt;. O código &lt;code&gt;ami-…&lt;/code&gt; muda com a região e com as atualizações. Escolha a Amazon Linux 2023 que o console mostrar agora. Não copie o ID do print.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fubhjkwonunfmqcoaf63r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fubhjkwonunfmqcoaf63r.png" alt="Launch Wizard com o nome my-server e a AMI Amazon Linux 2023." width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Em &lt;strong&gt;Tipo de instância&lt;/strong&gt;, selecione &lt;strong&gt;t2.micro&lt;/strong&gt; (1 vCPU, 1 GiB de memória). Se a lista não mostrar &lt;code&gt;t2.micro&lt;/code&gt;, ative o interruptor &lt;strong&gt;Todas as gerações&lt;/strong&gt; ao lado do campo. O console mostra o preço on-demand da região. Leia o valor na tela; ele muda. Este artigo não registra o número.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzjq7w6xbhzdn2bn3a8d4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzjq7w6xbhzdn2bn3a8d4.png" alt="Seção Tipo de instância com t2.micro selecionado." width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Antes da rede, o assistente exige um &lt;strong&gt;par de chaves&lt;/strong&gt;. São dois arquivos: a chave pública é gravada na instância; a privada fica no seu computador. O botão &lt;strong&gt;Executar instância&lt;/strong&gt; permanece bloqueado enquanto o campo estiver vazio, mesmo neste laboratório, em que &lt;strong&gt;não vamos abrir SSH&lt;/strong&gt;. O par existe porque o console exige. Conectar na instância pela internet não faz parte deste passo a passo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbica6btr2t40icgozz87.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbica6btr2t40icgozz87.png" alt="Campo Nome do par de chaves obrigatório, ainda sem valor, com a mensagem de erro em vermelho." width="800" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Se a lista estiver vazia, clique em &lt;strong&gt;Criar novo par de chaves&lt;/strong&gt;, escolha um nome, baixe o arquivo &lt;code&gt;.pem&lt;/code&gt; e selecione o par recém-criado. Guarde o &lt;code&gt;.pem&lt;/code&gt; fora do Git.&lt;/li&gt;
&lt;li&gt;Se já existir um par do qual você tem o arquivo, selecione esse par.&lt;/li&gt;
&lt;li&gt;O print deste laboratório mostra o nome &lt;code&gt;aws-server&lt;/code&gt;. Você não precisa repetir esse nome. Precisa de um par selecionado, com o arquivo em sua posse.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ainda não execute a instância. O bloco de rede, neste momento, ainda aponta para a VPC padrão da região, com IP público habilitado e a oferta de um grupo de segurança novo (&lt;code&gt;launch-wizard-…&lt;/code&gt;) com SSH aberto para qualquer endereço. A próxima seção troca essa rede pela &lt;code&gt;VPC-01&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Selecionar a VPC-01 no Launch Wizard
&lt;/h2&gt;

&lt;p&gt;Se você clicar em Executar instância agora, a &lt;code&gt;my-server&lt;/code&gt; nasce na VPC padrão. A &lt;code&gt;VPC-01&lt;/code&gt; continua vazia. A vinculação começa aqui, no botão &lt;strong&gt;Editar&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Role a página até &lt;strong&gt;Configurações de rede&lt;/strong&gt;. No canto direito desse bloco, clique em &lt;strong&gt;Editar&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F41itr6uf1kf0jme4e9ma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F41itr6uf1kf0jme4e9ma.png" alt="Bloco Configurações de rede ainda na VPC padrão, com o botão Editar destacado." width="799" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;O bloco se expande. Abra a lista &lt;strong&gt;VPC&lt;/strong&gt;. Selecione &lt;strong&gt;VPC-01&lt;/strong&gt;, com o CIDR &lt;code&gt;10.0.0.0/24&lt;/code&gt;. A VPC padrão permanece na lista, marcada como padrão: isso significa o padrão da AWS, não a rede deste laboratório.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1yku20ulaiijtlfwqmf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1yku20ulaiijtlfwqmf.png" alt="Lista de VPCs do Launch Wizard, com VPC-01 (10.0.0.0/24) marcada." width="800" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ao mudar a VPC, o assistente procura sub-redes dentro dela. A &lt;code&gt;VPC-01&lt;/code&gt; ainda não tem nenhuma. Dois avisos vermelhos aparecem: &lt;strong&gt;Nenhuma sub-rede encontrada&lt;/strong&gt; e a exigência de definir &lt;strong&gt;Atribuir IP público automaticamente&lt;/strong&gt;. Os dois são esperados. O IP público será definido depois que a sub-rede existir. Agora o bloqueio real é a sub-rede.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzt0su0xdn5cfnvm0dvbx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzt0su0xdn5cfnvm0dvbx.png" alt="Dois avisos vermelhos após escolher a VPC-01: nenhuma sub-rede encontrada e IP público ainda indefinido. À direita, o atalho Criar nova sub-rede." width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;O firewall também muda para &lt;strong&gt;Selecionar grupo de segurança existente&lt;/strong&gt;, com o grupo &lt;strong&gt;default&lt;/strong&gt; da &lt;code&gt;VPC-01&lt;/code&gt;. Um grupo de segurança pertence a uma VPC. O &lt;code&gt;launch-wizard-…&lt;/code&gt; da VPC padrão não serve nesta rede. Deixe o &lt;strong&gt;default&lt;/strong&gt; da &lt;code&gt;VPC-01&lt;/code&gt;. Voltamos a ele depois da sub-rede.&lt;/p&gt;

&lt;p&gt;À direita, clique em &lt;strong&gt;Criar nova sub-rede&lt;/strong&gt;. O link abre o assistente de sub-redes em &lt;strong&gt;outra aba&lt;/strong&gt; do navegador. Não feche a aba do Launch Wizard e não recarregue essa aba com F5: o formulário da &lt;code&gt;my-server&lt;/code&gt; se perde. Deixe-a aberta.&lt;/p&gt;

&lt;p&gt;Na nova aba, o campo &lt;strong&gt;ID da VPC&lt;/strong&gt; começa em &lt;strong&gt;Selecionar uma VPC&lt;/strong&gt;. O atalho não preenche a &lt;code&gt;VPC-01&lt;/code&gt; sozinho. Abra a lista e selecione &lt;strong&gt;VPC-01&lt;/strong&gt; de novo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdhdqu3fchzffp9owls6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmdhdqu3fchzffp9owls6.png" alt="Assistente Criar sub-rede com o campo ID da VPC ainda sem seleção." width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Depois dessa seleção, o restante do formulário de sub-rede é habilitado.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Criar a sub-rede my-subnet-01
&lt;/h2&gt;

&lt;p&gt;A sub-rede é um pedaço da VPC em uma &lt;strong&gt;zona de disponibilidade&lt;/strong&gt;. A VPC cobre a região &lt;code&gt;us-east-1&lt;/code&gt;. A sub-rede escolhe uma zona, neste laboratório &lt;code&gt;us-east-1a&lt;/code&gt;. A instância herda essa zona. Não existe EC2 “só na VPC”: a interface de rede precisa de uma sub-rede.&lt;/p&gt;

&lt;p&gt;Em &lt;strong&gt;Nome da sub-rede&lt;/strong&gt;, escreva &lt;code&gt;my-subnet-01&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1pvtag4q3gh3khpzudf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe1pvtag4q3gh3khpzudf.png" alt="Campo Nome da sub-rede preenchido com my-subnet-01." width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Em &lt;strong&gt;Zona de disponibilidade&lt;/strong&gt;, abra a lista. Não deixe &lt;strong&gt;Sem preferência&lt;/strong&gt;: a AWS escolheria a zona, e o laboratório ficaria difícil de repetir. Procure a linha cujo nome de zona é &lt;strong&gt;us-east-1a&lt;/strong&gt;. Ao lado aparece um código &lt;code&gt;use1-az…&lt;/code&gt;. Esse código é diferente em cada conta. Não escolha pela coluna &lt;code&gt;use1-az1&lt;/code&gt; do print. Escolha pelo texto &lt;strong&gt;us-east-1a&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F75ghy0cvgrqaw4qhj1vy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F75ghy0cvgrqaw4qhj1vy.png" alt="Lista de zonas de disponibilidade de us-east-1." width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;O &lt;strong&gt;Bloco CIDR IPv4 da VPC&lt;/strong&gt; deve mostrar &lt;code&gt;10.0.0.0/24&lt;/code&gt;. A sub-rede tem de caber nesse intervalo.&lt;/p&gt;

&lt;p&gt;O campo &lt;strong&gt;Bloco CIDR IPv4 da sub-rede&lt;/strong&gt; vem preenchido com &lt;code&gt;10.0.0.0/28&lt;/code&gt;. &lt;code&gt;/28&lt;/code&gt; são 16 endereços. A AWS reserva cinco endereços em cada sub-rede (endereço de rede, roteador interno, DNS, uma reserva futura e o endereço de broadcast). Em um &lt;code&gt;/28&lt;/code&gt; restam 11 utilizáveis. &lt;strong&gt;Não deixe &lt;code&gt;/28&lt;/code&gt;&lt;/strong&gt;. Apague e digite &lt;strong&gt;&lt;code&gt;10.0.0.0/24&lt;/code&gt;&lt;/strong&gt;, o mesmo bloco da VPC. Só assim a sub-rede fica com 251 endereços disponíveis (256 menos os cinco reservados), como neste laboratório.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpcxmmjdq36xyq7fab51p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpcxmmjdq36xyq7fab51p.png" alt="Campo CIDR da sub-rede ainda com a sugestão 10.0.0.0/28, que deve ser alterada para 10.0.0.0/24." width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No canto inferior direito, clique em &lt;strong&gt;Criar sub-rede&lt;/strong&gt;. Espere o banner verde de sucesso. A lista deve mostrar &lt;code&gt;my-subnet-01&lt;/code&gt;, estado &lt;strong&gt;Available&lt;/strong&gt;, CIDR IPv4 &lt;strong&gt;10.0.0.0/24&lt;/strong&gt; e &lt;strong&gt;251&lt;/strong&gt; endereços disponíveis. Se aparecer &lt;code&gt;/28&lt;/code&gt; e cerca de 11 endereços, a sub-rede foi criada com o valor sugerido do formulário. Marque a linha, abra &lt;strong&gt;Ações&lt;/strong&gt;, escolha &lt;strong&gt;Excluir sub-rede&lt;/strong&gt;, confirme e crie de novo com &lt;code&gt;10.0.0.0/24&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogoh1lx2h4m8gnqgs63u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fogoh1lx2h4m8gnqgs63u.png" alt="Sub-rede my-subnet-01 criada, Available, CIDR 10.0.0.0/24, 251 endereços." width="799" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Uma sub-rede &lt;code&gt;/24&lt;/code&gt; dentro de uma VPC &lt;code&gt;/24&lt;/code&gt; usa o espaço inteiro. Não sobra faixa para uma segunda sub-rede em outra zona, a menos que você acrescente outro bloco à VPC. Para este laboratório de uma zona, isso é o esperado.&lt;/p&gt;

&lt;p&gt;Deixe esta aba como conferência e &lt;strong&gt;volte à aba do Launch Wizard&lt;/strong&gt; (título &lt;strong&gt;Executar uma instância&lt;/strong&gt;). Não use F5 nessa aba.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Voltar ao Launch Wizard e executar a instância
&lt;/h2&gt;

&lt;p&gt;No Launch Wizard, localize o campo &lt;strong&gt;Sub-rede&lt;/strong&gt;. Se a lista ainda estiver vazia, clique no ícone circular de &lt;strong&gt;atualizar&lt;/strong&gt; à direita do campo VPC ou do campo Sub-rede. Não recarregue a página. A &lt;code&gt;my-subnet-01&lt;/code&gt; deve aparecer, na zona &lt;code&gt;us-east-1a&lt;/code&gt;, com CIDR &lt;code&gt;10.0.0.0/24&lt;/code&gt;. Selecione-a.&lt;/p&gt;

&lt;p&gt;Em &lt;strong&gt;Atribuir IP público automaticamente&lt;/strong&gt;, escolha &lt;strong&gt;Desabilitar&lt;/strong&gt;. O aviso vermelho dessa opção some. A instância ganha um IP &lt;strong&gt;privado&lt;/strong&gt; em &lt;code&gt;10.0.0.0/24&lt;/code&gt;. Não ganha endereço público. Sem endereço público, você não faz SSH a partir da sua rede local. Isso não desfaz a vinculação: a interface continua na &lt;code&gt;my-subnet-01&lt;/code&gt; e na &lt;code&gt;VPC-01&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Para a instância falar com a internet neste desenho, faltariam um Internet Gateway, uma rota para toda a internet (escrita &lt;code&gt;0.0.0.0/0&lt;/code&gt;, “qualquer endereço IPv4”) &lt;strong&gt;e&lt;/strong&gt; um endereço público (ou um NAT). Com IP público em Desabilitar, gateway e rota sozinhos não bastam. Este laboratório não cria esses objetos. O alvo aqui é a VPC personalizada, não o acesso público.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr1qsc6dfsu732h1dhz6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr1qsc6dfsu732h1dhz6u.png" alt="Sub-rede my-subnet-01 selecionada e Atribuir IP público automaticamente em Desabilitar." width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Em &lt;strong&gt;Firewall (grupos de segurança)&lt;/strong&gt;, mantenha &lt;strong&gt;Selecionar grupo de segurança existente&lt;/strong&gt; e o grupo &lt;strong&gt;default&lt;/strong&gt; da &lt;code&gt;VPC-01&lt;/code&gt;. Não volte a criar um grupo com SSH originado de &lt;code&gt;0.0.0.0/0&lt;/code&gt; neste laboratório: essa origem, o mesmo “qualquer endereço” da rota de internet, libera a porta 22 para o mundo inteiro.&lt;/p&gt;

&lt;p&gt;O grupo de segurança é o filtro de tráfego da interface de rede. O default de uma VPC nova, na documentação da AWS, aceita tráfego que venha do próprio grupo e libera a saída. Ele não abre SSH para a internet sozinho. Ler as regras de entrada depois, em &lt;strong&gt;EC2 → Grupos de segurança&lt;/strong&gt;, é opcional e não faz parte da vinculação.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqvg887taoegsr26q55n3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqvg887taoegsr26q55n3.png" alt="Grupo de segurança default da VPC-01 selecionado." width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No resumo à direita, confira: Amazon Linux 2023, &lt;code&gt;t2.micro&lt;/code&gt;, firewall &lt;strong&gt;default&lt;/strong&gt;, um volume de 8 GiB, par de chaves selecionado. Clique em &lt;strong&gt;Executar instância&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr0erzj5wud3h40fm9nbc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr0erzj5wud3h40fm9nbc.png" alt="Resumo do Launch Wizard e o botão Executar instância." width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;O console mostra uma confirmação de lançamento, em geral com o identificador da instância. Nessa tela, clique em &lt;strong&gt;Ver todas as instâncias&lt;/strong&gt;. Se esse botão não aparecer, use o menu esquerdo &lt;strong&gt;Instâncias&lt;/strong&gt;. Não use o Voltar do navegador: você pode cair de novo no formulário vazio.&lt;/p&gt;

&lt;p&gt;Na lista, clique no nome &lt;strong&gt;my-server&lt;/strong&gt;. O estado passa de pendente para em execução em poucos segundos. Abra a aba &lt;strong&gt;Rede&lt;/strong&gt;. A VPC deve ser &lt;code&gt;VPC-01&lt;/code&gt; e a sub-rede, &lt;code&gt;my-subnet-01&lt;/code&gt;. Este artigo não inclui a captura dessa tela depois do clique; o critério de sucesso da vinculação é exatamente esse par nos detalhes da instância.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que foi construído
&lt;/h2&gt;

&lt;p&gt;A cadeia, do maior para o menor, é esta:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A VPC &lt;code&gt;VPC-01&lt;/code&gt; define o bloco &lt;code&gt;10.0.0.0/24&lt;/code&gt; na região &lt;code&gt;us-east-1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A sub-rede &lt;code&gt;my-subnet-01&lt;/code&gt; usa esse bloco na zona &lt;code&gt;us-east-1a&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A interface de rede da &lt;code&gt;my-server&lt;/code&gt; recebe um IP privado nessa sub-rede.&lt;/li&gt;
&lt;li&gt;O grupo &lt;strong&gt;default&lt;/strong&gt; da &lt;code&gt;VPC-01&lt;/code&gt; filtra o tráfego dessa interface.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Criar a VPC, sozinha, não move a EC2. Lançar a EC2 sem &lt;strong&gt;Editar&lt;/strong&gt; a rede deixa a instância na VPC padrão. A vinculação acontece quando a sub-rede da &lt;code&gt;VPC-01&lt;/code&gt; está selecionada no Launch Wizard no instante de &lt;strong&gt;Executar instância&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;my-server&lt;/code&gt; está na rede personalizada. Pelos prints deste laboratório, ela não está acessível pela internet. Expor SSH exigiria gateway, rota, endereço público e uma regra de entrada definida de propósito. Isso fica para outro exercício.&lt;/p&gt;

&lt;p&gt;Se quiser a referência oficial dos conceitos usados aqui: &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html" rel="noopener noreferrer"&gt;What is Amazon VPC?&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/create-vpc.html" rel="noopener noreferrer"&gt;Create a VPC&lt;/a&gt;, &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html" rel="noopener noreferrer"&gt;Subnet CIDR blocks&lt;/a&gt; e &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-instance-wizard.html" rel="noopener noreferrer"&gt;Launch an Amazon EC2 instance&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>vpc</category>
      <category>ec2</category>
      <category>networking</category>
    </item>
    <item>
      <title>The 3-2-1-1-0 backup rule. We had everything except the zero</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Wed, 07 Oct 2026 00:40:53 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/the-3-2-1-1-0-backup-rule-we-had-everything-except-the-zero-4p2f</link>
      <guid>https://dev.to/rodolfocoding/the-3-2-1-1-0-backup-rule-we-had-everything-except-the-zero-4p2f</guid>
      <description>&lt;h1&gt;
  
  
  The 3-2-1-1-0 backup rule. We had everything except the zero
&lt;/h1&gt;

&lt;p&gt;Backup looks simple until the day you need it.&lt;/p&gt;

&lt;p&gt;In simple terms, a backup means making a copy of your data so it can be recovered if the original is lost, corrupted, or deleted.&lt;/p&gt;

&lt;p&gt;But there is an important difference between having a backup and being able to recover your data from it.&lt;/p&gt;

&lt;p&gt;Imagine that every day an automated process backs up your database. At the end, the system shows a big green mark: the process finished without errors.&lt;/p&gt;

&lt;p&gt;You might think: "everything is protected."&lt;/p&gt;

&lt;p&gt;But what does that green mark actually mean?&lt;/p&gt;

&lt;p&gt;Only that the process was able to run the steps it was supposed to run. By itself, it does not guarantee that the copy is intact, that the data is consistent, or that you can recover it when you really need to.&lt;/p&gt;

&lt;p&gt;This is where the 3-2-1-1-0 rule comes in.&lt;/p&gt;

&lt;p&gt;It is a strategy to reduce the risk of losing data even when something goes wrong. The numbers describe how copies should be kept and protected:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;3&lt;/strong&gt; copies of the data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2&lt;/strong&gt; different types of media or storage&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1&lt;/strong&gt; copy kept off the primary environment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1&lt;/strong&gt; isolated or immutable copy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0&lt;/strong&gt; errors during the recovery test&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last number is the interesting one.&lt;/p&gt;

&lt;p&gt;Zero is not another copy or another place to store backups. It is a requirement: when it is time to recover the data, the restore has to work.&lt;/p&gt;

&lt;p&gt;Because a backup that has never been restored is, to a point, a hypothesis.&lt;/p&gt;

&lt;p&gt;The scene below is the starting point for understanding that count, and especially the reasoning behind each number.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftnatd7s1wktv00ndmppu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftnatd7s1wktv00ndmppu.jpg" alt="Backup protection strategies: 3 copies of the data, 2 different types of media or storage, 1 copy off the primary environment, 1 isolated or immutable copy, and 0 errors on the recovery test." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What fails when a number is missing
&lt;/h2&gt;

&lt;p&gt;The rule only holds if each number covers a different failure. If two numbers break the same way, you do not have five controls. You have repetition.&lt;/p&gt;

&lt;p&gt;Without the &lt;strong&gt;3&lt;/strong&gt;, production and the "backup" live in the same place. A retention mistake, a broad policy, or a compromised identity deletes the original and the copies together. Three names in one location are not three copies.&lt;/p&gt;

&lt;p&gt;Without the &lt;strong&gt;2&lt;/strong&gt;, the copies use the same media or the same storage service. The failure repeats: corruption, quota, API, region. Two identical disks in the same account fail the same way.&lt;/p&gt;

&lt;p&gt;Without the &lt;strong&gt;1&lt;/strong&gt; off the primary environment, the incident in that environment takes the backup with it. Compromised account, single IdP, unavailable region. The copy has to sit where that incident cannot reach.&lt;/p&gt;

&lt;p&gt;Without the &lt;strong&gt;1&lt;/strong&gt; that is isolated or immutable, whoever reached production also reaches the backup delete. Isolation cuts the easy path. Immutability blocks the delete even when the path appears. Ransomware that hits production usually hits the backup repository next. Without that lock, the way back disappears with the original.&lt;/p&gt;

&lt;p&gt;Without the &lt;strong&gt;0&lt;/strong&gt;, the job is green and the box will not open. The first four numbers say where the copy lives. The zero says whether it comes back.&lt;/p&gt;

&lt;p&gt;That is failure engineering, not a poster. It is still incomplete until restore has been exercised.&lt;/p&gt;

&lt;h2&gt;
  
  
  The green job lies by omission
&lt;/h2&gt;

&lt;p&gt;A successful backup job answers a narrow question: the writer persisted what was requested, to the configured destination, inside the window. It does not answer whether the incremental chain is intact. It does not answer whether the database was captured in a usable state (with a flush, a consistent snapshot, a native backup), or only as a disk in the middle of a write. It does not answer whether the KMS key for restore still exists, whether the identity doing the restore can read the vault, whether the destination engine accepts that version, or whether the time to return fits what the business calls acceptable.&lt;/p&gt;

&lt;p&gt;Integrity means the backup is complete and coherent. Availability means you can reach it and apply it. Neither one is the job's exit code.&lt;/p&gt;

&lt;p&gt;That is why the zero is not a quantity. It is not "one more vault". It is the acceptance criterion: restore on purpose, watch the data come back, measure how long it took, and only then call the design 3-2-1-1-0. Test the job. Test recoverability. Both. One without the other leaves a green check on a box that will not open.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjddj4rg57rju5jmxijle.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjddj4rg57rju5jmxijle.jpg" alt="The backup job is green. The restore failed. A copy is not recovery." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What a recovery test has to show
&lt;/h2&gt;

&lt;p&gt;The zero does not ask for a lab. It asks for four answers, obtained on purpose, without panic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;did the data come back?&lt;/li&gt;
&lt;li&gt;did it come back consistent, in a state the application will accept?&lt;/li&gt;
&lt;li&gt;could someone on the team run the restore without inventing permissions, keys, or a destination on the spot?&lt;/li&gt;
&lt;li&gt;does the time to return fit what the business can stand?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If any answer is "the job was green", the test has not happened yet. A dashboard measures the writer. Recovery measures the way back.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the backup work when you need it?
&lt;/h2&gt;

&lt;p&gt;"Do we have a backup?"&lt;/p&gt;

&lt;p&gt;That sounds like the right question. In practice, it says little. Most environments can answer yes.&lt;/p&gt;

&lt;p&gt;The question that actually matters is this one:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When was the last time someone restored that backup on purpose, in a real environment, and confirmed that the system came back up?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A dashboard can show that the backup finished successfully. It can show that the copy exists, that storage is healthy, and that the last job completed without errors.&lt;/p&gt;

&lt;p&gt;None of those signals answers whether you can recover the system when you actually need to.&lt;/p&gt;

&lt;p&gt;If the only evidence that the backup works is a green dashboard, you know you have a copy. You might already have the 3, the 2, and both 1s.&lt;/p&gt;

&lt;p&gt;But you are still missing the zero.&lt;/p&gt;

&lt;p&gt;The zero is proof that the way back works.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>backup</category>
      <category>disasterrecovery</category>
      <category>cloud</category>
    </item>
    <item>
      <title>A regra de backup 3-2-1-1-0. Tínhamos tudo, menos o zero</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Wed, 07 Oct 2026 00:40:52 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/a-regra-de-backup-3-2-1-1-0-tinhamos-tudo-menos-o-zero-dgn</link>
      <guid>https://dev.to/rodolfocoding/a-regra-de-backup-3-2-1-1-0-tinhamos-tudo-menos-o-zero-dgn</guid>
      <description>&lt;h1&gt;
  
  
  A regra de backup 3-2-1-1-0. Tínhamos tudo, menos o zero
&lt;/h1&gt;

&lt;p&gt;Backup parece simples até o dia em que você precisa dele.&lt;/p&gt;

&lt;p&gt;Em termos simples, fazer backup significa criar uma cópia dos seus dados para que eles possam ser recuperados caso o original seja perdido, corrompido ou apagado.&lt;/p&gt;

&lt;p&gt;Mas existe uma diferença importante entre ter um backup e conseguir recuperar seus dados a partir dele.&lt;/p&gt;

&lt;p&gt;Imagine que todos os dias um processo automatizado execute o backup do seu banco de dados. No final, o sistema mostra um grande sinal verde: o processo terminou sem erros.&lt;/p&gt;

&lt;p&gt;Você pode pensar: "está tudo protegido".&lt;/p&gt;

&lt;p&gt;Mas o que esse sinal verde realmente significa?&lt;/p&gt;

&lt;p&gt;Apenas que o processo conseguiu executar as etapas previstas. Ele não garante, sozinho, que a cópia esteja íntegra, que os dados estejam consistentes ou que seja possível recuperá-los quando você realmente precisar.&lt;/p&gt;

&lt;p&gt;É aqui que entra a regra 3-2-1-1-0.&lt;/p&gt;

&lt;p&gt;Ela é uma estratégia para reduzir o risco de perder os dados mesmo quando alguma coisa dá errado. Os números representam como as cópias devem ser mantidas e protegidas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;3&lt;/strong&gt; cópias dos dados&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2&lt;/strong&gt; tipos diferentes de mídia ou armazenamento&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1&lt;/strong&gt; cópia mantida fora do ambiente principal&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1&lt;/strong&gt; cópia isolada ou imutável&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;0&lt;/strong&gt; erros durante o teste de recuperação&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;O último número é o mais interessante.&lt;/p&gt;

&lt;p&gt;O zero não representa mais uma cópia ou outro lugar para armazenar seus backups. Ele representa uma exigência: quando chegar a hora de recuperar os dados, o restore precisa funcionar.&lt;/p&gt;

&lt;p&gt;Porque backup que nunca foi restaurado é, até certo ponto, uma hipótese.&lt;/p&gt;

&lt;p&gt;A cena abaixo é o ponto de partida para entender essa conta e, principalmente, a lógica por trás de cada número.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm8gkx5ee11ima0aggd5l.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm8gkx5ee11ima0aggd5l.jpg" alt="Estratégias de proteção do backup: 3 cópias dos dados, 2 tipos diferentes de mídia ou armazenamento, 1 cópia fora do ambiente principal, 1 cópia isolada ou imutável, e 0 erros no teste de recuperação." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  O que falha quando falta um número
&lt;/h2&gt;

&lt;p&gt;A regra só vale se cada número segura uma falha diferente. Se dois números quebram do mesmo jeito, você não tem cinco controles. Tem repetição.&lt;/p&gt;

&lt;p&gt;Sem o &lt;strong&gt;3&lt;/strong&gt;, produção e “backup” moram no mesmo destino. Um erro de retenção, uma policy larga ou uma identidade comprometida apaga o original e as cópias juntas. Três nomes no mesmo lugar não são três cópias.&lt;/p&gt;

&lt;p&gt;Sem o &lt;strong&gt;2&lt;/strong&gt;, as cópias usam o mesmo tipo de mídia ou o mesmo serviço de armazenamento. A falha se repete: corrupção, quota, API, região. Dois discos iguais, na mesma conta, falham do mesmo jeito.&lt;/p&gt;

&lt;p&gt;Sem o &lt;strong&gt;1&lt;/strong&gt; fora do ambiente principal, o incidente do ambiente leva o backup junto. Conta comprometida, IdP único, região indisponível. A cópia precisa estar onde esse incidente não alcança.&lt;/p&gt;

&lt;p&gt;Sem o &lt;strong&gt;1&lt;/strong&gt; isolado ou imutável, quem chegou na produção também chega no delete do backup. Isolamento corta o caminho fácil. Imutabilidade impede o delete mesmo quando o caminho aparece. Ransomware que mira produção costuma mirar o repositório de backup em seguida. Sem essa trava, a via de volta some com o original.&lt;/p&gt;

&lt;p&gt;Sem o &lt;strong&gt;0&lt;/strong&gt;, o job está verde e a caixa não abre. Os quatro primeiros números respondem onde a cópia está. O zero responde se ela volta.&lt;/p&gt;

&lt;p&gt;Isso é engenharia de falha, não poster. Ainda assim é incompleto enquanto o restore não for exercitado.&lt;/p&gt;

&lt;h2&gt;
  
  
  O job verde mente por omissão
&lt;/h2&gt;

&lt;p&gt;Um job de backup bem-sucedido responde a uma pergunta estreita: o writer conseguiu persistir o que foi pedido, no destino configurado, dentro da janela. Ele não responde se a cadeia incremental está íntegra. Não responde se o banco foi capturado em estado aplicável (com flush, com snapshot consistente, com backup nativo), ou só como um disco no meio de um write. Não responde se a chave KMS do restore ainda existe, se a identity que restaura tem permissão no cofre, se o engine de destino aceita aquela versão, se o tempo de volta cabe no que o negócio chama de aceitável.&lt;/p&gt;

&lt;p&gt;Integridade é o backup estar completo e coerente. Disponibilidade é conseguir acessá-lo e aplicá-lo. Nenhuma das duas é o exit code do job.&lt;/p&gt;

&lt;p&gt;Por isso o zero não é quantidade. Não é “mais um vault”. É o critério de aceite: restaurar de propósito, ver o dado voltar, medir quanto tempo levou, e só então chamar o desenho de 3-2-1-1-0. Teste do job. Teste da recuperabilidade. Os dois. Um sem o outro deixa um check verde em cima de uma caixa que não abre.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb9s0nm7url7dgo81ovyl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb9s0nm7url7dgo81ovyl.jpg" alt="O job de backup está verde. O restore falhou. Cópia não é recuperação." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  O que o teste de recuperação precisa mostrar
&lt;/h2&gt;

&lt;p&gt;O zero não pede um laboratório. Pede quatro respostas, obtidas de propósito, sem pânico:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;o dado voltou?&lt;/li&gt;
&lt;li&gt;voltou consistente, num estado que a aplicação aceita?&lt;/li&gt;
&lt;li&gt;alguém do time conseguiu fazer o restore sem improvisar permissão, chave ou destino?&lt;/li&gt;
&lt;li&gt;o tempo de volta cabe no que o negócio aguenta?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Se alguma resposta for “o job estava verde”, o teste ainda não aconteceu. Dashboard mede o writer. Recuperação mede o caminho de volta.&lt;/p&gt;

&lt;h2&gt;
  
  
  O backup funciona quando você precisa dele?
&lt;/h2&gt;

&lt;p&gt;"Temos backup?"&lt;/p&gt;

&lt;p&gt;Essa parece ser a pergunta certa. Mas, na prática, ela diz pouco. A maioria dos ambientes consegue responder que sim.&lt;/p&gt;

&lt;p&gt;A pergunta que realmente importa é outra:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quando foi a última vez que alguém restaurou esse backup de propósito, em um ambiente real, e confirmou que o sistema voltou a funcionar?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Um dashboard pode mostrar que o backup terminou com sucesso. Pode mostrar que a cópia existe, que o armazenamento está saudável e que o último job foi concluído sem erros.&lt;/p&gt;

&lt;p&gt;Mas nenhum desses indicadores responde se você consegue recuperar o sistema quando realmente precisar.&lt;/p&gt;

&lt;p&gt;Se a única evidência de que o backup funciona é um dashboard verde, você sabe que tem uma cópia. Talvez já tenha o 3, o 2 e os dois 1.&lt;/p&gt;

&lt;p&gt;Mas ainda falta o zero.&lt;/p&gt;

&lt;p&gt;O zero é a prova de que o caminho de volta funciona.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>backup</category>
      <category>disasterrecovery</category>
      <category>cloud</category>
    </item>
    <item>
      <title>A classe mais barata do S3 é a que você nunca abre</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Mon, 28 Sep 2026 22:36:13 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/a-classe-mais-barata-do-s3-e-a-que-voce-nunca-abre-4hp6</link>
      <guid>https://dev.to/rodolfocoding/a-classe-mais-barata-do-s3-e-a-que-voce-nunca-abre-4hp6</guid>
      <description>&lt;h1&gt;
  
  
  A classe mais barata do S3 é a que você nunca abre
&lt;/h1&gt;

&lt;p&gt;Um time tira alguns milhões de objetos do S3 Standard. O armazenamento por gigabyte cai. O financeiro respira. Dois meses depois alguém roda um job que lê quase o prefixo inteiro. A fatura não ficou mais barata. Ficou uma taxa de retrieval com uma storage class colada.&lt;/p&gt;

&lt;p&gt;Esse é o erro clássico do S3. A pessoa otimiza o preço de &lt;em&gt;guardar&lt;/em&gt; o byte. A conta também cobra por &lt;em&gt;tocar&lt;/em&gt; nele, por apagar cedo demais e por objeto menor do que a classe quer faturar.&lt;/p&gt;

&lt;p&gt;Se você guardar uma coisa: escolha a classe pela frequência de leitura, pela velocidade que essa leitura precisa ter e por conseguir ou não reconstruir o objeto se uma zona sumir. O resto é casar essas três respostas com uma classe que a AWS já nomeou.&lt;/p&gt;

&lt;p&gt;Referência oficial: &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html" rel="noopener noreferrer"&gt;Understanding and managing Amazon S3 storage classes&lt;/a&gt;. Preço fica em &lt;a href="https://aws.amazon.com/s3/pricing/" rel="noopener noreferrer"&gt;Amazon S3 pricing&lt;/a&gt;. Este artigo não cita valor em dólar. Isso muda por região e por data. O formato da troca não muda.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequência é o enredo inteiro
&lt;/h2&gt;

&lt;p&gt;S3 Standard é o padrão. Sobe o objeto, não manda o header de storage class, você está em Standard. &lt;code&gt;GET&lt;/code&gt; em milissegundo. Projetada para 99,99% de disponibilidade em pelo menos três Availability Zones. Sem duração mínima de armazenamento. Sem tamanho mínimo faturável. Você paga mais por GB guardado do que nas classes de arquivo, e não paga retrieval por GB numa leitura normal.&lt;/p&gt;

&lt;p&gt;Use quando o objeto está no caminho da requisição: imagem de produto, artefato de sessão, o dataset que a API bate esta semana, qualquer coisa que você teria vergonha de restaurar de um arquivo enquanto o usuário espera.&lt;/p&gt;

&lt;p&gt;Não use como sótão de dez anos. Tecnicamente dá. Você vai pagar Standard em dado que ninguém abre.&lt;/p&gt;

&lt;p&gt;A armadilha do outro lado é jogar &lt;em&gt;tudo&lt;/em&gt; numa classe infrequent ou Glacier porque a linha de storage é menor. Infrequent-access e Glacier somam cobrança de retrieval. Várias delas também faturam duração mínima e tamanho mínimo de objeto. Um prefixo cheio de arquivo miúdo que você reescreve toda semana é um encaixe ruim nessas classes, mesmo se você "quase nunca" pensa neles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quando você não conhece o padrão de acesso
&lt;/h2&gt;

&lt;p&gt;S3 Intelligent-Tiering existe para a resposta honesta: "ainda não sei."&lt;/p&gt;

&lt;p&gt;A AWS desenhou para acesso desconhecido, que muda, ou imprevisível. Ela observa os objetos e move entre tiers quando esfriam, e volta para Frequent Access se alguém lê de novo. Não tem taxa de retrieval dentro do Intelligent-Tiering. Você paga monitoramento e automação por objeto.&lt;/p&gt;

&lt;p&gt;Tiers automáticos, pela documentação atual:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frequent Access: onde o objeto novo começa.&lt;/li&gt;
&lt;li&gt;Infrequent Access: depois de 30 dias seguidos sem acesso.&lt;/li&gt;
&lt;li&gt;Archive Instant Access: depois de 90 dias seguidos sem acesso. Continua milissegundo, alto throughput.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Opcionais, só se a aplicação puder esperar:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Archive Access: assíncrono. Mesmo formato de performance do S3 Glacier Flexible Retrieval. Restore standard costuma levar de 3 a 5 horas.&lt;/li&gt;
&lt;li&gt;Deep Archive Access: assíncrono. Mesmo formato de performance do S3 Glacier Deep Archive. Restore standard costuma ficar dentro de 12 horas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Objeto menor que 128 KB não é monitorado. Fica em Frequent Access. Se o bucket é milhões de objetos miúdos, a taxa de monitoramento pode dominar e o auto-tiering nunca começa. Nesse caso Intelligent-Tiering é o default errado.&lt;/p&gt;

&lt;p&gt;Encaixa bem: data lake, dump de analytics, prefixo de produto novo cujo padrão de leitura você só vai aprender em produção.&lt;/p&gt;

&lt;p&gt;Encaixa mal: caminho quente que você já conhece (use Standard), ou arquivo conhecido que você não vai ler por anos (pule a taxa de monitoramento e coloque no Glacier de propósito).&lt;/p&gt;

&lt;h2&gt;
  
  
  Infrequent não é "Standard mais barato"
&lt;/h2&gt;

&lt;p&gt;S3 Standard-IA e S3 One Zone-IA mantêm acesso em milissegundo, como o Standard. A AWS descreve como dado de vida longa que você toca mais ou menos uma vez por mês. As duas cobram retrieval por GB. As duas têm 30 dias de duração mínima e 128 KB de tamanho mínimo faturável. Apagar, sobrescrever ou transicionar antes de 30 dias ainda cobra o resto do mês, proporcional.&lt;/p&gt;

&lt;p&gt;Por isso "mover para IA no segundo dia" pode sair mais caro do que deixar no Standard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standard-IA&lt;/strong&gt; guarda o objeto em pelo menos três Availability Zones. Projetada para 99,9% de disponibilidade. Orientação da própria AWS: use para a cópia principal que você não consegue recriar. Backup que você pode precisar restaurar neste trimestre, dado antigo da aplicação que ainda precisa servir um &lt;code&gt;GET&lt;/code&gt; em milissegundo, arquivo de compliance quieto mas não congelado.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One Zone-IA&lt;/strong&gt; guarda o objeto numa Availability Zone só. Projetada para 99,5% de disponibilidade. Storage mais barato. &lt;strong&gt;Não&lt;/strong&gt; aguenta a perda daquela zona. A AWS é explícita: use para dado que você reconstrói, ou para réplica, não como única cópia de algo que você não substitui.&lt;/p&gt;

&lt;p&gt;Se o objeto é a única cópia das notas fiscais do ano passado, One Zone-IA é o tipo errado de barato.&lt;/p&gt;

&lt;h2&gt;
  
  
  Glacier são três produtos diferentes que compartilham o nome da montanha
&lt;/h2&gt;

&lt;p&gt;Ainda se fala "joga no Glacier" como se fosse um botão. São três classes com três histórias de retrieval.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3 Glacier Instant Retrieval.&lt;/strong&gt; Preço de arquivo, &lt;code&gt;GET&lt;/code&gt; em milissegundo. Feita para dado de vida longa que você talvez toque uma vez por trimestre. Mínimo de 90 dias. Mínimo faturável de 128 KB. Tem taxa de retrieval. O objeto fica disponível em tempo real. É a classe do "quase nunca abrimos, mas quando o jurídico pede, quer agora."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3 Glacier Flexible Retrieval.&lt;/strong&gt; O objeto está arquivado. Um &lt;code&gt;GET&lt;/code&gt; normal não devolve os bytes até você restaurar. Mínimo de 90 dias. Metadado extra é cobrado por objeto (40 KB: 32 KB na tarifa Glacier Flexible, 8 KB na Standard, para o S3 ainda listar a key). Opções de retrieval na documentação atual de restore:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Opção&lt;/th&gt;
&lt;th&gt;Tempo típico (Flexible Retrieval)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Expedited&lt;/td&gt;
&lt;td&gt;1 a 5 minutos para objeto abaixo de 250 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard&lt;/td&gt;
&lt;td&gt;3 a 5 horas (minutos a 5 horas com Batch Operations)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bulk&lt;/td&gt;
&lt;td&gt;5 a 12 horas, retrieve de menor custo&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Bulk retrieval em objeto no Flexible Retrieval é gratuito. Expedited é caminho premium. Sem capacidade provisionada, Expedited pode ser recusado sob carga.&lt;/p&gt;

&lt;p&gt;Use Flexible Retrieval para restore grande que você consegue planejar: dump anual, árvore de disaster recovery que você espera nunca tocar, arquivo em que "ainda hoje à tarde" serve.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3 Glacier Deep Archive.&lt;/strong&gt; Menor custo de storage desta família. Mínimo de 180 dias. Mesmo estilo de cobrança extra de metadado. Restaura primeiro, depois lê. Expedited não existe. Restore standard costuma ficar dentro de 12 horas (cerca de 9 a 12 horas com Batch Operations). Bulk costuma ficar dentro de 48 horas.&lt;/p&gt;

&lt;p&gt;Use para dado que você guarda porque a política falou "sete anos", não porque um engenheiro vai dar &lt;code&gt;curl&lt;/code&gt; numa terça.&lt;/p&gt;

&lt;p&gt;Restore não é uma cópia sentada ao lado do arquivo para sempre. Você restaura por um número de dias, depois a cópia temporária expira. Se o runbook diz "é só dar GET no objeto", Deep Archive quebra esse runbook.&lt;/p&gt;

&lt;h2&gt;
  
  
  Uma decisão que cabe numa passada
&lt;/h2&gt;

&lt;p&gt;Passe o objeto (ou o prefixo) por estas perguntas:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Alguma coisa trava neste &lt;code&gt;GET&lt;/code&gt;?&lt;/strong&gt; Requisição do usuário, API, etapa de pipeline. Fique no Standard, nos tiers instantâneos do Intelligent-Tiering, no Instant Retrieval ou no Express One Zone. Não coloque no Flexible Retrieval nem no Deep Archive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eu conheço o padrão de acesso?&lt;/strong&gt; Não: Intelligent-Tiering, se o objeto for grande o bastante para monitorar. Sim, quente: Standard. Sim, frio mas instantâneo: Standard-IA ou Instant Retrieval. Sim, frio e assíncrono: Flexible Retrieval ou Deep Archive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consigo recriar se uma AZ sumir?&lt;/strong&gt; Não: não use One Zone-IA (nem Express One Zone) como única cópia.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quanto tempo vai viver, e qual o tamanho?&lt;/strong&gt; Menos de 30 dias ou muitos objetos abaixo de 128 KB: IA e Instant Retrieval vão faturar como se o objeto fosse maior e mais velho do que é.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quem paga se a gente ler o prefixo inteiro?&lt;/strong&gt; Se um job mensal varre tudo, classe com preço de retrieval pode ganhar do Standard no storage e perder no job.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Classe&lt;/th&gt;
&lt;th&gt;Acesso&lt;/th&gt;
&lt;th&gt;Restore primeiro?&lt;/th&gt;
&lt;th&gt;Duração mínima&lt;/th&gt;
&lt;th&gt;Tamanho mínimo faturável&lt;/th&gt;
&lt;th&gt;Zonas&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Standard&lt;/td&gt;
&lt;td&gt;Milissegundo, frequente&lt;/td&gt;
&lt;td&gt;Não&lt;/td&gt;
&lt;td&gt;Nenhuma&lt;/td&gt;
&lt;td&gt;Nenhum&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Intelligent-Tiering&lt;/td&gt;
&lt;td&gt;Milissegundo nos tiers automáticos&lt;/td&gt;
&lt;td&gt;Só nos tiers opcionais de arquivo&lt;/td&gt;
&lt;td&gt;Nenhuma&lt;/td&gt;
&lt;td&gt;Nenhum (abaixo de 128 KB fica Frequent)&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard-IA&lt;/td&gt;
&lt;td&gt;Milissegundo, infrequent&lt;/td&gt;
&lt;td&gt;Não&lt;/td&gt;
&lt;td&gt;30 dias&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One Zone-IA&lt;/td&gt;
&lt;td&gt;Milissegundo, infrequent&lt;/td&gt;
&lt;td&gt;Não&lt;/td&gt;
&lt;td&gt;30 dias&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Instant Retrieval&lt;/td&gt;
&lt;td&gt;Milissegundo, raro&lt;/td&gt;
&lt;td&gt;Não&lt;/td&gt;
&lt;td&gt;90 dias&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Flexible Retrieval&lt;/td&gt;
&lt;td&gt;Minutos a horas&lt;/td&gt;
&lt;td&gt;Sim&lt;/td&gt;
&lt;td&gt;90 dias&lt;/td&gt;
&lt;td&gt;Overhead de metadado&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Deep Archive&lt;/td&gt;
&lt;td&gt;Horas&lt;/td&gt;
&lt;td&gt;Sim&lt;/td&gt;
&lt;td&gt;180 dias&lt;/td&gt;
&lt;td&gt;Overhead de metadado&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A durabilidade projetada dessas classes é 99,999999999%, na mesma tabela de comparação. Disponibilidade não é o mesmo número. Standard e Flexible Retrieval (depois do restore) são projetadas para 99,99%. Standard-IA, Intelligent-Tiering e Instant Retrieval são projetadas para 99,9%. One Zone-IA é projetada para 99,5%.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pilhas concretas de objeto
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Lê todo dia.&lt;/strong&gt; Thumbnail, config atual, working set de um serviço. S3 Standard. Lifecycle depois, não no primeiro dia.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lê de vez em quando, ainda precisa de GET rápido.&lt;/strong&gt; Relatório do trimestre passado, "baixar nota" de um pedido antigo. Standard-IA se o objeto for grande o bastante e for viver mais de 30 dias. Instant Retrieval se a leitura estiver mais perto de uma vez por trimestre do que uma vez por mês.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backup.&lt;/strong&gt; Se o restore é incêndio e precisa ser rápido, Standard-IA ou Instant Retrieval. Se o restore é um fim de semana planejado, Flexible Retrieval. Se o restore é "a gente guarda porque o audit pediu", Deep Archive. One Zone-IA só se outra região ou outro sistema já tiver uma cópia em que você confia.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Guardar por anos, quase nunca abrir.&lt;/strong&gt; Deep Archive. Coloque um lifecycle no prefixo para não depender de alguém lembrar.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Job que pode varrer o prefixo.&lt;/strong&gt; Prefira Standard ou Intelligent-Tiering. Taxa de retrieval em IA e Instant Retrieval é precificada para leitura rara, não para "reprocessamos o lake."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Acesso desconhecido, objeto que não é miúdo.&lt;/strong&gt; Intelligent-Tiering como classe padrão no &lt;code&gt;PutObject&lt;/code&gt; (&lt;code&gt;x-amz-storage-class: INTELLIGENT_TIERING&lt;/code&gt;). Deixe os tiers opcionais assíncronos de arquivo desligados até a aplicação souber restaurar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mais uma classe se o problema de verdade for latência
&lt;/h2&gt;

&lt;p&gt;A documentação atual também lista &lt;strong&gt;S3 Express One Zone&lt;/strong&gt;: acesso em milissegundo de um dígito numa Availability Zone só, directory bucket, feito para compute sensível a latência perto do dado. Projetada para 99,95% de disponibilidade. Não substitui Standard numa API multi-AZ. Não é classe de arquivo. Se a dor é "Standard está lento demais neste loop apertado", leia aquela página. Se a dor é a fatura, é a página errada.&lt;/p&gt;

&lt;p&gt;A AWS ainda documenta Reduced Redundancy Storage. A mesma página pede para não usar. Standard é o substituto.&lt;/p&gt;

&lt;h2&gt;
  
  
  Como o time costuma errar isso
&lt;/h2&gt;

&lt;p&gt;Eles tratam uma classe como se fosse do bucket. Classe é por objeto. Regra de lifecycle move prefixo conforme envelhece: Standard por 30 dias, Standard-IA depois, Instant Retrieval ou Flexible Retrieval um ano mais tarde. Você não precisa de um bucket novo para cada classe.&lt;/p&gt;

&lt;p&gt;Eles esquecem que overwrite e delete entram na duração mínima. Um prefixo "barato" de IA que é trocado a cada deploy não é infrequent. É Standard com taxa extra.&lt;/p&gt;

&lt;p&gt;Eles tratam Glacier como pasta. O objeto continua no S3. Flexible Retrieval e Deep Archive só não fazem &lt;code&gt;GET&lt;/code&gt; até o &lt;code&gt;RestoreObject&lt;/code&gt; terminar.&lt;/p&gt;

&lt;p&gt;Eles otimizam storage e ignoram listagem, monitoramento e restore. A taxa por objeto do Intelligent-Tiering e os bytes de metadado do Glacier são reais. Pesam mais quando o objeto é pequeno e numeroso.&lt;/p&gt;

&lt;h2&gt;
  
  
  Um default que você consegue defender
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Caminho quente, conhecido: &lt;strong&gt;Standard&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Desconhecido, objeto que vale monitorar: &lt;strong&gt;Intelligent-Tiering&lt;/strong&gt;, só os tiers automáticos.&lt;/li&gt;
&lt;li&gt;Frio, precisa de &lt;code&gt;GET&lt;/code&gt; agora, multi-AZ: &lt;strong&gt;Standard-IA&lt;/strong&gt; ou &lt;strong&gt;Instant Retrieval&lt;/strong&gt;, conforme a raridade da leitura.&lt;/li&gt;
&lt;li&gt;Frio, precisa de &lt;code&gt;GET&lt;/code&gt; agora, você reconstrói: &lt;strong&gt;One Zone-IA&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Frio, você aguenta esperar horas: &lt;strong&gt;Flexible Retrieval&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Frio, você aguenta esperar um dia, vai guardar por anos: &lt;strong&gt;Deep Archive&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Se ainda parecer chute, não chute Glacier. Chute Intelligent-Tiering ou Standard, e coloque um lifecycle quando tiver log de acesso de verdade. A classe cara é a que te surpreende quando alguém finalmente abre o objeto.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>cloud</category>
      <category>storage</category>
    </item>
    <item>
      <title>The cheapest S3 class is the one you never open</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Mon, 28 Sep 2026 22:32:20 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/the-cheapest-s3-class-is-the-one-you-never-open-3c3l</link>
      <guid>https://dev.to/rodolfocoding/the-cheapest-s3-class-is-the-one-you-never-open-3c3l</guid>
      <description>&lt;p&gt;A team moves a few million objects out of S3 Standard. Storage per gigabyte drops. Finance is happy. Two months later someone runs a job that reads most of the prefix. The invoice does not look cheaper. It looks like a retrieval fee with a storage class attached.&lt;/p&gt;

&lt;p&gt;That is the usual S3 mistake. People optimize the price of &lt;em&gt;keeping&lt;/em&gt; a byte. The bill also charges you for &lt;em&gt;touching&lt;/em&gt; it, for deleting it too soon, and for objects that are smaller than the class wants to bill.&lt;/p&gt;

&lt;p&gt;If you remember one thing: pick a class for how often the object is read, how fast the read must be, and whether you can rebuild the object if a zone disappears. The rest is matching those three answers to a class AWS already named.&lt;/p&gt;

&lt;p&gt;Official reference: &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html" rel="noopener noreferrer"&gt;Understanding and managing Amazon S3 storage classes&lt;/a&gt;. Pricing lives on &lt;a href="https://aws.amazon.com/s3/pricing/" rel="noopener noreferrer"&gt;Amazon S3 pricing&lt;/a&gt;. This article does not quote dollar amounts. Those change by region and date. The shape of the trade-off does not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequency is the whole plot
&lt;/h2&gt;

&lt;p&gt;S3 Standard is the default. Upload an object, skip the storage-class header, you are in Standard. Millisecond &lt;code&gt;GET&lt;/code&gt;. Designed for 99.99% availability across at least three Availability Zones. No minimum storage duration. No minimum billable object size. You pay more per GB stored than the archive classes, and you do not pay a per-GB retrieval fee for a normal read.&lt;/p&gt;

&lt;p&gt;Use it when the object is part of the request path: product images, session artifacts, the dataset the API hits this week, anything you would be embarrassed to restore from an archive while a user waits.&lt;/p&gt;

&lt;p&gt;Do not use it as a ten-year attic. You can, technically. You will pay Standard rates for data nobody opens.&lt;/p&gt;

&lt;p&gt;The trap on the other side is dumping &lt;em&gt;everything&lt;/em&gt; into an infrequent or Glacier class because the storage line is lower. Infrequent-access and Glacier classes add retrieval charges. Several of them also bill a minimum duration and a minimum object size. A prefix full of tiny files that you rewrite every week is a bad fit for those classes even if you "almost never" think about them.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you do not know the access pattern
&lt;/h2&gt;

&lt;p&gt;S3 Intelligent-Tiering exists for the honest answer: "I do not know yet."&lt;/p&gt;

&lt;p&gt;AWS designed it for unknown, changing, or unpredictable access. It monitors objects and moves them between tiers as they go cold, then back to Frequent Access if they are read again. There are no retrieval fees inside Intelligent-Tiering. You pay a per-object monitoring and automation charge instead.&lt;/p&gt;

&lt;p&gt;Automatic tiers, from the current docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frequent Access: where new objects start.&lt;/li&gt;
&lt;li&gt;Infrequent Access: after 30 consecutive days with no access.&lt;/li&gt;
&lt;li&gt;Archive Instant Access: after 90 consecutive days with no access. Still millisecond, high-throughput access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Optional, only if your app can wait:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Archive Access: asynchronous. Same performance shape as S3 Glacier Flexible Retrieval. Standard restore is typically 3 to 5 hours.&lt;/li&gt;
&lt;li&gt;Deep Archive Access: asynchronous. Same performance shape as S3 Glacier Deep Archive. Standard restore is typically within 12 hours.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Objects smaller than 128 KB are not monitored. They stay in Frequent Access. If your bucket is millions of tiny objects, the monitoring fee can dominate and the auto-tiering never starts. In that case Intelligent-Tiering is the wrong default.&lt;/p&gt;

&lt;p&gt;Good fit: a data lake, analytics dumps, a new product prefix whose read pattern you will only learn in production.&lt;/p&gt;

&lt;p&gt;Bad fit: a well-known hot path (just use Standard), or a known archive you will not read for years (skip the monitoring fee and put it in Glacier on purpose).&lt;/p&gt;

&lt;h2&gt;
  
  
  Infrequent does not mean "cheaper Standard"
&lt;/h2&gt;

&lt;p&gt;S3 Standard-IA and S3 One Zone-IA keep millisecond access, like Standard. AWS describes them as long-lived data you touch about once a month. Both charge a per-GB retrieval fee. Both have a 30-day minimum storage duration and a 128 KB minimum billable object size. Delete, overwrite, or transition before 30 days and you still pay the rest of the month, prorated.&lt;/p&gt;

&lt;p&gt;That is why "move it to IA on day two" can cost more than leaving it in Standard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standard-IA&lt;/strong&gt; stores the object across at least three Availability Zones. Designed for 99.9% availability. AWS's own guidance: use this for a primary copy you cannot recreate. Backups you might restore this quarter, older app data that still has to serve a &lt;code&gt;GET&lt;/code&gt; in milliseconds, compliance files that are quiet but not frozen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One Zone-IA&lt;/strong&gt; stores the object in a single Availability Zone. Designed for 99.5% availability. Cheaper storage. It is &lt;strong&gt;not&lt;/strong&gt; resilient to the loss of that zone. AWS is explicit: use it for data you can rebuild, or for replicas, not as the only copy of something you cannot replace.&lt;/p&gt;

&lt;p&gt;If the object is the company's only copy of last year's invoices, One Zone-IA is the wrong kind of cheap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Glacier is three different products that share a mountain name
&lt;/h2&gt;

&lt;p&gt;People still say "put it in Glacier" as if that were one button. It is three classes with three retrieval stories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3 Glacier Instant Retrieval.&lt;/strong&gt; Archive pricing, millisecond &lt;code&gt;GET&lt;/code&gt;. Designed for long-lived data you might touch about once a quarter. 90-day minimum. 128 KB minimum billable size. Retrieval fees apply. The object is available in real time. This is the class for "we almost never open it, but when legal asks, they want it now."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3 Glacier Flexible Retrieval.&lt;/strong&gt; The object is archived. A normal &lt;code&gt;GET&lt;/code&gt; does not return the bytes until you restore it. 90-day minimum. Extra metadata is billed per object (40 KB: 32 KB at the Glacier Flexible rate, 8 KB at Standard, so S3 can still list the key). Retrieval options from the current restore docs:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Typical time (Flexible Retrieval)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Expedited&lt;/td&gt;
&lt;td&gt;1 to 5 minutes for objects under 250 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard&lt;/td&gt;
&lt;td&gt;3 to 5 hours (minutes to 5 hours with Batch Operations)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bulk&lt;/td&gt;
&lt;td&gt;5 to 12 hours, lowest-cost retrieve&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Bulk retrievals are free for objects in Flexible Retrieval. Expedited is a premium path. Without provisioned capacity, Expedited can be refused under load.&lt;/p&gt;

&lt;p&gt;Use Flexible Retrieval for large restores you can plan: yearly dumps, disaster-recovery trees you hope never to touch, archives where "this afternoon" is acceptable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3 Glacier Deep Archive.&lt;/strong&gt; Lowest storage cost in this family. 180-day minimum. Same style of extra metadata billing. Restore first, then read. Expedited is not available. Standard restore is typically within 12 hours (about 9 to 12 hours with Batch Operations). Bulk is typically within 48 hours.&lt;/p&gt;

&lt;p&gt;Use it for data you are keeping because a policy said "seven years," not because an engineer will &lt;code&gt;curl&lt;/code&gt; it on a Tuesday.&lt;/p&gt;

&lt;p&gt;A restore is not a copy sitting next to the archive forever. You restore for a number of days, then the temporary copy expires. If the runbook says "just GET the object," Deep Archive will fail that runbook.&lt;/p&gt;

&lt;h2&gt;
  
  
  A decision you can make in one pass
&lt;/h2&gt;

&lt;p&gt;Walk the object (or the prefix) through these questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Will something block on this &lt;code&gt;GET&lt;/code&gt;?&lt;/strong&gt; User request, API, pipeline step. Stay in Standard, Intelligent-Tiering's instant tiers, Instant Retrieval, or Express One Zone. Do not put it in Flexible Retrieval or Deep Archive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do I know the access pattern?&lt;/strong&gt; No: Intelligent-Tiering, if objects are large enough to monitor. Yes, hot: Standard. Yes, cold but instant: Standard-IA or Instant Retrieval. Yes, cold and async: Flexible Retrieval or Deep Archive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Can I recreate it if one AZ is gone?&lt;/strong&gt; No: do not use One Zone-IA (or Express One Zone) as the only copy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How long will it live, and how big is it?&lt;/strong&gt; Under 30 days or lots of sub-128 KB objects: IA and Instant Retrieval will bill you as if the objects were larger and older than they are.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who pays if we read the whole prefix?&lt;/strong&gt; If a monthly job scans everything, retrieval-priced classes can beat Standard on storage and lose on the job.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Class&lt;/th&gt;
&lt;th&gt;Access&lt;/th&gt;
&lt;th&gt;Restore first?&lt;/th&gt;
&lt;th&gt;Min duration&lt;/th&gt;
&lt;th&gt;Min billable size&lt;/th&gt;
&lt;th&gt;Zones&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Standard&lt;/td&gt;
&lt;td&gt;Millisecond, frequent&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Intelligent-Tiering&lt;/td&gt;
&lt;td&gt;Millisecond in the automatic tiers&lt;/td&gt;
&lt;td&gt;Only in optional archive tiers&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;None (under 128 KB stays Frequent)&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard-IA&lt;/td&gt;
&lt;td&gt;Millisecond, infrequent&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One Zone-IA&lt;/td&gt;
&lt;td&gt;Millisecond, infrequent&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Instant Retrieval&lt;/td&gt;
&lt;td&gt;Millisecond, rare&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;90 days&lt;/td&gt;
&lt;td&gt;128 KB&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Flexible Retrieval&lt;/td&gt;
&lt;td&gt;Minutes to hours&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;90 days&lt;/td&gt;
&lt;td&gt;Metadata overhead&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Glacier Deep Archive&lt;/td&gt;
&lt;td&gt;Hours&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;180 days&lt;/td&gt;
&lt;td&gt;Metadata overhead&lt;/td&gt;
&lt;td&gt;&amp;gt;= 3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Designed-for durability for these classes is 99.999999999%, per the same comparison table. Availability is not the same number. Standard and Flexible Retrieval (after restore) are designed for 99.99%. Standard-IA, Intelligent-Tiering, and Instant Retrieval are designed for 99.9%. One Zone-IA is designed for 99.5%.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concrete piles of objects
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Read every day.&lt;/strong&gt; Thumbnails, current config, the working set of a service. S3 Standard. Lifecycle later, not on day one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read now and then, still need a fast GET.&lt;/strong&gt; Last quarter's reports, "download invoice" on an old order. Standard-IA if the objects are large enough and will live past 30 days. Instant Retrieval if the read is closer to once a quarter than once a month.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backups.&lt;/strong&gt; If restore is a fire drill and has to be fast, Standard-IA or Instant Retrieval. If restore is a planned weekend, Flexible Retrieval. If restore is "we keep this because audit said so," Deep Archive. One Zone-IA only if another region or another system already has a copy you trust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep it for years, almost never open it.&lt;/strong&gt; Deep Archive. Put a lifecycle on the prefix so you do not rely on a human remembering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A job that might scan the prefix.&lt;/strong&gt; Prefer Standard or Intelligent-Tiering. Retrieval fees on IA and Instant Retrieval are priced for rare reads, not for "we reprocessed the lake."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unknown access, objects not tiny.&lt;/strong&gt; Intelligent-Tiering as the default class on &lt;code&gt;PutObject&lt;/code&gt; (&lt;code&gt;x-amz-storage-class: INTELLIGENT_TIERING&lt;/code&gt;). Leave the optional async archive tiers off until the application can restore.&lt;/p&gt;

&lt;h2&gt;
  
  
  One more class if latency is the actual problem
&lt;/h2&gt;

&lt;p&gt;The current docs also list &lt;strong&gt;S3 Express One Zone&lt;/strong&gt;: single-digit millisecond access in one Availability Zone, directory buckets, built for latency-sensitive compute next to the data. Designed for 99.95% availability. Not a replacement for Standard in a multi-AZ API. Not an archive class. If the pain is "Standard is too slow for this tight loop," read that page. If the pain is the bill, it is the wrong page.&lt;/p&gt;

&lt;p&gt;AWS still documents Reduced Redundancy Storage. The same page says not to use it. Standard is the replacement.&lt;/p&gt;

&lt;h2&gt;
  
  
  How teams usually get this wrong
&lt;/h2&gt;

&lt;p&gt;They set one class on the bucket in their head. Classes are per object. Lifecycle rules move prefixes as they age: Standard for 30 days, Standard-IA after that, Instant Retrieval or Flexible Retrieval a year later. You do not need a new bucket for each class.&lt;/p&gt;

&lt;p&gt;They forget that overwrite and delete count toward minimum duration. A "cheap" IA prefix that is replaced every deploy is not infrequent. It is Standard with extra fees.&lt;/p&gt;

&lt;p&gt;They treat Glacier as a folder. The object stays in S3. Flexible Retrieval and Deep Archive just will not &lt;code&gt;GET&lt;/code&gt; until &lt;code&gt;RestoreObject&lt;/code&gt; finishes.&lt;/p&gt;

&lt;p&gt;They optimize storage and ignore listing, monitoring, and restore. Intelligent-Tiering's per-object fee and Glacier's metadata bytes are real. They matter most when objects are small and numerous.&lt;/p&gt;

&lt;h2&gt;
  
  
  A default you can defend
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Hot path, known: &lt;strong&gt;Standard&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Unknown, objects worth monitoring: &lt;strong&gt;Intelligent-Tiering&lt;/strong&gt;, automatic tiers only.&lt;/li&gt;
&lt;li&gt;Cold, must &lt;code&gt;GET&lt;/code&gt; now, multi-AZ: &lt;strong&gt;Standard-IA&lt;/strong&gt; or &lt;strong&gt;Instant Retrieval&lt;/strong&gt;, depending on how rare the read is.&lt;/li&gt;
&lt;li&gt;Cold, must &lt;code&gt;GET&lt;/code&gt; now, you can rebuild it: &lt;strong&gt;One Zone-IA&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Cold, you can wait hours: &lt;strong&gt;Flexible Retrieval&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Cold, you can wait a day, you will keep it for years: &lt;strong&gt;Deep Archive&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If that still feels like a guess, do not guess Glacier. Guess Intelligent-Tiering or Standard, then add a lifecycle when you have a real access log. The expensive class is the one that surprises you when someone finally opens the object.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>cloud</category>
      <category>storage</category>
    </item>
    <item>
      <title>O mesmo pedido chegou quatro vezes. O SQS não estava errado</title>
      <dc:creator>Rodolfo Henrique</dc:creator>
      <pubDate>Sun, 20 Sep 2026 21:09:28 +0000</pubDate>
      <link>https://dev.to/rodolfocoding/o-mesmo-pedido-chegou-quatro-vezes-o-sqs-nao-estava-errado-211m</link>
      <guid>https://dev.to/rodolfocoding/o-mesmo-pedido-chegou-quatro-vezes-o-sqs-nao-estava-errado-211m</guid>
      <description>&lt;p&gt;Este artigo é a continuação do lab de &lt;a href="https://medium.com/@rodolfo.coding/o-visibility-timeout-do-sqs-que-n%C3%A3o-processou-o-pedido-duas-vezes-2598624cadd8" rel="noopener noreferrer"&gt;visibility timeout no SQS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;No primeiro lab eu tentei fabricar uma duplicata atrasando o relógio da fila. Não funcionou. A Lambda estende o visibility timeout enquanto processa. O alvo era o relógio. O alvo errado.&lt;/p&gt;

&lt;p&gt;O que ficou em aberto era outra coisa: o &lt;strong&gt;produtor&lt;/strong&gt;. E se eu mesmo mandar o mesmo pedido duas, quatro, dez vezes?&lt;/p&gt;

&lt;p&gt;Foi isso que eu fiz. Abaixo está o que subi, por que subi, e o que cada print mostra.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que eu queria descobrir
&lt;/h2&gt;

&lt;p&gt;O Amazon SQS (Simple Queue Service) é uma fila. Você coloca uma mensagem. Um consumidor tira a mensagem e trabalha.&lt;/p&gt;

&lt;p&gt;Fila &lt;strong&gt;standard&lt;/strong&gt; entrega &lt;em&gt;pelo menos uma vez&lt;/em&gt;. A documentação da Lambda diz a mesma coisa do outro lado: o event source mapping (a ligação fila → função) também processa pelo menos uma vez. O código precisa ser &lt;strong&gt;idempotente&lt;/strong&gt;: processar o mesmo pedido uma vez ou dez vezes deixa o mesmo resultado.&lt;/p&gt;

&lt;p&gt;Isso cobre a &lt;em&gt;mensagem&lt;/em&gt;. Não cobre o &lt;em&gt;pedido&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Imagine o checkout. O usuário clica em pagar. A rede falha. Ele clica de novo. O backend manda duas mensagens. O SQS aceita as duas. Cada uma ganha um &lt;code&gt;MessageId&lt;/code&gt; novo. Para a fila, são dois recados. Para o caixa, é o mesmo &lt;code&gt;ORDER-003&lt;/code&gt; de 150 reais.&lt;/p&gt;

&lt;p&gt;Pergunta do lab:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Se várias mensagens representam o mesmo pedido, o worker cobra uma vez ou cobra cada mensagem?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Dois identificadores. Não misture.
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Identificador&lt;/th&gt;
&lt;th&gt;Quem cria&lt;/th&gt;
&lt;th&gt;O que significa&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MessageId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;O SQS, a cada &lt;code&gt;SendMessage&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Aquela cópia na fila&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;orderId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Você, no JSON do body&lt;/td&gt;
&lt;td&gt;O pedido de negócio&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;O &lt;code&gt;MessageId&lt;/code&gt; nomeia a mensagem. O &lt;code&gt;orderId&lt;/code&gt; nomeia o pedido. Idempotência neste lab trava o &lt;strong&gt;pedido&lt;/strong&gt;, não a mensagem.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que eu subi na AWS
&lt;/h2&gt;

&lt;p&gt;Tudo em &lt;code&gt;us-east-1&lt;/code&gt;. Sem fila FIFO. Sem gateway de pagamento. A "cobrança" é um log chamado &lt;code&gt;charge_applied&lt;/code&gt;. Se esse log aparece, o lab considera que o caixa rodou.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PowerShell (send.ps1)
        |
        v
SQS standard: aws-lab-sqs-idempotency
        |
        |  uma mensagem por invocação (batch size 1)
        v
Lambda: aws-lab-sqs-idempotency-worker
        |
        +-- CloudWatch Logs  (o que aconteceu)
        +-- DynamoDB         (a trava do orderId)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Peça&lt;/th&gt;
&lt;th&gt;Nome&lt;/th&gt;
&lt;th&gt;Para que serve&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fila&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aws-lab-sqs-idempotency&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Recebe as cópias do pedido&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Função&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aws-lab-sqs-idempotency-worker&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lê a fila e "cobra"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tabela&lt;/td&gt;
&lt;td&gt;&lt;code&gt;aws-lab-sqs-idempotency&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Guarda o &lt;code&gt;orderId&lt;/code&gt; com um write condicional&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Logs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/aws/lambda/aws-lab-sqs-idempotency-worker&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Evidência no Insights&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A função tem um interruptor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;IDEMPOTENCY=0&lt;/code&gt;: chegou mensagem, cobra. Sem perguntar nada.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;IDEMPOTENCY=1&lt;/code&gt;: antes de cobrar, tenta gravar o &lt;code&gt;orderId&lt;/code&gt; no DynamoDB. Se o item já existe, não cobra.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Por que batch size 1: cada mensagem vira uma invocação. Assim duas cópias podem correr ao mesmo tempo, em vez de cair no mesmo lote.&lt;/p&gt;

&lt;h2&gt;
  
  
  Por que a guarda não é um &lt;code&gt;if&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Este código parece idempotência e não é:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Duas Lambdas leem ao mesmo tempo. As duas veem "não existe". As duas cobram. As duas gravam depois. A verificação e a reserva precisam ser &lt;strong&gt;a mesma operação&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;No DynamoDB isso é um &lt;code&gt;PutItem&lt;/code&gt; com condição: "grave este &lt;code&gt;orderId&lt;/code&gt; só se ele ainda não existir".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ddb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PutItemCommand&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;TableName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;tableName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;S&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;orderId&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;S&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CLAIMED&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;messageId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;S&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;messageId&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;requestId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;S&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;requestId&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;claimedAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;S&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;ConditionExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;attribute_not_exists(orderId)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Leitura do código, em português:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tente criar o item com PK &lt;code&gt;orderId&lt;/code&gt; e status &lt;code&gt;CLAIMED&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Se ninguém gravou essa PK ainda, você ganhou (&lt;code&gt;claim_won&lt;/code&gt;). Aí você cobra e marca &lt;code&gt;COMPLETED&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Se a PK já existe, o DynamoDB recusa com &lt;code&gt;ConditionalCheckFailedException&lt;/code&gt;. Você perdeu (&lt;code&gt;claim_lost&lt;/code&gt;), loga &lt;code&gt;skip_duplicate&lt;/code&gt; e &lt;strong&gt;não cobra&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;CLAIMED&lt;/code&gt; é reserva, não recibo. Eu não marco &lt;code&gt;COMPLETED&lt;/code&gt; antes de cobrar. Se eu marcasse "já processado" e a cobrança falhasse, o retry pularia um pedido que nunca saiu.&lt;/p&gt;

&lt;h2&gt;
  
  
  Experimento 1: interruptor desligado
&lt;/h2&gt;

&lt;p&gt;O que eu fiz: subi o lab com &lt;code&gt;IDEMPOTENCY=0&lt;/code&gt; e mandei mensagens do mesmo pedido.&lt;/p&gt;

&lt;p&gt;Por que: para ver o comportamento sem trava. Se o worker cobra cada mensagem, o Insights tem que mostrar &lt;strong&gt;mais cobranças do que pedidos&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;O que eu vi no Logs Insights (Analytics de logs, visão &lt;strong&gt;Tabelas de pesquisa&lt;/strong&gt;), numa janela em que só existem três tipos de evento:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;eventType&lt;/th&gt;
&lt;th&gt;O que significa&lt;/th&gt;
&lt;th&gt;n&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;process_start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A Lambda começou a tratar a mensagem&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;charge_applied&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;O caixa rodou&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;process_end&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A invocação terminou&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Não tem &lt;code&gt;claim_won&lt;/code&gt; nem &lt;code&gt;skip_duplicate&lt;/code&gt;. A guarda estava desligada.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjhiufa52pz5wjogr96dd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjhiufa52pz5wjogr96dd.png" alt="Quatro process_start, quatro charge_applied, quatro process_end. Sem eventos de claim." width="799" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Olhe a tabela de baixo: três linhas, todas com 4. Quatro invocações, quatro cobranças.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Depois eu contei só o efeito. A consulta pega &lt;code&gt;charge_applied&lt;/code&gt; e pergunta: quantas cobranças, quantos &lt;code&gt;orderId&lt;/code&gt; distintos, quantos &lt;code&gt;MessageId&lt;/code&gt; distintos?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fields @timestamp, @message
| filter @message like /"type":"charge_applied"/
| parse @message /"orderId":"(?&amp;lt;orderId&amp;gt;[^"]+)"/
| parse @message /"messageId":"(?&amp;lt;messageId&amp;gt;[^"]+)"/
| stats count(*) as charges, count_distinct(orderId) as pedidos, count_distinct(messageId) as mensagens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;charges&lt;/th&gt;
&lt;th&gt;pedidos&lt;/th&gt;
&lt;th&gt;mensagens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5cnvcc8kkyeo51qylxz5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5cnvcc8kkyeo51qylxz5.png" alt="4 charges, 1 pedido, 4 mensagens" width="800" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Quatro MessageId. Um orderId. Quatro cobranças. A fila tratou quatro recados. O caixa tratou o mesmo pedido quatro vezes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;O mesmo número aparece em outro recorte da mesma consulta.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpusbrit3yd4f9rvp2zmr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpusbrit3yd4f9rvp2zmr.png" alt="Outro recorte da consulta de cobranças: de novo 4, 1 e 4" width="800" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Para o SQS, o teste passou: quatro mensagens, quatro invocações, zero erro. Para o negócio, o cliente foi cobrado quatro vezes.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que idempotência quis dizer aqui
&lt;/h2&gt;

&lt;p&gt;Caminho que eu usei:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;orderId&lt;/code&gt; (o pedido) → mensagem (&lt;code&gt;MessageId&lt;/code&gt;) → Lambda → efeito (&lt;code&gt;charge_applied&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;Idempotente: aplicar &lt;code&gt;ORDER-003&lt;/code&gt; uma vez ou dez vezes deixa &lt;strong&gt;uma&lt;/strong&gt; cobrança de 150.&lt;/p&gt;

&lt;p&gt;Não é "o SQS joga a segunda mensagem fora". O SQS pode (e neste lab, deve) entregar as dez. O destino é que recusa o segundo efeito.&lt;/p&gt;

&lt;h2&gt;
  
  
  Experimento 2: interruptor ligado, dez cópias
&lt;/h2&gt;

&lt;p&gt;O que eu fiz:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;destroy&lt;/code&gt; do lab antigo e &lt;code&gt;deploy&lt;/code&gt; de novo.&lt;/li&gt;
&lt;li&gt;Esperei a Lambda ficar ativa e o event source mapping em &lt;code&gt;Enabled&lt;/code&gt;, batch size 1.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.\set-idempotency.ps1 -Enabled 1&lt;/code&gt;. A variável da função ficou &lt;code&gt;IDEMPOTENCY=1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Mandei o mesmo pedido dez vezes:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;\send.ps1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-OrderId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ORDER-003&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Copies&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;10&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;O body impresso:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"orderId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"ORDER-003"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"customerId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"CUSTOMER-123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;150.00&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dez linhas. Dez &lt;code&gt;MessageId&lt;/code&gt; diferentes. &lt;code&gt;orderId=ORDER-003&lt;/code&gt; em todas.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbc0c3jxu1nk3yx1nzdt4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbc0c3jxu1nk3yx1nzdt4.png" alt="Terminal: dez SendMessage de ORDER-003, cada um com MessageId novo" width="799" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;O que observar: a fila não juntou nada. Dez recados. Um pedido.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Por que dez, e não duas: para forçar várias invocações no mesmo &lt;code&gt;orderId&lt;/code&gt; com a guarda ligada.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que o Insights mostrou nesse pedido
&lt;/h2&gt;

&lt;p&gt;Filtrei &lt;code&gt;orderId = "ORDER-003"&lt;/code&gt;. Vieram 20 correspondências, nestes tipos:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;process_start&lt;/code&gt;, &lt;code&gt;claim_lost&lt;/code&gt;, &lt;code&gt;skip_duplicate&lt;/code&gt;, &lt;code&gt;process_end&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffe4krhj5e0pn0l0nvk18.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffe4krhj5e0pn0l0nvk18.png" alt="Contagem só de ORDER-003: start, claim_lost, skip_duplicate, end. Vinte eventos." width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Leia assim: a mensagem chegou, tentou gravar a PK, perdeu, logou skip e encerrou. Sem nova cobrança nesse caminho.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A linha a linha é o mesmo filtro, evento por evento. Só &lt;code&gt;ORDER-003&lt;/code&gt;. &lt;code&gt;claim_lost&lt;/code&gt; e &lt;code&gt;skip_duplicate&lt;/code&gt; andam juntos. Os &lt;code&gt;MessageId&lt;/code&gt; mudam. O pedido não.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsvz40xyi7t9rt9qqu3m2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsvz40xyi7t9rt9qqu3m2.png" alt="Timeline ORDER-003: várias mensagens, o mesmo orderId, claim_lost e skip_duplicate" width="799" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  O que a tabela mostrou nesse pedido
&lt;/h2&gt;

&lt;p&gt;O &lt;code&gt;get-item&lt;/code&gt; de &lt;code&gt;ORDER-003&lt;/code&gt; devolveu &lt;strong&gt;um&lt;/strong&gt; item:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Campo&lt;/th&gt;
&lt;th&gt;Valor&lt;/th&gt;
&lt;th&gt;Por que importa&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;orderId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ORDER-003&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A chave do pedido&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;COMPLETED&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A reserva virou recibo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;messageId&lt;/code&gt; / &lt;code&gt;completedMessageId&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;73fca7ac-78e9-4ea4-a1bf-71a92e2fbda8&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;É o envio 1/10 daquela corrida&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claimedAt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2026-09-20T20:58:23.240Z&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Quando a primeira cópia ganhou o PutItem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;completedAt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2026-09-20T20:58:28.142Z&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cerca de 5 s depois. O worker espera 4 s (&lt;code&gt;WORK_MS=4000&lt;/code&gt;) e então marca completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;scan&lt;/td&gt;
&lt;td&gt;1 item&lt;/td&gt;
&lt;td&gt;Não nasceu um item por mensagem&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A fila aceitou dez &lt;code&gt;MessageId&lt;/code&gt;. O destino ficou com um &lt;code&gt;ORDER-003&lt;/code&gt; em &lt;code&gt;COMPLETED&lt;/code&gt;. As cópias no Insights perderam o claim e não cobraram.&lt;/p&gt;

&lt;h2&gt;
  
  
  Os prints do grupo inteiro (com a guarda já visível)
&lt;/h2&gt;

&lt;p&gt;No log group sem filtrar &lt;code&gt;orderId&lt;/code&gt;, numa janela em que os eventos de claim já existem:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;eventType&lt;/th&gt;
&lt;th&gt;n&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;process_end&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;charge_applied&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;skip_duplicate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claim_lost&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;process_start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;claim_won&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1a6r0ahcjn607ssa68ea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1a6r0ahcjn607ssa68ea.png" alt="Grupo inteiro: um claim_won, dois claim_lost, um skip_duplicate, cinco charge_applied" width="799" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Isso mostra a guarda em ação no grupo: alguém ganhou o claim, alguém perdeu, alguém pulou a cobrança.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A consulta de cobranças no grupo inteiro, recorte mais largo: 7 charges, 3 pedidos, 7 mensagens. São vários &lt;code&gt;orderId&lt;/code&gt; no mesmo log group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpr8wscebem4ma2syu5yk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpr8wscebem4ma2syu5yk.png" alt="Agregado do grupo: 7 charges, 3 pedidos, 7 mensagens" width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lado a lado
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Sem guarda&lt;/th&gt;
&lt;th&gt;Com guarda, pedido &lt;code&gt;ORDER-003&lt;/code&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;O que eu mandei&lt;/td&gt;
&lt;td&gt;várias mensagens do mesmo pedido&lt;/td&gt;
&lt;td&gt;10 &lt;code&gt;SendMessage&lt;/code&gt; com o mesmo &lt;code&gt;ORDER-003&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;O que a fila fez&lt;/td&gt;
&lt;td&gt;aceitou cada &lt;code&gt;MessageId&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;aceitou cada &lt;code&gt;MessageId&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;O que o Insights mostrou&lt;/td&gt;
&lt;td&gt;4 start, 4 charge, 4 end&lt;/td&gt;
&lt;td&gt;20 eventos de start / &lt;code&gt;claim_lost&lt;/code&gt; / &lt;code&gt;skip_duplicate&lt;/code&gt; / end&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;O que a tabela mostrou&lt;/td&gt;
&lt;td&gt;a guarda estava desligada&lt;/td&gt;
&lt;td&gt;um item &lt;code&gt;ORDER-003&lt;/code&gt; / &lt;code&gt;COMPLETED&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Efeito no caixa&lt;/td&gt;
&lt;td&gt;4 cobranças para 1 &lt;code&gt;orderId&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;um pedido reservado e concluído; as cópias visíveis não cobraram&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A fila fez o trabalho dela nas duas vezes. A diferença está no destino.&lt;/p&gt;

&lt;h2&gt;
  
  
  O que este lab não promete
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;SQS standard &lt;strong&gt;não&lt;/strong&gt; vira exactly-once porque você usou Lambda. Continua at-least-once.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;if (exists) return&lt;/code&gt; &lt;strong&gt;não&lt;/strong&gt; é a guarda. Duas leituras ao mesmo tempo furam isso.&lt;/li&gt;
&lt;li&gt;FIFO com &lt;code&gt;MessageDeduplicationId&lt;/code&gt; ajuda a não &lt;em&gt;enviar&lt;/em&gt; a mesma mensagem de novo por alguns minutos. Não substitui a tabela no destino quando &lt;strong&gt;você quer&lt;/strong&gt; enfileirar o mesmo pedido várias vezes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  O que eu levo
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;MessageId&lt;/code&gt; é a mensagem. &lt;code&gt;orderId&lt;/code&gt; é o pedido. A trava vai no pedido.&lt;/li&gt;
&lt;li&gt;Sem guarda, quatro mensagens do mesmo &lt;code&gt;orderId&lt;/code&gt; foram quatro &lt;code&gt;charge_applied&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A reserva é o &lt;code&gt;PutItem&lt;/code&gt; com &lt;code&gt;attribute_not_exists(orderId)&lt;/code&gt;. Quem perde loga &lt;code&gt;claim_lost&lt;/code&gt; e &lt;code&gt;skip_duplicate&lt;/code&gt; e não cobra.&lt;/li&gt;
&lt;li&gt;Idempotência neste desenho é: a fila pode entregar dez vezes; o caixa do pedido roda uma.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>aws</category>
      <category>sqs</category>
      <category>dynamodb</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
