<?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: Ariel Coba</title>
    <description>The latest articles on DEV Community by Ariel Coba (@arielranger).</description>
    <link>https://dev.to/arielranger</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%2F1006318%2F0cb78c58-3e70-4dce-ad07-1753e2d138b6.png</url>
      <title>DEV Community: Ariel Coba</title>
      <link>https://dev.to/arielranger</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arielranger"/>
    <language>en</language>
    <item>
      <title>Send Event Notifications from MongoDB Trigger to AWS Eventbridge</title>
      <dc:creator>Ariel Coba</dc:creator>
      <pubDate>Thu, 12 Jan 2023 06:02:56 +0000</pubDate>
      <link>https://dev.to/arielranger/send-event-notifications-from-mongodb-trigger-to-aws-eventbridge-4eo</link>
      <guid>https://dev.to/arielranger/send-event-notifications-from-mongodb-trigger-to-aws-eventbridge-4eo</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What if you want to record any action performed in your database and send an SMS notification to your Smart device? You'll see this great approach that I've performed just for fun :).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MongoDB Side&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create MongoDB Trigger&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Go to your MongoDB Atlas Cluster and Add a new Trigger&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%2Fqqtaczc7dghuqdub2m8r.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%2Fqqtaczc7dghuqdub2m8r.png" alt="MongoDBAddTrigger" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;Database&lt;/strong&gt; as Trigger Type, enter a name for your trigger and link a data source to itP:&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%2Fidxu6ughzt9xnk3hq05z.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%2Fidxu6ughzt9xnk3hq05z.png" alt="MongoDBTrigger01" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select your Cluster, Database, Collection Names and the operations you want to fire up the trigger:&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%2Fydf41bdlv6qur7hm7b12.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%2Fydf41bdlv6qur7hm7b12.png" alt="MongoDBTrigger02" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select &lt;strong&gt;EventBridge&lt;/strong&gt; as Event Type, Enter your AWS Account ID and Region:&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%2Fwj9ap7rb6nfhkts9ch6t.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%2Fwj9ap7rb6nfhkts9ch6t.png" alt="MongoDBTrigger03" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Side&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's go to Amazon EventBridge&amp;gt;Partner event sources and you'll see the Event Source added after creating the trigger within MongoDB, now we have to associate this event&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%2Fush95m5uycynsojwru00.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%2Fush95m5uycynsojwru00.png" alt="EventBridge001" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use the default options while associating this event source:&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%2Fso7p2prt4n9vfs6a9m7l.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%2Fso7p2prt4n9vfs6a9m7l.png" alt="EventBridge002" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You'll see the event in &lt;strong&gt;Active&lt;/strong&gt; state after this process:&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%2F9ospcqm324dzbdy26k8v.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%2F9ospcqm324dzbdy26k8v.png" alt="EventBridge007" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's go to &lt;strong&gt;Rules&lt;/strong&gt;, Select the Event Bus already created from the drown dop list and create a rule:&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%2Fbqvhqbn5lgk9cjttcen1.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%2Fbqvhqbn5lgk9cjttcen1.png" alt="EventBridge008" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's put a name to this rule and use the default options in section 1:&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%2Febaluu77t72y8238oasb.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%2Febaluu77t72y8238oasb.png" alt="EventBridge009" width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to Event Pattern in Section 2 and select the options from the image below:&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%2F69n00i307o7z6v5dl43u.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%2F69n00i307o7z6v5dl43u.png" alt="EventBridge010" width="800" height="555"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In section 3, use &lt;strong&gt;AWS Service&lt;/strong&gt; as target type, in target you can use any option you want but, in this example, I'll be using SNS Topic:&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%2Fv5uob9yb1u6md7862j2b.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%2Fv5uob9yb1u6md7862j2b.png" alt="EventBridge011" width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open a new tab from your browser for your AWS Console and got to SNS (Simple Notification Service):&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%2Fj9r00p4c9pslhwjryqhl.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%2Fj9r00p4c9pslhwjryqhl.png" alt="SNS001" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter a display for this SNS and leave the other options as default:&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%2F7i6gro11hjwl19m9c62u.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%2F7i6gro11hjwl19m9c62u.png" alt="SNS002" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's create a subscription:&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%2F53d71zpkc7woi3iw1b7i.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%2F53d71zpkc7woi3iw1b7i.png" alt="SNS003" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select your topic ARN already created SMS as protocol and select your phone number from the list.&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%2Fnjwauwizv95zkg8jnl89.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%2Fnjwauwizv95zkg8jnl89.png" alt="SNS004" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After selecting your target and SNS Topic, you can click on Next and Create your Rule:&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%2Ftt18o6n96hcu009lbgbj.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%2Ftt18o6n96hcu009lbgbj.png" alt="EventBridge012" width="800" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating your rule, we can go back to our MongoDB Atlas Cluster and perform a test by removing a document:&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%2Fc9us2pzb2l94w4zwc45a.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%2Fc9us2pzb2l94w4zwc45a.png" alt="MongoDB001" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've got my notification via SMS that a document was deleted, this is working!&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%2Fwtghv1tmfop4f8kkpt97.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtghv1tmfop4f8kkpt97.jpg" alt="SMS" width="800" height="1487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you find this information helpful, if you have any issues, comments or feedback shoot me a comment.&lt;/p&gt;

&lt;p&gt;Have a good one community!&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Amazon S3 now automatically encrypts all new objects!</title>
      <dc:creator>Ariel Coba</dc:creator>
      <pubDate>Thu, 12 Jan 2023 05:20:54 +0000</pubDate>
      <link>https://dev.to/arielranger/amazon-s3-now-automatically-encrypts-all-new-objects-41dd</link>
      <guid>https://dev.to/arielranger/amazon-s3-now-automatically-encrypts-all-new-objects-41dd</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What a great news from amazon, now every object you upload to your S3 Bucket will be encrypted by default!! Adding another extra layer of security to your data which is the most important and expense thing in any Information System.&lt;/p&gt;

&lt;p&gt;Amazon S3 now automatically applies S3 managed server-side encryption (SSE-S3) as a base level of encryption to all new objects added to S3, at no additional cost and with no impact on performance. SSE-S3 uses 256-bit Advanced Encryption Standard and has been configured for trillions of objects by customers. This new base level of encryption helps customers meet their encryption requirements, with no changes to applications. Alternatively, customers can still choose to update this default configuration using customer-provided encryption keys (SSE-C) or AWS Key Management Service keys (SSE-KMS).&lt;/p&gt;

&lt;p&gt;Since 2017, customers have used the S3 Default Encryption feature to apply a base level of encryption for every object added to their buckets. S3 Default Encryption is an optional bucket-level setting that customers use to establish a default level of encryption. With this update, Amazon S3 will automatically apply SSE-S3 as the base level of Default Encryption setting for all new buckets and for existing buckets without any customer configured encryption setting. Existing buckets currently using S3 Default Encryption configuration will not change. Customers can continue to update the Default Encryption configuration but can no longer remove this setting from any S3 bucket to disable automatic encryption on new objects. As a result, all new data uploaded to S3 will be encrypted at rest.&lt;/p&gt;

&lt;p&gt;The automatic encryption status for new object uploads and S3 Default Encryption configuration is available in AWS CloudTrail logs. Over the next few weeks, this status will begin to show in the S3 management console, S3 Inventory, S3 Storage Lens, and as an additional S3 API header in the AWS CLI and AWS SDK. We will update the S3 documentation once this additional information is available in all AWS Regions. This update is available in all AWS Regions, including the AWS GovCloud (US) Regions and AWS China Regions. For detailed information on the expected experience, see the AWS News Blog post for this new base level of encryption or visit the Amazon S3 encryption documentation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/about-aws/whats-new/2023/01/amazon-s3-automatically-encrypts-new-objects/" rel="noopener noreferrer"&gt;Amazon S3 now automatically encrypts all new objects&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>AWS Create Bastion Host to communicate with your Private Subnet</title>
      <dc:creator>Ariel Coba</dc:creator>
      <pubDate>Wed, 11 Jan 2023 20:08:11 +0000</pubDate>
      <link>https://dev.to/arielranger/aws-create-bastion-host-to-communicate-with-your-private-subnet-4h77</link>
      <guid>https://dev.to/arielranger/aws-create-bastion-host-to-communicate-with-your-private-subnet-4h77</guid>
      <description>&lt;p&gt;Note: This is my first blog post, any recommendations and feedback would be appreciated.&lt;/p&gt;

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

&lt;p&gt;Bastion Host - A bastion host is a specialized computer that is deliberately exposed on a public network. From a secured network perspective, it is the only node exposed to the outside world and is therefore very prone to attack.&lt;/p&gt;

&lt;p&gt;The bastion host processes and filters all incoming traffic and prevents malicious traffic from entering the network, acting much like a gateway. The most common examples of bastion hosts are mail, domain name system, Web and File Transfer Protocol (FTP) servers.&lt;/p&gt;

&lt;p&gt;In this post, I will be demonstrating how to configure a VPC in order to communicate two EC2 Instances (One acting as a bastion host and the other one inside a private network).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating VPC&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First Let's start Creating a simple VPC:&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%2Fflno7vonk8asf9i97nxy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fflno7vonk8asf9i97nxy.jpg" alt="VPC" width="800" height="863"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can use any name or CIDR you want.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Subnets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's select our VPC (Created in last step):&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%2Fm8zzq0lrbg9g0qlp8yhu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8zzq0lrbg9g0qlp8yhu.jpg" alt="SubnetsVPC" width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's create two subnets, one for the public subnet and the other one for the private subnet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgyslunt3pyl8px96y4me.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgyslunt3pyl8px96y4me.jpg" alt="Subnets" width="540" height="886"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's edit the Public Subnet Already created and Check "Enable auto-assign public IPv4 address"&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%2Fma5819nwuhk53wi1jkoi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fma5819nwuhk53wi1jkoi.jpg" alt="autoassignipv4" width="800" height="789"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating Routing Tables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Route Table for Public Subnet&lt;/p&gt;

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

&lt;p&gt;Route Table for Private Subnet&lt;/p&gt;

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

&lt;p&gt;Edit route table associations so we can add these route tables already created to our subnets:&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%2Fms3228lqrr6btu1ojtsi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fms3228lqrr6btu1ojtsi.jpg" alt="RouteTableAssociation" width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;Creating Internet Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, We need to create an Internet gateway in order to provide internet access to our Bastion Host&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%2Fuwxarxrbhcnys0j7afw7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwxarxrbhcnys0j7afw7.jpg" alt="Internetgateway" width="800" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, we need to attach this Internet Gateway to our VPC (myDemoVpc)&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%2F7cfdinbulfstv6fb8rhy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7cfdinbulfstv6fb8rhy.jpg" alt="IGW1" width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Add a Route to this Internet Gateway already attached&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%2Fq6qswf5mbaho8s9b6gcq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq6qswf5mbaho8s9b6gcq.jpg" alt="IGW-PublicSubnet-RouteTable" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmi1b6xv9qy95twl885uf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmi1b6xv9qy95twl885uf.jpg" alt="IGW-PublicSubnet-RouteTableAdded" width="800" height="176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: This Route must to be added &lt;strong&gt;ONLY&lt;/strong&gt; to our public subnet route table as we're simulating a connection from our bastion host to a private subnet which can contains a database or a server with sensitive data or any other information that must be remain private and cannot reach the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating EC2 Instances&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's start creating our Bastion Host and test connectivity trough the internet:&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%2Fwgaldg603etclsnevz68.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwgaldg603etclsnevz68.jpg" alt="EC2-Settings" width="793" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's go to the Network Settings Section and Click on Edit to select the options marked&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%2Foy2ffw6pshl85tjiidt5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foy2ffw6pshl85tjiidt5.jpg" alt="EC2-Network" width="783" height="898"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing Connectivity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Select our instance previously created and click on Connect&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%2Fh985eb7nrx8jkumai2i8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh985eb7nrx8jkumai2i8.jpg" alt="EC2Connectivity" width="800" height="110"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;We have internet access in our Bastion Host:&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%2Fctysir8lawrhrzkuhgsj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctysir8lawrhrzkuhgsj.jpg" alt="EC2Connected" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating EC2 Instance in Private Subnet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's go now to the Network Settings Section and Click on Edit to select the options marked&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%2F2f9ym9snhpz3usz5mg38.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2f9ym9snhpz3usz5mg38.jpg" alt="EC2PrivateNetworkSettings" width="783" height="854"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: To Add a layer of extra security, I've only provided access through SSH to Bastion Host Security Group as well added ICMP - IPv4 rule to test connectivity.&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%2Fuuehk0fctpbi4xa6uwmf.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuuehk0fctpbi4xa6uwmf.jpg" alt="SG-Rules" width="788" height="680"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Testing Final Connectivity &lt;/p&gt;

&lt;p&gt;After Created the EC2 Private instance, let's test connectivity through web browser:&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%2Fchwaiv7y90h9te2cbcst.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchwaiv7y90h9te2cbcst.jpg" alt="EC2PrivateInstaceConnection" width="800" height="755"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see above, we cannot connect through the internet, this is the expected behavior as we haven't assigned a public ip address to this instance since it will remain private.&lt;/p&gt;

&lt;p&gt;Let's test connectivity from our Bastion Host&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%2Fd9mm4qmd139pjzjeph11.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9mm4qmd139pjzjeph11.jpg" alt="ConnectivityOK" width="643" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see, we're able to ping our private instance though our Bastion Server&lt;/p&gt;

&lt;p&gt;Let's try our final test by connecting through SSH from our Bastion Server&lt;/p&gt;

&lt;p&gt;Let's create a file which contains our key pair&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vi bastionDemoKey.pem&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Copy the content of the key pair created in AWS&lt;/p&gt;

&lt;p&gt;Change Permissions to the file created&lt;/p&gt;

&lt;p&gt;&lt;code&gt;chmod 400 bastionDemoKey.pem&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now let's try SSH to our EC2 Private Instance&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh -i bastionDemoKey.pem ec2-user@172.16.2.10&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We have connectivity!!&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%2Fa2i0ogv5lmouj36xjw66.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa2i0ogv5lmouj36xjw66.jpg" alt="SSHPrivateEC2" width="748" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you find this information helpful, if you have any issues, comments or feedback shoot me a comment.&lt;/p&gt;

&lt;p&gt;Have a good one community!&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
  </channel>
</rss>
