<?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: Hugo Thomaz</title>
    <description>The latest articles on DEV Community by Hugo Thomaz (@hugothomaz).</description>
    <link>https://dev.to/hugothomaz</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F848024%2Fc66ddd02-d174-4fc4-ad6b-22a041befd3c.jpeg</url>
      <title>DEV Community: Hugo Thomaz</title>
      <link>https://dev.to/hugothomaz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hugothomaz"/>
    <language>en</language>
    <item>
      <title>Zonal autoshift: Automatically redirecting traffic in response to potential issues across Availability Zones</title>
      <dc:creator>Hugo Thomaz</dc:creator>
      <pubDate>Sun, 21 Jan 2024 20:40:18 +0000</pubDate>
      <link>https://dev.to/hugothomaz/zonal-autoshift-automatically-redirecting-traffic-in-response-to-potential-issues-across-availability-zones-ekl</link>
      <guid>https://dev.to/hugothomaz/zonal-autoshift-automatically-redirecting-traffic-in-response-to-potential-issues-across-availability-zones-ekl</guid>
      <description>&lt;p&gt;Hello everyone! 🤓&lt;/p&gt;

&lt;p&gt;Today, I've chosen to discuss one of the Networking &amp;amp; Content Delivery announcements from &lt;a href="https://aws.amazon.com/blogs/aws/top-announcements-of-aws-reinvent-2023/"&gt;AWS re:Invent 2023&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The new feature of the &lt;strong&gt;Amazon Route 53 Application Recovery Controller&lt;/strong&gt; allows AWS to shift our workloads from an Availability Zone when AWS identifies a potential failure affecting that Availability Zone, such as power, connectivity, network devices, and so on. It rarely happens, but it has already occurred, and it will happen. However, to avoid it, we should design and deploy our applications/services across multiple Availability Zones in a Region to ensure high availability.&lt;/p&gt;

&lt;p&gt;The old feature, "&lt;strong&gt;Zonal shift&lt;/strong&gt;," deployed before the new "&lt;strong&gt;Zonal autoshift&lt;/strong&gt;," allows us to shift our workload to a new Availability Zone manually when the error originates from our side (customer side). However, when there is a potential issue at the Availability Zone level, it's challenging to identify because we don't monitor these resources managed by AWS. Typically, we check the "AWS Health Dashboard" or rely on others sharing their complaints about the issue. Consequently, during this period, we probably waste some time, and the application is out of service.&lt;/p&gt;

&lt;p&gt;Now, with this release, you can configure Zonal autoshift to safeguard your workloads from potential failures in an Availability Zone. The AWS itself with their internal monitoring tools and metrics to determine when to initiate a network traffic shift. &lt;/p&gt;

&lt;p&gt;Both Zonal shift and Zonal autoshift features, they operates exclusively at the Application Load Balancer (ALB) or Network Load Balancer (NLB) level, but only when cross-zone load balancing is disabled.&lt;/p&gt;

&lt;p&gt;Ok, with these information let's see how to configure Zonal autoshift. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; We won't delve into the deployment of the Elastic Load Balancer, assuming familiarity on your part. Instead, let's concentrate on configuring the Zonal Autoshift settings.&lt;/p&gt;

&lt;p&gt;1 - Seearch "Route 53 Application Recovery Controller", and open it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2jkqp4dili7kofbsbxpx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2jkqp4dili7kofbsbxpx.png" alt="Image description" width="800" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2 - On the left pane, I select Zonal autoshift, and click in Configure zonal autoshift button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxl6kyqajdre6w2fl4rd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxl6kyqajdre6w2fl4rd.png" alt="Image description" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3 -  I've chosen the load balancer for my demo application. It's essential to note that currently, only load balancers with cross-zone load balancing turned off are eligible for zonal autoshift.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6keshcmc91pu4f798iw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6keshcmc91pu4f798iw.png" alt="Image description" width="800" height="717"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4 - To proceed with the settings, as you scroll down, you'll encounter the "Practice run blocked windows and dates" section, which is optional but crucial to configure. AWS typically tests the shift to another Availability Zone to ensure smooth application functioning in the event of an Availability Zone failure. Therefore, it's advisable to set the business hours during which you wouldn't want AWS to run this practice test, preventing any disruptions during peak business times. Additionally, you can block specific dates to avoid AWS conducting practice tests on public holidays, for example.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80a2qhaahonderteey1e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F80a2qhaahonderteey1e.png" alt="Image description" width="800" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5 - In the final section of the settings, it's needed to configure at least the initial CloudWatch alarm ARN, but I recommend you create a CloudWatch alarm for both. &lt;/p&gt;

&lt;p&gt;The primary purpose is to ensure that during a practice test, if the alarm doesn't transition into the ALARM state (down), AWS will consider it successful. Consequently, creating an alarm to monitor the health of the application or service is essential for this certification.&lt;/p&gt;

&lt;p&gt;The second field, this alarm serves as a safeguard, preventing AWS from conducting the practice test if the specified alarm state is down. For instance, in exceptional scenarios, during business hours, your EC2 instance running the application might experience high CPU utilization due to increased customer access. To circumvent the inadvertent initiation of the Practice test during such atypical events, you can create an alarm to monitor and prevent the test accordingly.&lt;/p&gt;

&lt;p&gt;Subsequently, tick the box to authorize AWS to shift our workloads from one Availability Zone to another when a failure at the Availability Zone level is identified.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx9ka4369q7vexdoipa6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkx9ka4369q7vexdoipa6.png" alt="Image description" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, I hope you liked it, I'd like to talk about this service, and also how we setup it. We can effectively deploy this solution to enhance our infrastructure. I trust that you found this discussion enjoyable.&lt;/p&gt;

&lt;p&gt;Reference Link:&lt;br&gt;
&lt;a href="https://aws.amazon.com/blogs/aws/top-announcements-of-aws-reinvent-2023/"&gt;https://aws.amazon.com/blogs/aws/top-announcements-of-aws-reinvent-2023/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/blogs/aws/zonal-autoshift-automatically-shift-your-traffic-away-from-availability-zones-when-we-detect-potential-issues/"&gt;https://aws.amazon.com/blogs/aws/zonal-autoshift-automatically-shift-your-traffic-away-from-availability-zones-when-we-detect-potential-issues/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>route53</category>
      <category>network</category>
      <category>cloud</category>
      <category>aws</category>
    </item>
    <item>
      <title>Connecting Your On-Premise Cisco Router to AWS Cloud Through a Site-to-Site VPN</title>
      <dc:creator>Hugo Thomaz</dc:creator>
      <pubDate>Mon, 28 Aug 2023 00:34:23 +0000</pubDate>
      <link>https://dev.to/hugothomaz/connecting-your-on-premise-cisco-router-to-aws-cloud-through-a-site-to-site-vpn-2ga1</link>
      <guid>https://dev.to/hugothomaz/connecting-your-on-premise-cisco-router-to-aws-cloud-through-a-site-to-site-vpn-2ga1</guid>
      <description>&lt;p&gt;Hello everyone! 🤓&lt;/p&gt;

&lt;p&gt;As the Cloud grows, we Network Engineers need to create a connection between our On-Premises Data Center (DC) and the Cloud environment. There are many options to establish a connection between them,but now let's focus in create an AWS Site-to-Site VPN with a Cisco Router, and with BGP routing protocol enabled to exchange the network prefixes.&lt;/p&gt;

&lt;p&gt;As I don't have a on-premise DC environment available, then we are going to simulate our DC inside of the AWS cloud, and our edge device on the DC side will be a Cisco CSR 1000V with IOS XE system. So if you need to create a Site-to-Site VPN between AWS cloud and your DC using a Cisco Router this post it's for you. &lt;/p&gt;

&lt;p&gt;The diagram below show our proposal scenario, where on the left side we have the AWS environment with a VPC, private subnet, EC2 instance to test the connectivity, a Transit Gateway (TGW) to concentrate the connections with our VPC and site-to-site VPN. On the right side, we are going to simulate Corporate DC, as said before. As Customer Gateway or Egde device, we will use a Cisco CSR 1000V, and it will have an interface on the public subnet, which it's nedded to attach public IP address on it, and an interface on the Private subnet. This private subnet will simulate our internal network to allocate our internal services.&lt;/p&gt;

&lt;p&gt;Proposed topology:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q0rnmn7I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgiv5wede78ej3nea62q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q0rnmn7I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgiv5wede78ej3nea62q.jpg" alt="Image description" width="800" height="336"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; I assume you know how to create the &lt;u&gt;EC2 instance&lt;/u&gt;, &lt;u&gt;VPC&lt;/u&gt;, &lt;u&gt;subnets&lt;/u&gt;, &lt;u&gt;SG&lt;/u&gt;, r&lt;u&gt;oute tables&lt;/u&gt;, &lt;u&gt;Transit Gateway&lt;/u&gt;, ... so this post will only concentrate in deploying the site-to-site VPN on the AWS and also the settings needed on the Cisco router to come up the tunnels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment steps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; - Create the customer gateway on the AWS side;&lt;br&gt;
&lt;strong&gt;2&lt;/strong&gt; - Create a Site-to-Site VPN on the AWS side;&lt;br&gt;
&lt;strong&gt;3&lt;/strong&gt; - Check the Transit Gateway Attachment created on the Site-to-Site VPN  deployment;&lt;br&gt;
&lt;strong&gt;4&lt;/strong&gt; - Create a Transit Gateway Route table for the Site-to-Site VPN;&lt;br&gt;
&lt;strong&gt;5&lt;/strong&gt; - Setup the Site-to-Site VPN on the Cisco Router;&lt;br&gt;
&lt;strong&gt;6&lt;/strong&gt; - Setup the BGP protocol on the Cisco Router;&lt;br&gt;
&lt;strong&gt;7&lt;/strong&gt; - Check the routes learned on the AWS and Cisco router side;&lt;br&gt;
&lt;strong&gt;8&lt;/strong&gt; - Test connectivity.&lt;/p&gt;

&lt;p&gt;Those are the steps to deploy a site-to-site VPN as per the proposal scenario, so let's get start! 🙂&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Create the customer gateway on the AWS side&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our customer gateway is the Cisco CSR 1000V on the on-premises network. As all site-to-site VPN deployment, we need to know the Peer address of device that I would like to establish a VPN connection, then with this Public IP address, and also the BGP AS number - once we will use the BGP Routing protocol - in our hands, we can be able create the customer gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Customer Gateway IP address:&lt;/strong&gt; 3.132.131.135&lt;br&gt;
&lt;strong&gt;BGP AS number:&lt;/strong&gt; 65000&lt;/p&gt;

&lt;p&gt;Now, let 's go to the VPC dashboard, and on the Virtual private network (VPN) session, clink on the "Customer gateways". For create the Customer gateways, click on the Create customer gateway button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ma81iEzq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6iigoeo5yvn84losr7c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ma81iEzq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6iigoeo5yvn84losr7c.png" alt="Image description" width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define the name, Peer address and AS number as per the customer information, and at the end click on the Create customer gateway button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v8ei9ZUp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dau5ygd9ddopiekiqyxa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v8ei9ZUp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dau5ygd9ddopiekiqyxa.png" alt="Image description" width="800" height="591"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DkaM8MjR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kj9zd5ks0s4rwraonfwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DkaM8MjR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kj9zd5ks0s4rwraonfwb.png" alt="Image description" width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay, once it's created, let's move on to the next step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - Create a Site-to-Site VPN on the AWS side&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the VPC dashboard, and on the Virtual private network (VPN) session, clink on the "Site-to-Site VPN connections". For create a site-to-site VPN click on the Create VPN connection button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sUyKj6t8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvssldytvtjidjcdv7fk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sUyKj6t8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvssldytvtjidjcdv7fk.png" alt="Image description" width="800" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define the name, choose the Transit Gateway, and Customer gateway created on the before step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LpQ8kZ40--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ceokaye5malbhe5g9ayu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LpQ8kZ40--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ceokaye5malbhe5g9ayu.png" alt="Image description" width="800" height="706"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define BGP Route as routing protocol, protocol IPv4 address, there is more these other option to improve the VPN performance, and which networks will be allowed over VPN tunnels, but now as it's example, let's keep the option as default, but it's important to enable and define the settings for the production connections to improve the connection performance and retrict the networks allowed inside of the tunnels.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0rCpNJ9i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fcdqi51beodzcp96evjm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0rCpNJ9i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fcdqi51beodzcp96evjm.png" alt="Image description" width="762" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the Tunnel 1 and Tunnel 2 options you can define the phases 1 and 2 settings like encryption, integrity, Diffie-Hellman group, IKE Version, lifetime, and a lot of stardand settings related to the IPSEC VPN, but now let's keep these options as default settings, and click on the Create VPN connection button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MXZGrMr5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfivmsqvfonxfxlfnwqw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MXZGrMr5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yfivmsqvfonxfxlfnwqw.png" alt="Image description" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After some minutes the VPN connections move from pending to available status, but the Tunnels will still as down on the tunnels tab because we don't setup the VPN on the Router CSR1000V side.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zJVh_7aq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aerfi8cpfou4nqst53at.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zJVh_7aq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aerfi8cpfou4nqst53at.png" alt="Image description" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For helping us on the router settings on the DC side, we download the configuration as you can see below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PaV-tkym--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/365d7kxqy4wba8tj2ztn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PaV-tkym--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/365d7kxqy4wba8tj2ztn.png" alt="Image description" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are a lot of the Vendor to choose, but now let's select generic device and choose the IKE version. In this case I defined the "ikev2" (safer than ikve1), and download the settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ainA922n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9vqetrd0yrcgzoef3agb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ainA922n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9vqetrd0yrcgzoef3agb.png" alt="Image description" width="603" height="565"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For assuranced the high available with the same Peer, the  AWS create two tunnels for each VPN connection, then with this file you will see the informations about each tunnel as Pre-shared Key, Authentication, Encryption, Lifetime, DH, and other information about the VPN settings.&lt;/p&gt;

&lt;p&gt;But before move to deploy router settings on the onpremise DC side, let's check other settings on the AWS side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - Check the Transit Gateway Attachment created on the Site-to-Site VPN deployment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the VPC dashboard, and on the Transit gateways session, clink on the Transit gateway attachments (TGW attachements). With the VPN ID realted the VPN connection created, you can filter the TGW attachement assigined to the VPN connection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1X701QL8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/djprlznozrwxzzhc3vbx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1X701QL8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/djprlznozrwxzzhc3vbx.png" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4 - Create a Transit Gateway Route table for the Site-to-Site VPN&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the VPC dashboard, and on the Transit gateways session, clink on the Transit gateway route tables (TGW route table). Let's create a TGW route table and assigned to the TGW attachement checked on the before step. Click on the Create transit gateway route table button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BT4O7ju4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9t1h535jrzncghc4r52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BT4O7ju4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9t1h535jrzncghc4r52.png" alt="Image description" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a name, and assigned to the Transit Gateway.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LugEifUD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qumrgmmrfhil32zi2men.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LugEifUD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qumrgmmrfhil32zi2men.png" alt="Image description" width="800" height="690"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After created it, let's assign the TGW attchement to this TGW route table. Filter the TGW route table, select it, click on the associations tab, and click on the create association button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bM5806dQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygwm83pia7u9xsjepfg5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bM5806dQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygwm83pia7u9xsjepfg5.png" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the TGW attachment to the VPN connection created and click on the create button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7AMJ1X2A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k09vdi46n07zc5xyhq2p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7AMJ1X2A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k09vdi46n07zc5xyhq2p.png" alt="Image description" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, on the Propagations tab, let's propagate the routes related to the our internal VPC (10.100.0.0/16), and the customer routes learned by BGP routing protocol. So, let's assigned to the TGW attachement realted to the VPN and also the VPC application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--witBpWob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mr1sho2jwhco3a2beze0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--witBpWob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mr1sho2jwhco3a2beze0.png" alt="Image description" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;VPN TGW attachment:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pye9TQ85--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wgpn2vur06ph8453lbq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pye9TQ85--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3wgpn2vur06ph8453lbq.png" alt="Image description" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;VPC application TGW attachment:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rcf2x3G1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iloxnuez6dqjghtcjzb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rcf2x3G1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iloxnuez6dqjghtcjzb9.png" alt="Image description" width="800" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TGW attachements assigned to the VPN TGW route table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--omkzdxW8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90h1kcbs411fei00k2qh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--omkzdxW8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90h1kcbs411fei00k2qh.png" alt="Image description" width="800" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's to move the settings on the cisco router side on the On-premise DC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5 - Setup the Site-to-Site VPN on the Cisco Router&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Note:&lt;/u&gt; On the this part, let's focus on the IPSEC VPN on the Cisco router side, but the idea here it's not to detail each command.&lt;/p&gt;

&lt;p&gt;Let's specify pre-shared key for each Peer of the AWS side. The IKEv2 keyring specifies the pre-shared keys used for IKEv2 negotiation.&lt;/p&gt;

&lt;p&gt;Let's check the settings on the File downloaded on the Step #2.&lt;/p&gt;

&lt;p&gt;Peer address and Pre-shared Key related to the tunnel #1:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bblc635F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvwcvs0wnk1zw7m809e1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bblc635F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvwcvs0wnk1zw7m809e1.png" alt="Image description" width="800" height="231"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--crSzgehR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rdmkl1mdtxeclmhileuz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--crSzgehR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rdmkl1mdtxeclmhileuz.png" alt="Image description" width="676" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pre-shared Key related to the tunnel #2:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fOiN0Mcj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2kpareje5genrc784ti8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fOiN0Mcj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2kpareje5genrc784ti8.png" alt="Image description" width="800" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JQVY2DBl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/au21wltfkq0umu76v57o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JQVY2DBl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/au21wltfkq0umu76v57o.png" alt="Image description" width="656" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Based on these informations, let set these informations on the configuration mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!
crypto ikev2 keyring AWS-KEYRING
 # Tunnel 1
 peer vpn-aws-x-dc-tunnel1
  address 3.223.8.46
  pre-shared-key cN5zi29A3lJ_lqLUsOYiEkXFeypiW3F8
 !
 # Tunnel 2
 peer vpn-aws-x-dc-tunnel2
  address 34.236.4.200
  pre-shared-key GFfKIgr6LGmJlOR5bGCUAQq8pvEFHQ3q
 !
!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's create the IKEv2 profile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!
crypto ikev2 profile AWS-US-EAST2-PROFILE
 match address local interface GigabitEthernet1
 match identity remote address 3.223.8.46 255.255.255.255 
 match identity remote address 34.236.4.200 255.255.255.255 
 authentication remote pre-share
 authentication local pre-share
 keyring local AWS-KEYRING
 lifetime 28800
 dpd 30 5 periodic
 exit
!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: Replace the "gigabitEthernet1" for your external interface.&lt;/p&gt;

&lt;p&gt;Now, let's specify security policy for traffic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!
crypto ipsec transform-set AWS-TS esp-aes esp-sha256-hmac 
 mode tunnel
exit
!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the The IPSec crypto profile that it is invoked in IKE Phase 2.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!
crypto ipsec profile AWS-VTI
 set transform-set AWS-TS 
 set pfs group20
 set ikev2-profile AWS-US-EAST2-PROFILE
!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define the Interface tunnels:&lt;/p&gt;

&lt;p&gt;Go back to thefile downloaded on the Step #2, and let's see the Inside IP Addresses related to the tunnel #1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--USpq5qSX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2r0xh652v605hz8zbs3c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--USpq5qSX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2r0xh652v605hz8zbs3c.png" alt="Image description" width="527" height="76"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's see the Inside IP Addresses related to the tunnel #2&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mGbIfcNk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh4cbd4mune95i0831f2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mGbIfcNk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vh4cbd4mune95i0831f2.png" alt="Image description" width="520" height="70"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!
interface Tunnel30
 description AWS-US-EAST2-Tunnel1
 ip address 169.254.29.170 255.255.255.252
 ip mtu 1400
 ip tcp adjust-mss 1350
 keepalive 10 6
 tunnel source GigabitEthernet1
 tunnel mode ipsec ipv4
 tunnel destination 3.223.8.46
 tunnel protection ipsec profile AWS-VTI
 no shut
!
!
interface Tunnel40
 description AWS-US-EAST2-Tunnel2
 ip address 169.254.254.222 255.255.255.252
 ip mtu 1400
 ip tcp adjust-mss 1350
 keepalive 10 6
 tunnel source GigabitEthernet1
 tunnel mode ipsec ipv4
 tunnel destination 34.236.4.200
 tunnel protection ipsec profile AWS-VTI
 no shut
!
!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Afer that, we can see the interfaces tunnels up, and IPSeC VPN up as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eMLjH6vb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15c7gs7d004dzfktb399.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eMLjH6vb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15c7gs7d004dzfktb399.png" alt="Image description" width="740" height="79"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P9iou95V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2noziin7vhnm12kuwr5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P9iou95V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2noziin7vhnm12kuwr5.png" alt="Image description" width="800" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NQFgWhMx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/luznhrfxhhviewq7lftr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NQFgWhMx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/luznhrfxhhviewq7lftr.png" alt="Image description" width="800" height="737"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bJP4POE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8bpdw758qhq6aaf52a9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bJP4POE_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8bpdw758qhq6aaf52a9.png" alt="Image description" width="800" height="772"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6 - Setup the BGP protocol on the Cisco Router&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once VPC tunnels UP, we can run these command below to establish the BGP neighbors with both tunnels.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!
router bgp 65000
  bgp log-neighbor-changes
  bgp graceful-restart
  address-family ipv4 unicast
    !#Tunnel 1
    neighbor 169.254.29.169 remote-as 64512
    neighbor 169.254.29.169 ebgp-multihop 255
    neighbor 169.254.29.169 activate
    !
    !#Tunnel 2
    neighbor 169.254.254.221 remote-as 64512
    neighbor 169.254.254.221 ebgp-multihop 255
    neighbor 169.254.254.221 activate
    !
    network 10.200.50.0 mask 255.255.255.0
    network 10.200.1.0 mask 255.255.255.0
    no auto-summary
    no synchronization
  exit-address-family
 exit
!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;7 - Check the routes learned on the AWS and Cisco router side&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And after that, we can see the neighbor establish and the router 10.100.0.0/16 route learned via BGP protocol.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2Q1K8vri--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m77ngdkl9ibzp06rqfda.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2Q1K8vri--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m77ngdkl9ibzp06rqfda.png" alt="Image description" width="800" height="726"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also check the status on the AWS side.&lt;/p&gt;

&lt;p&gt;VPN tunnels and BGP running&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wndnOKra--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyqccdifszc38uzsgsqs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wndnOKra--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyqccdifszc38uzsgsqs.png" alt="Image description" width="800" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and also see the route on the TGW route table assigned to the VPN connection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T9JSnB35--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w8cf4213kgvnknw5xybk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T9JSnB35--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w8cf4213kgvnknw5xybk.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8 - Test connectivity.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As the VPN tunnels are UP, and the routes were learned we can test the connectivity.&lt;/p&gt;

&lt;p&gt;From a EC2 instance on the AWS side, which belong to the 10.100.1.0/24 network range, to the VM on the DC side which belong to the 10.200.1.0/24 network range. As you can see below on the screenshot the connection was established.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iHQI1I41--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6fb166phjvf0m0mswgjv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iHQI1I41--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6fb166phjvf0m0mswgjv.png" alt="Image description" width="631" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you liked the procedure, and If you have any issue, please, let me know.&lt;/p&gt;

</description>
      <category>vpn</category>
      <category>transitgateway</category>
      <category>csr1000v</category>
      <category>network</category>
    </item>
    <item>
      <title>Deploying an Interface VPC Endpoint</title>
      <dc:creator>Hugo Thomaz</dc:creator>
      <pubDate>Mon, 19 Jun 2023 00:25:34 +0000</pubDate>
      <link>https://dev.to/hugothomaz/deploying-an-interface-vpc-endpoint-15e3</link>
      <guid>https://dev.to/hugothomaz/deploying-an-interface-vpc-endpoint-15e3</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;In this post, we will discuss about the interface VPC Endpoint, and how it permit to access AWS services from the private subnet without Internet access. Additionally, I will guide you on deploying this resource using the AWS Console and provide the Terraform code from my &lt;a href="https://github.com/hugothomazpsouza/terraform_study/tree/main/vpc-endpoint-sqs-interface"&gt;GitLab repository&lt;/a&gt; for deploying the proposed topology.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Interface VPC endpoints permit us to access specific AWS Cloud Services without the need to NAT Gateway, Internet Gateway, VPN, or a Direct Connect connection. As opposed to Gateway VPC endpoints that use the route table and a prefix list, as you've already talked about it on this &lt;a href="https://dev.to/hugothomaz/deploying-the-vpc-endpoint-gateway-for-amazon-s3-3bmj"&gt;link&lt;/a&gt;, interface endpoints create a Elastic Network Interface (ENI) in your subnet, so when you need to access an AWS Services from a private subnet you call it through an internal IP address or DNS created by own interface endpoint. This simplifies the routing and allows for more flexibility.&lt;/p&gt;

&lt;p&gt;Follow some AWS services supported by interfaces endpoints:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DpWVVU1N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8yceon388dwz3o8l45zc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DpWVVU1N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8yceon388dwz3o8l45zc.jpg" alt="Image description" width="492" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Objective:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After introduction about the Interface VPC endpoint, and some importants points that highlights its importance, let's move to our example scenario to learn in the practice. Now, we are going to create an interface VPC endpoint to access the AWS SQS Queue service through the endpoint, and also send a message from our private EC2 instance to SQS queue created for testing the connectivity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Scenario proposed:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5gY-aMzY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3f30ziyyvxc9l6vk0n8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5gY-aMzY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3f30ziyyvxc9l6vk0n8i.png" alt="Image description" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/strong&gt; I assume you know how to create the VPC, subnets, SG, route tables, so this post will only focus on deploying the resources to create the Gateway endpoint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment steps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Creating the Policy to allow send messages for the SQS Queue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In IAM dashboard, click on Policies, and then click create policy button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sacqHpnh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zrkpxmg256wa9kbhp75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sacqHpnh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zrkpxmg256wa9kbhp75.png" alt="Image description" width="800" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on JSON button, paste the policy and click in Next at the bottom of the page&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kHHCxmIY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgccy5hgkonpo4slk16x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kHHCxmIY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgccy5hgkonpo4slk16x.png" alt="Image description" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Json policy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "sqs:SendMessage"
            ],
            "Effect": "Allow",
            "Resource": "*"
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define a name, description, check the access level, and click on the create policy button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ms8lR0nV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh7ktbszpgmfelqc82oz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ms8lR0nV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh7ktbszpgmfelqc82oz.png" alt="Image description" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Policy created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V-AbRZIm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yedb2uauif12zovpk4wk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V-AbRZIm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yedb2uauif12zovpk4wk.png" alt="Image description" width="678" height="115"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - Creating the Role, and assiging the policy created to it&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the IAM dashboard, click in Roles, and then create role button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jsACToUS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ut6487ztgp191e4zvujc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jsACToUS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ut6487ztgp191e4zvujc.png" alt="Image description" width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select AWS service once that we will connect to the AWS SQS Queue service, and EC2 because this IAM Role will be used by EC2 Instaces to call AWS service. After select them, click in the next button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U9-baqBe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tz9y7kv9yizzwnqdwj17.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U9-baqBe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tz9y7kv9yizzwnqdwj17.png" alt="Image description" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find the the policy name created on the step before, select it, and next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UcQ_sj3d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tp8wrxuz6c6p4dwsik85.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UcQ_sj3d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tp8wrxuz6c6p4dwsik85.png" alt="Image description" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a name, description, check the policy and click in create role&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--alLPk_Mc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hxwdppuf5c17p5ow4mwk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--alLPk_Mc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hxwdppuf5c17p5ow4mwk.png" alt="Image description" width="800" height="519"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7YCfo0RK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d80o0hgzgxf2z3e8dq2p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7YCfo0RK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d80o0hgzgxf2z3e8dq2p.png" alt="Image description" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;IAM Role created:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x7FYypRH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c53gm8wqzljflrl6eunm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x7FYypRH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c53gm8wqzljflrl6eunm.png" alt="Image description" width="714" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - Assigning the IAM Role created to the private EC2 instance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the EC2 Instance dashboard, select the Private EC2 Instance, Action, Security and Modify IAM Role&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CjmWPTe2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fep3tiht9ad0ey39zrme.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CjmWPTe2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fep3tiht9ad0ey39zrme.png" alt="Image description" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find the IAM Role created, select it and update IAM Role&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x3gCS7vH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/twmkefa24mhihtwlqzyc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x3gCS7vH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/twmkefa24mhihtwlqzyc.png" alt="Image description" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - Creating the simple SQS Queue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Search for "sqs", and then click on the "Simple Queue Service"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mop6Z7H0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lv6ta09ykp6mrozgqj6y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mop6Z7H0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lv6ta09ykp6mrozgqj6y.png" alt="Image description" width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the Create queue button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_NwoOWIc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hdcfillrhp10m6cq4k5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_NwoOWIc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hdcfillrhp10m6cq4k5.png" alt="Image description" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the Standard queue, and define a name&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---4ta_HyZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2jh8iuetavs6zy0437x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---4ta_HyZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2jh8iuetavs6zy0437x.png" alt="Image description" width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the Access Policy, select advanced mode, change the action from "SQS:*" to "SQS:SendMessage" what it will only permit to send message and let the SQS queue more safe, and then click on the create queue at the bottom of the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R7U_s1aM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lfufa1wjf1uo6h437jr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R7U_s1aM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lfufa1wjf1uo6h437jr.png" alt="Image description" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CUb82Bji--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yicas1e90pg33wx4ah2t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CUb82Bji--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yicas1e90pg33wx4ah2t.png" alt="Image description" width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SQS Queue created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gnu8u52A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8sdq14ywwzeihkq0ny4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gnu8u52A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8sdq14ywwzeihkq0ny4p.png" alt="Image description" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4 - Creating the Interface VPC Endpoint for accessing the SQS Queue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In VPC dashboard, select Endpoint, and click in create endpoint button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q9aYdpfp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gm4vmbay2twua09jez16.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q9aYdpfp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gm4vmbay2twua09jez16.png" alt="Image description" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a name, select AWS service, select &lt;strong&gt;com.amazonaws.us-east-1.sq&lt;/strong&gt;s (type Interface), select the VPC, private subnet where the VPC endpoint will created a ENI, and select a Security Group with HTTPS traffic allowed to all Private subnet CIDR block.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e7QiT3Xk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wq596sl0cgguwprmo197.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e7QiT3Xk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wq596sl0cgguwprmo197.png" alt="Image description" width="790" height="884"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MFnUQf1T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i66ezg02w8gdx9czelc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MFnUQf1T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i66ezg02w8gdx9czelc.png" alt="Image description" width="800" height="820"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the end of the page click on the create endpoint button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fN5Yv4TI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3u1rxalybh7zswt0lkey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fN5Yv4TI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3u1rxalybh7zswt0lkey.png" alt="Image description" width="768" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Interface VPC endpoint created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nn0R10lD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ibcericy02xrdsy5aofm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nn0R10lD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ibcericy02xrdsy5aofm.png" alt="Image description" width="800" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5 - Check the connectivity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After some minutes, Interface VPC endpoint will be came available, so let's test the connectivity.&lt;/p&gt;

&lt;p&gt;Accessing the Linux bastion host. I'm using my Key to access the Instances, but you should your own key.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l71O6d9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7r1b6iwjn8dsgumwwvy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l71O6d9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7r1b6iwjn8dsgumwwvy.png" alt="Image description" width="628" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Accessing the Private EC2 instance from the Bastion host&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XoJHfAh6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wfzpin0mslts0nhwuprh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XoJHfAh6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wfzpin0mslts0nhwuprh.png" alt="Image description" width="579" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now before send the message to the SQS Queue, let's validate some importants information. &lt;/p&gt;

&lt;p&gt;On the VPC endpoint, the endpoint has a DNS name and it was assigned to a private subnet where an ENI as you can see below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4TAB7OAl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehxapkj66jg0qombwh8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4TAB7OAl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehxapkj66jg0qombwh8y.png" alt="Image description" width="800" height="412"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; it's important to note that it was created many DNS records. the first one it's recommended to use when the source live in different Availability Zone of the VPC endpoint, but live at the same region. The second one it's recommended to use when the source live on the same Availability Zone of the VPC endpoint, and there is also the Private DNS names.&lt;/p&gt;

&lt;p&gt;ENI assigned to the endpoint has an IP address what it belong to the private subnet what it's correct&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1h3Z4B_B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hodtpjnjt0l0lki7uib4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1h3Z4B_B--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hodtpjnjt0l0lki7uib4.png" alt="Image description" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also the SQS Queue service created a DNS name too as you can see below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SgdJwoIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/475r48r94pg5qox32d5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SgdJwoIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/475r48r94pg5qox32d5n.png" alt="Image description" width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now with these information in our hands, let's test the connectivity and send a message to the SQS Queue from private EC2 instance.&lt;/p&gt;

&lt;p&gt;Example command to send a message to the SQS Queue, please, replacing the AWS Account ID and SQS Queue name at the URL (&lt;a href="https://docs.aws.amazon.com/cli/latest/reference/sqs/send-message.html"&gt;Documentation link&lt;/a&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws sqs send-message --region us-east-1 --endpoint-url https://sqs.us-east-1.amazonaws.com/ --queue-url https://sqs.us-east-1.amazonaws.com/&amp;lt;AWS_ACCOUNT_ID&amp;gt;/&amp;lt;SQS_QUEUE_NAME&amp;gt; --message-body "Hello SQS, this is test send message."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h8GH2903--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuuw193l27rh71qnq0nc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h8GH2903--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuuw193l27rh71qnq0nc.png" alt="Image description" width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, I ran a nslookup to see if the DNS resolution was working fine, and it correct. It showed that the DNS resolution is translating to the IP address assigned to the the Interface VPC Endpoint. And after this test, it was be able to send a message to SQS Queue.&lt;/p&gt;

&lt;p&gt;From SQS Queue dashboard we can validate if the message was arrived on the queue. Go to the SQS Queue dashboard,click on the "Send and receive messages" button, and then "Poll for messages". &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FACiRilH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cd4h1cj6rqr1z1wbwpvl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FACiRilH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cd4h1cj6rqr1z1wbwpvl.png" alt="Image description" width="800" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xKqJma_w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wo7e1x8q723or6b17con.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xKqJma_w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wo7e1x8q723or6b17con.png" alt="Image description" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After poll, you will see a message, and if you click on it you will see the message that it was used on the AWS CLI command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fe6dDqup--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b458vfiups5v5gqivbcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fe6dDqup--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b458vfiups5v5gqivbcz.png" alt="Image description" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--unh8r5fN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7jrnvust41jgw6yza6uk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--unh8r5fN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7jrnvust41jgw6yza6uk.png" alt="Image description" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After this validation we concluded our test.&lt;/p&gt;

&lt;p&gt;If you would like to deploy this env via Terraform code as the purposed topology, so feel free to access my &lt;a href="https://github.com/hugothomazpsouza/terraform_study/tree/main/vpc-endpoint-sqs-interface"&gt;Gitlab repository&lt;/a&gt; to clone and deploy it. Before deploy via Terraform, replace the profile in provider.tf file and replace your Key_name at the EC2 instace code as per your own settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, we have discussed about the interface VPC Endpoint, and also we saw an example to deploy an endpoint. We can effectively deploy this solution to enhance our infrastructure. I trust that you found this discussion enjoyable.&lt;/p&gt;

&lt;p&gt;Reference Link:&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html"&gt;https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/cli/latest/reference/sqs/send-message.html"&gt;https://docs.aws.amazon.com/cli/latest/reference/sqs/send-message.html&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Deploying the VPC Endpoint - Gateway for Amazon S3</title>
      <dc:creator>Hugo Thomaz</dc:creator>
      <pubDate>Thu, 08 Jun 2023 19:48:41 +0000</pubDate>
      <link>https://dev.to/hugothomaz/deploying-the-vpc-endpoint-gateway-for-amazon-s3-3bmj</link>
      <guid>https://dev.to/hugothomaz/deploying-the-vpc-endpoint-gateway-for-amazon-s3-3bmj</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;In this post, we will discuss the VPC Endpoint - Gateway for Amazon S3, along with various scenarios that highlight its importance. Additionally, I will guide you on deploying this resource using the AWS Console and provide the Terraform code from my &lt;a href="https://github.com/hugothomazpsouza/terraform_study/tree/main/vpc-endpoint-gateway"&gt;GitLab repository&lt;/a&gt; for deploying the proposed topology.&lt;/p&gt;

&lt;p&gt;This EC2 instance is running inside of a Public subnet, and there are some data stored in S3 bucket. Let's say that the EC2 instance needs to upload and download some data stored in S3 bucket, so basically the EC2 instance would make an API call, and then it will access the data over the public internet through the Internet Gateway (IGW). It's obvious architecture, and it works perfectly there is no problem at all.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4SO0T7Hn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx8z6c0ynxu489q70uxu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4SO0T7Hn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx8z6c0ynxu489q70uxu.jpg" alt="Image description" width="642" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's move on to an other scenario, where there is a similar architecture, but now the EC2 instance redise inside of the Private subnet. Now what happens? The EC2 instance needs to upload and download data in S3 bucket. We have learned on the old scenario that the EC2 instance needs to access the internet to upload/download the datas, but now as this EC2 instance reside into a private subnet, how will it be able to access the S3 bucket? So, that's why exist a resource called NAT Gateway. We would add a NAT Gateway in a public subnet, modify the private route table, and then the traffic will go to the S3 bucket over the public internet. Now the EC2 instance will be able to access the S3. So this works perfectly too. There is no problem with that too.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g-yXwHrX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ad03kqfrqre5nggwff2n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g-yXwHrX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ad03kqfrqre5nggwff2n.jpg" alt="Image description" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yeah, probally you are asking yourself, why do I need to use VPC endpoint services? If you noticed, there is one thing in commun on this both scanarios. In both scanarios, the EC2 instance need to reach out the S3 bucket over the public internet, but what AWS says, if all the services are into the same region, as your VPC, including S3 service that we saw, there is a better way to access these services and that better way is called VPC endpoint services.&lt;/p&gt;

&lt;p&gt;So what are VPC endpoints, endpoints allow you to connect to AWS services, using a private network instead of going for a public network. Then, we won't need to use the IGW or NAT Gateway to reach the S3 bucket, which it's good because we can save money, for example, NAT Gateway charge per hour running as well as data flow, our traffic wouldn't go out over public internet that it's not safe like a private network, and other benefits.&lt;/p&gt;

&lt;p&gt;There are two types of the VPC endpoint, Gateway and Interface endpoint, but now, let`s focus on the Gateway endpoint.&lt;/p&gt;

&lt;p&gt;Now we are going to see how we can deploy a Gateway endpoint to permit the private EC2 instance (ec2_app_web) inside of the Private subnet without Internet access can reach the S3 bucket through Gateway Endpoint. As the private EC2 instance is not reachable through the internet we are going to create a Linux Bastion Host (linux_bastion_host) to access the private EC2 instance, and then test the connectivity with S3 bucket, as we can see on the digram below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6Cvbm7xE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6bbgxlcw26scjz6ryj3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6Cvbm7xE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6bbgxlcw26scjz6ryj3.jpg" alt="Image description" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I assume you know how to create the VPC, subnets, SG, route tables, so this post will only focus on deploying the resources to create the Gateway endpoint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deployment steps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Creating the Policy to permit List, Get and Put data into the S3 bucket.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In IAM dashboard, click on Policies, and then click policy button&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qd_iFLL8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iktcjklgsokybxlt5d2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qd_iFLL8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iktcjklgsokybxlt5d2f.png" alt="Image description" width="800" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on JSON button, paste the policy and click in Next&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y0LnhqED--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hjxppqpzw86yzv8kz1kp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y0LnhqED--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hjxppqpzw86yzv8kz1kp.png" alt="Image description" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Policy:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    "Version": "2012-10-17",&lt;br&gt;
    "Statement": [&lt;br&gt;
        {&lt;br&gt;
            "Sid": "Statement1",&lt;br&gt;
            "Effect": "Allow",&lt;br&gt;
            "Action": [&lt;br&gt;
                "s3:Get*",&lt;br&gt;
                "s3:List*",&lt;br&gt;
                "s3:Put*",&lt;br&gt;
                "s3-object-lambda:Get*",&lt;br&gt;
                "s3-object-lambda:List*",&lt;br&gt;
                "s3-object-lambda:Put*"&lt;br&gt;
             ],&lt;br&gt;
            "Resource": "*"&lt;br&gt;
        }&lt;br&gt;
    ]&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Define a name, check the access level, and click on the create policy button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RJ7lfiOH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gfyu0akigcik2mlbuv6e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RJ7lfiOH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gfyu0akigcik2mlbuv6e.png" alt="Image description" width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QruU4RgS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aak3apl3k20pcycsvjvu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QruU4RgS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aak3apl3k20pcycsvjvu.png" alt="Image description" width="800" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Policy created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1naywzr---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4wwhabnxgalv5u9j03q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1naywzr---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4wwhabnxgalv5u9j03q.png" alt="Image description" width="800" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's create the IAM Role to attach the private EC2 instance (ec2_app_web). On the IAM dashboard, click in Roles, and then create role button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_lST9ZmF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hldyn4vw6vgz2ylt4o0v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_lST9ZmF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hldyn4vw6vgz2ylt4o0v.png" alt="Image description" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select these option, and click in next&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WuqGnkm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tvebgav6lg0crayzn4j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WuqGnkm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tvebgav6lg0crayzn4j.png" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find the the policy name created on the step before, select it, and next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HnIMl_rT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s3ai8zbb4yys1r85uieb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HnIMl_rT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s3ai8zbb4yys1r85uieb.png" alt="Image description" width="800" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a name, description, check the policy and click in create role&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8nraLsva--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dgi47kug48wvu2anipup.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8nraLsva--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dgi47kug48wvu2anipup.png" alt="Image description" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vGFndUEG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5n5suvi3k45p2b86jwpv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vGFndUEG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5n5suvi3k45p2b86jwpv.png" alt="Image description" width="800" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Role created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lhNEh8g9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2zqujy1tmfhw56rjwjv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lhNEh8g9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2zqujy1tmfhw56rjwjv.png" alt="Image description" width="800" height="70"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's assgin the IAM Role created to the private EC2 instance (ec2_app_web). Select the instance, Action, Security and Modify IAM Role&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_mZi2v0H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7dlh8eqbxqpd8vttkhvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_mZi2v0H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7dlh8eqbxqpd8vttkhvc.png" alt="Image description" width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find the IAM Role created, select it and update IAM Role&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BuHvV9LS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6rgjlq1uh0lzpzs1i8da.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BuHvV9LS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6rgjlq1uh0lzpzs1i8da.png" alt="Image description" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - Create the Gateway endpoint for accessing the S3.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In VPC dashboard, select Endpoint, and click in create endpoint button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tXhsAgmI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6e35i4ow20aflro4h66l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tXhsAgmI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6e35i4ow20aflro4h66l.png" alt="Image description" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a name, select AWS service, select com.amazonaws.us-east-1.s3 (type Gateway), select the VPC, and route table that is assign to private subnet because the route table will update with a prefix to reach S3 service through the VPC endpoint. At the bottom of the page click on the create endpoint button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2K6uRSJF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkqenqqtc1e4ncb1xo9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2K6uRSJF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkqenqqtc1e4ncb1xo9n.png" alt="Image description" width="800" height="873"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4R2vhuIH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xby1cyouo161ky1i2a3a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4R2vhuIH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xby1cyouo161ky1i2a3a.png" alt="Image description" width="800" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;VPC endpoint created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--boLzSxz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5p5xe7xv3tsptkxstxin.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--boLzSxz3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5p5xe7xv3tsptkxstxin.png" alt="Image description" width="800" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you check the route table that belong to the private subnet, you will see the route to reach the VPC endpoint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2q1fYe92--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ziwqdyejfvaa1ybctp8m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2q1fYe92--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ziwqdyejfvaa1ybctp8m.png" alt="Image description" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - Create S3 bucket.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the S3 management console, click in create bucket&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X_8CKq81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ntapgpykm9ff313tgs30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X_8CKq81--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ntapgpykm9ff313tgs30.png" alt="Image description" width="800" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a name, and region where EC2 instance was deployed. At the bottom of the page click on the create bucket button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0lekbFF7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yiur8cwybfve8q8ef428.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0lekbFF7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yiur8cwybfve8q8ef428.png" alt="Image description" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bucket created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r0JUDUua--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/210hnfpx46elkzd1zhhz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r0JUDUua--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/210hnfpx46elkzd1zhhz.png" alt="Image description" width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4 - Check the connectivity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, we are going to access the Linux bastion host (linux_bastion_host), and from it access the private EC2 instance (ec2_app_web) to list the S3 bucket.&lt;/p&gt;

&lt;p&gt;Accessing the Linux bastion host&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BKjFHhfy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/074mcrdzyx5g4dz41obi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BKjFHhfy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/074mcrdzyx5g4dz41obi.png" alt="Image description" width="638" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Accessing the Private EC2 instance, listing all buckets, creating a file, and uploading it to the bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_kWK2jIp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ylai430gu2gaqd7m7zb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_kWK2jIp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ylai430gu2gaqd7m7zb.png" alt="Image description" width="590" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h0iASUa_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u53j3xz8jo31lhg7hqgq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h0iASUa_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u53j3xz8jo31lhg7hqgq.png" alt="Image description" width="692" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Based on this result, we completed the deployment and validated connectivity to the S3 bucket from an EC2 instance without internet access.&lt;/p&gt;

&lt;p&gt;If you would like to deploy this env via Terraform code as the purposed topology, so feel free to access my &lt;a href="https://github.com/hugothomazpsouza/terraform_study/tree/main/vpc-endpoint-gateway"&gt;Gitlab repository&lt;/a&gt; to clone and deploy it. Before deploy via Terraform, replace the profile in provider.tf file and replace your Key_name at the EC2 instace code as per your own settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, we have explored different scenarios that demonstrate the significance of utilizing the VPC Endpoint - Gateway for Amazon S3. By understanding its role and benefits, we can effectively deploy this solution to enhance our infrastructure. I trust that you found this discussion enjoyable.&lt;/p&gt;

&lt;p&gt;Reference Link:&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/vpc/latest/privatelink/gateway-endpoints.html"&gt;https://docs.aws.amazon.com/vpc/latest/privatelink/gateway-endpoints.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html"&gt;https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vpcendpoint</category>
      <category>gatewayendpoint</category>
      <category>s3</category>
      <category>networking</category>
    </item>
    <item>
      <title>How can I read variables into Terraform from a YAML file to deploy the resources on the AWS Cloud?</title>
      <dc:creator>Hugo Thomaz</dc:creator>
      <pubDate>Mon, 13 Feb 2023 22:40:51 +0000</pubDate>
      <link>https://dev.to/hugothomaz/how-can-i-read-variables-into-terraform-from-a-yaml-file-to-deploy-the-resources-on-the-aws-cloud-1nin</link>
      <guid>https://dev.to/hugothomaz/how-can-i-read-variables-into-terraform-from-a-yaml-file-to-deploy-the-resources-on-the-aws-cloud-1nin</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;I've been joining a IaC project (Infrastructure as Code) where the Terraform has been used to deploy our resources into the Cloud, and some variables are being to store in the YAML file. Participating on the project, I have noticed that this model has some advantages as you can see below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Readability:&lt;/strong&gt; the YAML use more human-readable syntax which it makes easier to understand each varaibles and their values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Organization:&lt;/strong&gt; as the YAML permit to organize the varaibles into groups, you can manage it better in a complex infrastructure with a lot the varaibles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Better unification:&lt;/strong&gt; YAML is much used with other DevOps tools,  as for example Ansible, then it become esier to share the varaibles with different tools. &lt;/p&gt;

&lt;p&gt;So, if you use the YAML file to store the Terraform variables, it will offer more flexibility and scalability to manage your infrastructure as code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Objective:
&lt;/h2&gt;

&lt;p&gt;Here I'm going to using a &lt;a href="https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest" rel="noopener noreferrer"&gt;public module from the Terraform registry&lt;/a&gt; to deploy a VPC network and subnets (private and public) on AWS cloud, and the Terraform varaibles will become store into YAML file. It'll be an example, but feel free to use it to deploy other resources. &lt;/p&gt;

&lt;p&gt;Note: In this post, I will not comment how the Terraform and module works, or how the AWS network resource works. If desired, comment here because I can develop another post or share AWS documentation explaining about each resource.&lt;/p&gt;

&lt;p&gt;Before start, there are some requirements to deploy this scenarios that will be expose here. It's needed to have the &lt;strong&gt;Terraform and AWS CLI installed&lt;/strong&gt;, &lt;strong&gt;AWS account set&lt;/strong&gt;, and in my case, I'm going to use the VScode as source-code editor.&lt;/p&gt;

&lt;p&gt;So, let's get started?&lt;/p&gt;

&lt;p&gt;Firstly, let's clone the my public &lt;a href="https://github.com/hugothomazpsouza/terraform_study" rel="noopener noreferrer"&gt;terraform_study github repository&lt;/a&gt; where there are the terraform code stored. So you can use the the git clone command to download the Terraform codes or feel free to copy manually. Here we're going to use the git clone command in my Linux machine to become easier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~
git clone https://github.com/hugothomazpsouza/terraform_study.git
cd terraform_study/Deploy_VPC_and_Subnets_resources_with_Variables_store_on_the_YAML_file/
ls -la
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&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.amazonaws.com%2Fuploads%2Farticles%2F9yk76m7lrncxng2lzkdv.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.amazonaws.com%2Fuploads%2Farticles%2F9yk76m7lrncxng2lzkdv.png" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After completed the commands, you will se the some Terraform files and one YAML file.&lt;/p&gt;

&lt;p&gt;Let's get start to talk about the "&lt;strong&gt;locals.tf&lt;/strong&gt;" Terraform file. It refer to local variables in Terraform, and the tip here is becasue I'm using the "&lt;strong&gt;yamldecode&lt;/strong&gt;" function to read "&lt;strong&gt;variables.yaml&lt;/strong&gt;" YAML file as input for Terraform.&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.amazonaws.com%2Fuploads%2Farticles%2Fromcun38omii3u2wqa8e.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.amazonaws.com%2Fuploads%2Farticles%2Fromcun38omii3u2wqa8e.png" alt="Image description" width="361" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's check the "&lt;strong&gt;variables.yaml&lt;/strong&gt;" YAML file. This YAML file defines two VPCs: "vpc_core_network" and "vpc_app_network", and each one store the VPC CIDR block, Availability Zones, Private and Public Subnets varaibles.&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.amazonaws.com%2Fuploads%2Farticles%2Fudja7myx2vsjqjrz0bd2.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.amazonaws.com%2Fuploads%2Farticles%2Fudja7myx2vsjqjrz0bd2.png" alt="Image description" width="615" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As defined on this file, we're going to create two VPCs, 3 Private subnets each one in an Availability Zone and also 3 Public subnets each one in an Availability Zone.&lt;/p&gt;

&lt;p&gt;The "&lt;strong&gt;vpc.tf&lt;/strong&gt;" Terraform file, as I said before, I'm calling a public module from the Terraform registry to deploy a VPC on AWS Cloud, but I've adjusted the input variables to get from YAML file, and I've created &lt;strong&gt;for_each&lt;/strong&gt; argument for setting to the value of local.config.vpcs, meaning that Terraform will run the module once for each key-value pair in this data structure. &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.amazonaws.com%2Fuploads%2Farticles%2F82dqp8t1kb6yo3i6ek10.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.amazonaws.com%2Fuploads%2Farticles%2F82dqp8t1kb6yo3i6ek10.png" alt="Image description" width="476" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we're going to talk about of other three Terraform files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;outputs.tf&lt;/strong&gt; - it is used to define the outputs variables in Terraform. The outputs values can be used in other Terraform configurations or scripts after the resources has been deployed. For example, if you would like to get the VPC_ID to create another resource you can get it through the Outputs variables instead of set the VPC_ID manually. It will become your code more dynamically and scalable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;provider.tf&lt;/strong&gt; - It is used to configure the Terraform provider that is used, in this case we've used AWS provider, but we can use other Cloud provider, such as Google Cloud, and other. On this provider file I've also defined the authentication method and the configuration data needed to access the provider.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;version.tf&lt;/strong&gt; - It is used to specify the version of Terraform configuration syntax. It is recommended to specify the Terraform version to ensure that Terraform uses the correct syntax for the desired version.&lt;/p&gt;

&lt;p&gt;Now, after completed the understand about the Terraform files and YAML file, we're going to deploy the resources.&lt;/p&gt;

&lt;p&gt;Through the CLI, let's run the Terraform init command to load the modul, installs the necessary providers, and also sets the backend for storing the Terraform state file.&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.amazonaws.com%2Fuploads%2Farticles%2F4k9zcc7eqd70mfqn6jha.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.amazonaws.com%2Fuploads%2Farticles%2F4k9zcc7eqd70mfqn6jha.png" alt="Image description" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, let's run the Terraform plan command to see the changes that the Terraform will make to your infrastructure. I'm going to add the command below, but I won't show the output of the command because there will be many lines.&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.amazonaws.com%2Fuploads%2Farticles%2Fbftqmwaw18hox2ctkzm8.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.amazonaws.com%2Fuploads%2Farticles%2Fbftqmwaw18hox2ctkzm8.png" alt="Image description" width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will see how many resources will add, change or destroy.&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.amazonaws.com%2Fuploads%2Farticles%2Fmywao6j3gukaet6fu6wb.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.amazonaws.com%2Fuploads%2Farticles%2Fmywao6j3gukaet6fu6wb.png" alt="Image description" width="351" height="37"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And now, let's run Terraform apply to deploy the resources shown in the terraform plan command.&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.amazonaws.com%2Fuploads%2Farticles%2Fyyeqypgscm71rh6a9m01.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.amazonaws.com%2Fuploads%2Farticles%2Fyyeqypgscm71rh6a9m01.png" alt="Image description" width="800" height="21"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There will be a question to approve the deployment, then type "yes".&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.amazonaws.com%2Fuploads%2Farticles%2Fm61mpr5qubullk5ufqta.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.amazonaws.com%2Fuploads%2Farticles%2Fm61mpr5qubullk5ufqta.png" alt="Image description" width="425" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After completed it, you will see the information how many resources were added, changed or destroyed, and also the outputs variables.&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.amazonaws.com%2Fuploads%2Farticles%2Fin2cw96ui9z5h6piwveb.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.amazonaws.com%2Fuploads%2Farticles%2Fin2cw96ui9z5h6piwveb.png" alt="Image description" width="542" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you can go to the AWS console to see the resources deployed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; For deleting all resources deployed, please, run the &lt;strong&gt;Terraform destroy command&lt;/strong&gt;. You will need to approve it, then type "yes".&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.amazonaws.com%2Fuploads%2Farticles%2Fi3qh2b3xx7rsjq9o1abo.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.amazonaws.com%2Fuploads%2Farticles%2Fi3qh2b3xx7rsjq9o1abo.png" alt="Image description" width="800" height="32"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;The idea here was shown how to read variables into Terraform from a YAML file to deploy the resources in the AWS Cloud. This was a tasting, but you reuse this idea to use according to your environments.&lt;/p&gt;

&lt;p&gt;Well, I hope you enjoyed it!&lt;/p&gt;

</description>
      <category>vite</category>
      <category>plugin</category>
      <category>performance</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Centralizing Internet Output in Multiple AWS Accounts with the AWS Transit Gateway</title>
      <dc:creator>Hugo Thomaz</dc:creator>
      <pubDate>Sat, 04 Feb 2023 00:08:45 +0000</pubDate>
      <link>https://dev.to/hugothomaz/centralizing-internet-output-in-multiple-aws-accounts-with-the-aws-transit-gateway-1ad5</link>
      <guid>https://dev.to/hugothomaz/centralizing-internet-output-in-multiple-aws-accounts-with-the-aws-transit-gateway-1ad5</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;The objective of this theme is to share a network architecture tip and how to implement it within the AWS Cloud in order to centralize Internet output instead of having multiple NAT Gateways and Internet Gateways scattered throughout the environment.&lt;/p&gt;

&lt;p&gt;The goal is to achieve the following benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simplify the network architecture by routing all outgoing traffic through a centralized point, the AWS Transit Gateway.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reduce costs by centralizing network management and reducing the number of necessary Internet gateways.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improve security by having a single point of control for Internet access, reducing the attack surface and allowing centralized security policies.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: In this post, I will not comment on the function of each network resource. If desired, comment here because I can develop another post or share AWS documentation explaining about each resource.&lt;/p&gt;

&lt;p&gt;So, let's get started?&lt;/p&gt;

&lt;h1&gt;
  
  
  Objectives:
&lt;/h1&gt;

&lt;p&gt;1 - Create the Internet Gateway and attach it;&lt;br&gt;
2 - Create a NAT Gateway for each zone and attach it;&lt;br&gt;
3 - Create the Transit gateway (TGW);&lt;br&gt;
4 - Create the Transit gateway attachments with each VPCs;&lt;br&gt;
5 - Create the Transit gateway route table for each Transit gateway attachment;&lt;br&gt;
6 - Adding the routes on the TGW route tables;&lt;br&gt;
7 - Adding the routes on the VPC route tables of each AWS account;&lt;br&gt;
8 - Testing the connection to the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Network diagram purpose:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project consists of three AWS Accounts. The &lt;strong&gt;Core Network AWS Account&lt;/strong&gt; will provide the interface to the internet for the &lt;strong&gt;PROD&lt;/strong&gt; and &lt;strong&gt;QA AWS Accounts&lt;/strong&gt; that do not have access to the internet through themselves, that is,  they will need to Core Network AWS Account to update them Operation System and access the services outside of the AWS environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46676tt2srrl2jps7a99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46676tt2srrl2jps7a99.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I consider that the VPC, subnets (private and public), and route tables have already been deployed so we can focus on the Transit Gateway, NAT Gateway, Internet Gateway, and also update the routes on the route tables.&lt;/p&gt;

&lt;p&gt;With based on this diagram, let's deploy this environments step-by-step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Create the Internet Gateway and attach it to the vpc-core-network on the &lt;u&gt;Core Network AWS Account&lt;/u&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the AWS console, go to the VPC dashboard, click on the Internet gateways, and Create internet gateway botton. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmic7c9qe78kwtiugdvy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmic7c9qe78kwtiugdvy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define the Internet gateway name, and click on the Create internet gateway.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqbuiqvs1ci6sua6383h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqbuiqvs1ci6sua6383h.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After created Internet gateway, let's attach it to the vpc-core-network VPC&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv06uor3hi64g3fmn03f2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv06uor3hi64g3fmn03f2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1u0ta8mg30tpt83nx0l7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1u0ta8mg30tpt83nx0l7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's update the public subnets' routing table with a default route (0.0.0.0/0) as the next hop to the internet gateway created in the previous steps. Then, go to the Route Tables, select the route table and edit the routes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foimmo23c9huhgya1vvq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foimmo23c9huhgya1vvq7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create the default route, and set the Internet gateway as target, after that save the change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frb423yb19zz5cdo1jvmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frb423yb19zz5cdo1jvmd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2 - Create a NAT Gateway for each zone (us-east-1a and us-east-1b), and attach it for its respective public subnets on the &lt;u&gt;Core Network AWS Account&lt;/u&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS NAT Gateway is a zone resource, which mean that it has high availabilty in the Availability Zone (AZ) where it was deployed, but if there is a issue on the AZ where the NAT Gateway was deployed the resource on that zone will lose the internet access, that's why we are going to create a NAT Gateway in two AZs to ensure higy availability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, go to the NAT Gateway dashboard and click on the Create NAT Gateway botton&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7myw3mup9etrsh1780dh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7myw3mup9etrsh1780dh.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a name, select the public subnet that belong to the us-east-1a AZ, allocate a Elastic IP (public ip) and create NAT Gateway.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpg37y051t7466xfpk31.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpg37y051t7466xfpk31.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's create the NAT Gateway to the subnet that belong to the us-east-1b AZ.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhm4un6z97chg1ak1w6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhm4un6z97chg1ak1w6u.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The NAT Gateways created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Far7rbntolo8wrwzayp2r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Far7rbntolo8wrwzayp2r.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 - Create the Transit Gateway (TGW) on the &lt;u&gt;Core Network AWS Account&lt;/u&gt; and sharing it to the &lt;u&gt;PROD&lt;/u&gt; and &lt;u&gt;QA AWS Accounts&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the AWS console, go to the VPC dashboard, click on the Transit gateways, and Create transit gateway botton. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpy0j0czi5la0qz826lnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpy0j0czi5la0qz826lnz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define the Transit gateway name, uncheck the "Default route table association" and "Default route table propagation" options, check the "Auto accept shared attachments" option, keep the other settings as default and the click on the Create transit gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; the "Default route table association" and "Default route table propagation" options will associate and propagate the routes, but some case there is a requirement where some environments can't establish a connection. Then, when this options is disable Network team there will have more control between communication of the environments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgx9dbouvmahrorxrmhov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgx9dbouvmahrorxrmhov.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Transit gateway available.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F99rl08ytkirzrkze2gn2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F99rl08ytkirzrkze2gn2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's share the Core Network Account's TGW to the PROD and QA AWS Accounts.&lt;/p&gt;

&lt;p&gt;Type RAM on the search bar, and choose the "Resource Access Manager".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2x5lj4eknpagabsrutqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2x5lj4eknpagabsrutqg.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the session "Shared by me", click in "Shared resources", and Create resource share botton.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqstyesu7bc31kiblb8n2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqstyesu7bc31kiblb8n2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the Step 1, define the a name to the resource that will be share, select "Trasit Gateway" as resource that will share, select it on the Selected resources, and click in Next at the botton of the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5iq9eb6riqid70boknh1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5iq9eb6riqid70boknh1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the Step 2, keep these default settings, and click in Next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dijn6r121ohplehmnbv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dijn6r121ohplehmnbv.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the Step 3, as my other AWS Account belong of the same Organization, the "Allow sharing only within your organization" option was selected, but you can shared to anothe AWS Account that doesn't part of the owner Organization. Select the AWS Account, type AWS Account IDs, in this case it was added and selected the &lt;u&gt;PROD&lt;/u&gt; and &lt;u&gt;QA AWS Accounts&lt;/u&gt; as you can see on the diagram. After that, click in Next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx7cpjtx4zmwi1khay548.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx7cpjtx4zmwi1khay548.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the last Step, make a review, and click on the "Create resource share" at the botton of the page.&lt;/p&gt;

&lt;p&gt;The sharing process can take a while, but once it's done, you can see its status on the "Resource shares".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa6aa4i9lusvn8uvdkd5w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa6aa4i9lusvn8uvdkd5w.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4 - Create the Transit gateway attachments with each VPCs.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Still in Core Network AWS Account, go back to the VPC dashboard, and in Transit Gateway session select the "Transit gateway attachments" option. Click on the Create transit gateway attachments to assign the TGW to the vpc-core-network VPC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8en24nop75qttrtz4l1i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8en24nop75qttrtz4l1i.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the first part of the settings, define a name for the TGW attachment, select the TGW-01 created on the previeus step, and as the attachment will be with VPC, select the VPC, but there is other options of attachment (feel free to see the other options).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8e74rsi0wbw8vs38fm5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8e74rsi0wbw8vs38fm5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this last part, select the "vpc-core-network" VPC, the subnets will be load, and select Private subnets related to the each AZ as you on can see on the diagram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zyklnival4syfnrxss2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zyklnival4syfnrxss2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Transit gateway attachment created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8pu6dyvz326j7vm97zhh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8pu6dyvz326j7vm97zhh.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, sign into each AWS account (PROD and QA account) and repeat the same Transit gateway attachment procedure for their respective VPC. As this is a simulation/study environment, the PROD and QA accounts only have one subnet (according to the diagram) in the part of selecting the subnets you will see only one subnet to select.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5 - Create the Transit Gateway route table for each Transit gateway attachment created in the previous step.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the Core Network AWS Account, go to VPC dashboard and in the Transit Gateway click on the "Transit gateway route tables" option. Click in "Create transit gateway route table" botton to create a TGW route table for the vpc-core-network VPC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36jwf0dl9yj7j8v3q2gz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36jwf0dl9yj7j8v3q2gz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define a TGW route table name, select the TGW-01, and click in Create transit gateway route table button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvzd7nbrtd0ml3ykdten.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxvzd7nbrtd0ml3ykdten.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After created the TGW route table, let's assign the TGW attachment assigned the vpc-core-network VPC. Click on the Associations tab, and Create association button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvynbuc6zro7cie058yih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvynbuc6zro7cie058yih.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the TGW attachment assigned the vpc-core-network VPC, and click on the Create association.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rh1p6kj4enivp5qyeh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rh1p6kj4enivp5qyeh5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's create a TGW route table for the PROD and QA accounts. Follw the table with TGW attachment ID respective for PROD and QA VPC.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;PROD Account&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Name:&lt;/strong&gt; TGW-attachment-vpc-prod-us-east-1&lt;br&gt;
&lt;strong&gt;ID:&lt;/strong&gt; tgw-attach-09d24c8d49c4b0a76&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;QA Account&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Name:&lt;/strong&gt; TGW-attachment-vpc-qa-us-east-1&lt;br&gt;
&lt;strong&gt;ID:&lt;/strong&gt; tgw-attach-09d24c8d49c4b0a76&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The TGW route table is created in the TGW's own account, so in this case it's the Core Network AWS Account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PROD Account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Define a TGW route table name, select the TGW-01, and click in Create transit gateway route table button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbzhj2gj4b6m24d151jx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbzhj2gj4b6m24d151jx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's associate the created TGW route table with the TGW attachment assigned to VPC vpc-prod-us-east-1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugbwln2zxxurda2hbqub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fugbwln2zxxurda2hbqub.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4f4xrgrw5fs2rg9mjrod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4f4xrgrw5fs2rg9mjrod.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;QA Account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Define a TGW route table name, select the TGW-01, and click in Create transit gateway route table button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5twbnha79swgwe1ib2o9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5twbnha79swgwe1ib2o9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's associate the created TGW route table with the TGW attachment assigned to VPC vpc-qa-us-east-1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9ixngm0mdp497azzmrh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9ixngm0mdp497azzmrh.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F919g21yk7mv9rq7fseb2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F919g21yk7mv9rq7fseb2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The three TGW route tables created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flggahgoy80undbyoxfnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flggahgoy80undbyoxfnz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6 - Adding the routes on the TGW route tables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With based on the network diagram, and the resources created let me shared some information that will help to set the routes on the TGW route tables.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;- Core Network AWS Account&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;VPC Name:&lt;/strong&gt; vpc-core-network - &lt;strong&gt;CIDR Block:&lt;/strong&gt; 10.100.0.0/16&lt;br&gt;
&lt;strong&gt;TGW Attachment name:&lt;/strong&gt; TGW-attachment-vpc-core-network&lt;br&gt;
&lt;strong&gt;TGW Attachment ID:&lt;/strong&gt; tgw-attach-0dcf709522c248333&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- PROD AWS Account&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;VPC Name:&lt;/strong&gt; vpc-prod-us-east-1 - &lt;strong&gt;CIDR Block:&lt;/strong&gt; 10.10.0.0/16&lt;br&gt;
&lt;strong&gt;TGW Attachment name:&lt;/strong&gt; TGW-attachment-vpc-prod-us-east-1&lt;br&gt;
&lt;strong&gt;TGW Attachment ID:&lt;/strong&gt; tgw-attach-09d24c8d49c4b0a76&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- QA AWS Account&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;VPC Name:&lt;/strong&gt; vpc-qa-us-east-1 - &lt;strong&gt;CIDR Block:&lt;/strong&gt; 10.20.0.0/16&lt;br&gt;
&lt;strong&gt;TGW Attachment name:&lt;/strong&gt; TGW-attachment-vpc-qa-us-east-1&lt;br&gt;
&lt;strong&gt;TGW Attachment ID:&lt;/strong&gt; tgw-attach-0d3bd1d648be67976&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On the &lt;strong&gt;Core Network Account&lt;/strong&gt;, let's create two routes to reach the network that belong &lt;strong&gt;PROD AWS Account&lt;/strong&gt; and &lt;strong&gt;QA AWS Account&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Select the "tgw-rtb-vpc-core-network", click on the Routes tab, and then click in Create static route button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrtp94wh5adpuvvpjofy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrtp94wh5adpuvvpjofy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Define the PROD CIDR Block and PROD TGW Attachment ID.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle3qg90bh5qw6czemtfr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle3qg90bh5qw6czemtfr.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new one rote for QA AWS Account. Define the QA CIDR Block and QA TGW Attachment ID.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknligj323n85shaewhon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknligj323n85shaewhon.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Routes created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ia36voydrp2hmod8etg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ia36voydrp2hmod8etg.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, on the "tgw-rtb-vpc-prod-us-east-1" and "tgw-rtb-vpc-qa-us-east-1" TGW route tables, let's create a default route (0.0.0.0/0) and define as target the Core Network AWS Account TGW Attachment Id. As you can see on the next screenshot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tgw-rtb-vpc-prod-us-east-1&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fda5snmg6luovi0cflmqb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fda5snmg6luovi0cflmqb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tgw-rtb-vpc-qa-us-east-1&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hcvs95kdveb7n3q2rvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hcvs95kdveb7n3q2rvf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7 - Adding the routes on the VPC route tables of each AWS account&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the &lt;strong&gt;Core Network Account&lt;/strong&gt;, let's create the routes on the route table that is attached to the Public subnet and Private subnet.&lt;/p&gt;

&lt;p&gt;On the Public Subnet (rtb-vpc-core-network-public-subnets), add these routes as you can see on the table, and screenshot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CIDR Block&lt;/strong&gt;   |   &lt;strong&gt;Next Hop&lt;/strong&gt;&lt;br&gt;
10.100.0.0/16    |   local&lt;br&gt;
10.10.0.0/16     |   TGW-01&lt;br&gt;
10.20.0.0/16     |   TGW-01&lt;br&gt;
0.0.0.0/0        |   IGW&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0nfvnda2qek75unornfj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0nfvnda2qek75unornfj.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the both Private Subnets, add these routes as you can see on the screenshots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;rtb-vpc-core-network-private-subnets-us-east-1a&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8nl2zkgedgcqaztubzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc8nl2zkgedgcqaztubzj.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
As this route table belong to the private subnet of the &lt;strong&gt;eu-east-1a&lt;/strong&gt; Zone, It should be used the NAT Gateway deployed on the &lt;strong&gt;eu-east-1a&lt;/strong&gt; Zone as target.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;rtb-vpc-core-network-private-subnets-us-east-1b&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frbsnepqz16f6ua8zs8rc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frbsnepqz16f6ua8zs8rc.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
The same thing for the route table that belong to the private subnet of the &lt;strong&gt;eu-east-1b&lt;/strong&gt; Zone, It should be used the NAT Gateway deployed on the &lt;strong&gt;eu-east-1b&lt;/strong&gt; Zone as target.&lt;/p&gt;

&lt;p&gt;Now, let's create a route on the &lt;strong&gt;PROD&lt;/strong&gt; and &lt;strong&gt;QA Accounts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Create a default route (0.0.0.0/0), and as target set the Transit gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PROD Account&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1rs9zvw3u4l92l1a3bm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1rs9zvw3u4l92l1a3bm7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;QA Account&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkn0i0qauxctvs1m25l6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkn0i0qauxctvs1m25l6w.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8 - Testing the connection to the internet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From &lt;strong&gt;QA Account&lt;/strong&gt;, it was created a EC2 instance where I ran some commands as you can below on screenshot to show that a EC2 instance assigned to a private subnet can reach the internet throught on &lt;strong&gt;Core Network Account&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdqfsbnghg8ogl2a20qb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdqfsbnghg8ogl2a20qb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The "curl ifconfig.me" command come back with public IP address, and if you check the NAT Gateway public IP address will valideted that the public ip address belong to the NAT Gateway of the &lt;strong&gt;Core Network Account&lt;/strong&gt; as you can see on the screenshot below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetd9q270lsb7i480priy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fetd9q270lsb7i480priy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;NAT Gateway is a network resource that, when there is a lot of it, can bring high costs and your bill at the end of the month will get more expensive, in addition to leaving the Internet output from several places decentralized and also more complex to manage. Then, this proposed architecture comes to demonstrate a solution with high availability, low management complexity, having a single exit point and reducing the cost of the AWS account bill.&lt;/p&gt;

&lt;p&gt;Well, I hope you enjoyed it!&lt;/p&gt;

</description>
      <category>transitgateway</category>
      <category>natgateway</category>
      <category>aws</category>
      <category>network</category>
    </item>
  </channel>
</rss>
