<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[FreeCloudLabs - Medium]]></title>
        <description><![CDATA[Write for FreeCloudLabs, hands-on cloud labs designed to help individuals learn Amazon Web Services (AWS). The  labs cover a wide range of AWS services and use cases and are designed to give learners practical experience using real-world scenarios! - Medium]]></description>
        <link>https://medium.com/awesomeaws?source=rss----6a1b44e18bc---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>FreeCloudLabs - Medium</title>
            <link>https://medium.com/awesomeaws?source=rss----6a1b44e18bc---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 08:17:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/awesomeaws" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Exporting RDS Snapshot to S3]]></title>
            <link>https://medium.com/awesomeaws/exporting-rds-snapshot-to-s3-ad3b0d63f5bf?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/ad3b0d63f5bf</guid>
            <category><![CDATA[hands-on-tutorials]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[rds-mysql]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Asma Akram]]></dc:creator>
            <pubDate>Mon, 20 Nov 2023 18:40:27 GMT</pubDate>
            <atom:updated>2023-11-20T18:41:05.108Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*Vc_I8DiWkCa6nhncCDDfMA.png" /><figcaption>Image Credit: Whizlabs</figcaption></figure><h3>Introduction:</h3><p>Today we will learn about exporting RDS Snapshot to S3 bucket.</p><p>For this, we have to create an Amazon S3 bucket with the required IAM permissions and create a KMS key for server-side encryption. After that we will export the snapshot via Console or CLI commands.</p><p>Here we will practice creating an Amazon RDS DB Instance, Amazon S3 Bucket, and AWS KMS Key.</p><ol><li>The data that is exported to S3 is always in the Apache Parquet format. Parquet format is 2 times faster to export and consumes up to 6 times less storage in Amazon S3 compared to test formats.</li><li>The exported data can be analyzed by other AWS services like Amazon Sagemaker, Amazon EMR, and Amazon Athena.</li></ol><p>We can export all kinds of RDS data to an S3 bucket where it is done via manual backup automated backup or AWS Backup service.</p><h4>Prerequisites:</h4><p>To download the MySql GUI Tool, To download it, go to the <a href="https://dev.mysql.com/downloads/workbench/">Download MySQL Workbench page</a>. Based on your OS, select the respective option under Generally Available (GA) Releases. Download and Install.</p><h3>Task 1. Create an S3 bucket for storing RDS Snapshot</h3><p>Go to Services and click on S3 under Storages, On the S3 Page, click on Create bucket and fill in the bucket details.</p><p>➥ Bucket name: Enter <em>export-snapshot-rds123</em></p><ul><li>Note: S3 bucket name is globally unique, choose a name that is available.</li><li>Region: Select US East (N. Virginia) us-east-1</li><li>Create bucket</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*2_V6FE01wuzfwhh8af2J8g.png" /></figure><h3>Task 2. Lets Create KMS Keys</h3><p>➥ Go to Services menu on the top. Click on Key Management Service under the Security, Identity, &amp; Compliance section.</p><p>In the KMS console, navigate to Customer managed keys and click on Create Key.</p><ul><li>Select the Key Type as Symmetric and click on Next.</li><li>Under the Add Labels, give the following details:</li><li>Alias: Enter kmskey_1234(Change the name, if there is a key present with the same name)</li><li>Description: Enter <em>Used for RDS Snapshot exports to S3 of the “database-demo” DB Instance</em></li><li>Click on Next.</li><li>Leave Define key administrative permissions as default and click on Next.</li><li>Leave Define key usage permissions as default and click on Next.</li><li>Click on the Finish button.</li><li>Click on the created KMS key. Copy the ARN and keep it for future reference.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ui5HQOZFstuc0tbNASy-0w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKeYcNNyRNO1iogjfTfgLA.png" /></figure><h3>Task 3. Lets create security group for RDS DB Instance</h3><p>➥ Go to the Services menu, under the Compute section, click on EC2</p><ul><li>On the left panel menu, select the security group under the Network &amp; Security section.</li><li>Click on create security group</li><li>Give security group name as RDS_SG</li><li>Description as “Security group for RDS”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHS_q4dVDOYLcdEIWMESiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F-ahKTgxojhMztCyAjH8OA.png" /></figure><ul><li>In the inbound rules</li><li>Type: Select MYSQL/Aurora</li><li>Source: Select Custom</li><li>In the textbox add 0.0.0.0/0</li><li>Click on create Security Group</li></ul><h3>Task 4. Create an Amazon RDS DB Instance</h3><p>➥ Go to the Services menu at the top left corner and click on RDS present under the Database section.</p><ul><li>Click on the Create database button</li><li>Click on the option Standard create</li><li>Engine options, select MySQL engine type</li><li>Under Templates, select Free tier option.</li><li>Under Settings, provide the following details.</li><li>DB cluster identifier: Enter: labdatabase</li><li>Master username: Enter admin</li><li>Master password: Enter Admin<em>123</em></li><li>Confirm password: Enter Admin<em>123</em></li></ul><p><em>Note — Make sure the master and confirm passwords should be the same. Make a note of the username and password for later use.</em></p><ul><li>Under DB instance class, select Burstable classes (including t classes) and select db.t3.micro</li><li>Under Storage,</li><li>Storage type: General Purpose (SSD)</li><li>Allocated storage: 20</li><li>Uncheck Enable storage autoscaling</li><li>Under Connectivity:</li><li>Network &amp; Security</li><li>Virtual Private Cloud (VPC): default VPC</li><li>Subnet group: default</li><li>Public accessibility: Choose Yes (Important)</li><li>VPC security groups: Select Choose existing<br>Remove the default one and select <em>RDS_SG</em> instead.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ppESFEZZCyrjNSx4BbMpkQ.png" /></figure><ul><li>Availability zone: default No Preference</li><li>Leave Database Authentication as default.</li><li>Expand the Additional configuration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JU_76ZC1FTb885sZEA1dtg.png" /></figure><ul><li>In the displayed layout provide the following values under Database options.</li><li>Initial database name: Enter <em>demodb</em></li><li>Leave DB parameter group and Option group as default.</li><li>Under Backup, uncheck Enable automated backups.</li><li>Leave other settings as default.</li><li>Uncheck Deletion protection.</li><li>Click on Create database button to create the database. This process does take time between 5–10 minutes.</li><li>Once the database is created the status changes to Available.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DkRFkztbkw7vPgCNspYAjw.png" /></figure><h3>Task 5. Connect to the RDS Database using the MySQL Workbench</h3><p>Now we will connect to a database on a MySQL DB instance using MySQL monitor commands. One GUI-based application you can use to connect is MySQL workbench, which you have already downloaded and installed based on instructions in the prerequisite section.</p><p>➥ To connect to a database on a DB instance using MySQL monitor, find the endpoint (DNS name) and port number for your DB Instance.</p><ul><li>Navigate to Databases and click on the created demo-db.</li><li>Under the Connectivity &amp; security section, copy and note the endpoint and port.</li><li>Endpoint: labdatabase.cq8cqq2aweg7.us-east-1.rds.amazonaws.com</li><li>Port: 3306</li><li>You need both the endpoint and the port number to connect to the DB instance.</li><li>Open MySQL Workbench. Click on the MYSQL Connection plus icon.</li><li>Connection Name: Enter a sample name <em>MyDBConnection</em>.</li><li>Host Name: Enter the endpoint: mydatabaseinstance.cdegnvsebaim.us-east-1.rds.amazonaws.com</li><li>Port: 3306</li><li>Username: Enter <em>admin</em></li><li>Password: Click on Store in the keychain and enter a password — <em>Admin123</em>. Click on Ok.</li><li>After successfully connecting and opening the database, you can create tables and perform various queries over the connected database.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wANC5EQogS3JIbvOsmgcWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*g3UAqwu_dm07SCHryhuBEA.png" /></figure><h3>Task 6. Create a sample database and a table</h3><p>➥ In the SQL Editor, let us create a sample database and a table for demo purposes.</p><ul><li>Note: After executing every command, it is necessary to clear the editor and proceed to the next command.</li><li>For executing the command press the icon as shown below in the image.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/0*PE9pokqhiK4KXvkr.png" /></figure><ul><li>To see the changes after every execution, click on the Refresh button, right to the SCHEMAS.</li><li>Note: Please copy-paste the SQL queries carefully, double-check, and remove extra whitespaces.</li><li>Create a database:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEhmAW_NZuREEYnEB7TJtg.png" /></figure><pre>CREATE DATABASE SchoolDB;<br>show databases;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*0Ao3N3BrvBLaDBaApTLG3g.png" /></figure><ul><li>Switch to the database named SchoolDB.</li></ul><pre>use Schooldb;</pre><p>. Create a sample table consisting of Subjects.</p><pre>CREATE TABLE IF NOT EXISTS subjects (<br>            <br>    subject_id INT AUTO_INCREMENT,<br>  <br>                          subject_name VARCHAR(255) NOT NULL,<br>  <br>                          teacher VARCHAR(255),<br>              <br>                          lesson TEXT,<br>  <br>                          PRIMARY KEY (subject_id)<br><br>                     ) ENGINE=INNODB;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*__thoGRHYQ3VaiYX3676gA.png" /></figure><p>Insert some details into the table executing one after the other:</p><pre>INSERT INTO subjects(subject_name, teacher, lesson) VALUES (&#39;English&#39;, &#39;John Taylor&#39;, &#39;Chapter one&#39;);<br>            <br>INSERT INTO subjects(subject_name, teacher, lesson) VALUES (&#39;Science&#39;, &#39;Mary Smith&#39;, &#39;Chapter four&#39;);<br>        <br>INSERT INTO subjects(subject_name, teacher, lesson) VALUES (&#39;Maths&#39;, &#39;Ted Miller&#39;, &#39;Chapter ten&#39;);<br>            <br>INSERT INTO subjects(subject_name, teacher, lesson) VALUES (&#39;Arts&#39;, &#39;Suzan Carpenter&#39;, &#39;Chapter seven&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*AGJHHQgGLVtZ2rPMX5Bi1g.png" /></figure><pre>select * from subjects;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*0TuWQi69jjACOROk-WJYGw.png" /></figure><p>We have created a sample database and table. Close the database connection by clicking on the x symbol.</p><h3>Task 7: Take a Snapshot from the existing DB Instance</h3><p>➥ Let us take a snapshot of the database.</p><ol><li>Select the created DB Instance and click on Actions.</li><li>Click Take snapshot from the options.</li><li>Give a name to the snapshot, lab-db-snapshot (give a unique name for validation report purposes) and click on the Take snapshot button.</li><li>The snapshot creation takes 3–5 minutes. Refresh after some time, the snapshot creation status will be Available.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sTS_TQd0kMCFxBCsJJXceQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWlT1MKLq_eDT-2Xt1yK1g.png" /></figure><h3>Task 8: Export the DB snapshot to S3</h3><p>➥ Let us export the snapshot to S3.</p><ol><li>Select the created snapshot and click on the Actions.</li><li>Click on Export to Amazon S3 from the options.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_iYJ0SsKIZSbfjm0dsmTyg.png" /></figure><ul><li>Under Settings, give a name to identify the export:</li><li>Export Identifier: Enter snap-export-s3</li><li>Leave the Exported data as default.</li><li>Under the S3 destination, select the created S3 from the drop-down.</li><li>Under IAM Role, choose to create a new role from the drop-down and give a name to the role as export-iam-role.</li><li>Note: Do not select any other IAM role present. Choose to create a new role only.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*Yk1ev6AafnK8KDWpJqynAA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6FszF3ipn7xxR7knt0ZhXA.png" /></figure><ul><li>Select the created KMS key from the drop-down or enter the ARN that we noted while creating the key.</li><li>Note: There may be other keys present, select the one you created in previous steps.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxLWR969qYSPWIGzuU6B8g.png" /></figure><ul><li>Review all the settings and click on Export to Amazon S3.</li><li>This may take upto 20–25 minutes as it is exporting the whole database. You can see a Complete status once the export is done.</li></ul><p>Note: You will be seeing other exports also in the Export to Amazon S3 tab. The reason is, we cannot delete them. Ignore the other exports done, if you see them.</p><h3>Task 9. Check the exported data in Amazon S3</h3><ul><li>Once the export is completed, navigate to the created S3 Bucket.</li><li>You will be able to see a folder with the name of the export identifier.</li><li>When clicked on that, you can see 2 JSON files.</li><li>The First JSON file is the final report of the export task.</li><li>The Second JSON file gives us information about the individual table including overall size and the data type mappings.</li><li>You can see the SchoolDB database we created earlier.</li><li>The First JSON file is the final report of the export task.</li></ul><p>In this way, we can export the snapshots to S3.</p><p>Cross-Region Snapshot Exports: By default, you can export an RDS DB snapshot to an S3 bucket in the same AWS Region. However, if you need to export the snapshot to an S3 bucket in a different AWS Region, you can leverage the AWS Data Pipeline service. It allows you to create a pipeline that copies the snapshot to a different region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uR9ApgstV5HYF69Jig7L9Q.png" /></figure><p>This is how the RDS snapshot is successfully exported to S3 bucket.</p><p>Don’t forget to delete the RDS database and S3 bucket to prevent you from incurring costs.</p><p><em>Dear Friends, Thank you for reading all the way through. I hope you liked the blog.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad3b0d63f5bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/exporting-rds-snapshot-to-s3-ad3b0d63f5bf">Exporting RDS Snapshot to S3</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon S3 Security Best Practices: A Practical Guide]]></title>
            <link>https://medium.com/awesomeaws/amazon-s3-security-best-practices-a-practical-guide-cee350562f0f?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/cee350562f0f</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Kevin Tuei]]></dc:creator>
            <pubDate>Fri, 03 Nov 2023 23:57:55 GMT</pubDate>
            <atom:updated>2023-11-03T23:57:55.245Z</atom:updated>
            <content:encoded><![CDATA[<p>When it comes to cloud storage options, Amazon S3, or Simple Storage Service, is a name that keeps coming up top.</p><p>It’s more than just a storage service; it’s a cornerstone of Amazon Web Services (AWS), offering robust and versatile object storage. Each object, be it a file or a piece of data, is securely stored with its metadata and is assigned a unique identification number. These objects are organized into containers known as “Buckets,” and the beauty of S3 lies in its globally unique naming system for these buckets, ensuring an organized hierarchy in the Amazon S3 namespace.</p><p>Additionally, Amazon S3 gives you freedom and control over your data by creating buckets in the region of your choosing. Since you can give these buckets specific rights to enable or prohibit data transfers based on your needs, access control is a breeze. S3 isn’t only for backups; it’s also a powerful solution for online archiving, using the same scalable infrastructure that drives Amazon.com’s extensive worldwide e-commerce network.</p><p>In this guide, you will learn how to use bucket policies, access points, and Block Public Access to secure your S3 buckets. Let’s get started</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/0*qI1oP1XDrNkc2BAV.png" /><figcaption>Users can test access to an S3 bucket using an SSH session from EC2 Instances</figcaption></figure><p><strong>#1 Require HTTPS</strong></p><p>Let’s start with creating a S3 Bucket Policy that requires connections to use HTTPS</p><p>From the AWS console, click Services and select S3.</p><p>Click the bucket name to which you want to apply this policy</p><p>Click on the Permissions tab.</p><p>Under Bucket Policy click Edit.</p><p>Copy the bucket policy below, and paste it into the Bucket Policy Editor.</p><pre>{<br>&quot;Version&quot;: &quot;2012-10-17&quot;,<br>&quot;Statement&quot;: [<br>{<br>   &quot;Action&quot;: &quot;s3:*&quot;,<br>   &quot;Effect&quot;: &quot;Deny&quot;,<br>   &quot;Principal&quot;: &quot;*&quot;,<br>   &quot;Resource&quot;: &quot;arn:aws:s3:::BUCKET_NAME/*&quot;,<br>   &quot;Condition&quot;: {<br>       &quot;Bool&quot;: {<br>        &quot;aws:SecureTransport&quot;: false<br>        }<br>    }<br>    }<br>  ]<br>}</pre><p>Replace arn:aws:s3:::BUCKET_NAME with the bucket ARN available above the Policy Heading above the editor. Make sure you do not delete the /* at the end of the bucket name. It should look similar to the policy below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*L-VBLslzsxzH1k2aAWfEtQ.png" /></figure><p>Click Save changes</p><p>An attempt to access an object on the bucket using HTTP would result in the error below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*PdK4BsAwnN5v2Cg8u3frnw.png" /></figure><p>A successful attempt to access an object on the bucket using HTTPS would result in the message below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*qujO1DCKquL7dp0U8fLK3w.png" /></figure><p><strong>#2 Require SSE-S3 Encryption</strong></p><p>In this section, we will now create an S3 Bucket Policy that requires data at rest encryption.</p><p>From the AWS console, click Services and select S3.</p><p>Click the bucket name to which you want to apply this policy</p><p>Click on the Permissions tab.</p><p>Under Bucket Policy click Edit.</p><p>Copy the bucket policy below, and paste into the Bucket Policy Editor.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: &quot;s3:PutObject&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::BUCKET_NAME/*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringNotEquals&quot;: {<br>                    &quot;s3:x-amz-server-side-encryption&quot;: &quot;AES256&quot;<br>                }<br>            }<br>        }<br>    ]<br>}</pre><p>Replace arn:aws:s3:::BUCKET_NAME with the bucket ARN available above the Policy Heading above the editor. Make sure you do not delete the /* at the end of the bucket name. It should look similar to the policy below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*HMcI7pyx8ypUhCKkaDz2bw.png" /></figure><p>Click Save changes</p><p>An attempt to put an object that is not encrypted using SSE-S3 encryption as required by your bucket policy to the bucket should fail as shown in the error below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*tyCwy8mQay8qZFWTZ7887Q.png" /></figure><p>The command that results in the output below succeeded because the PUT operation on the bucket used SSE-S3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*mazDqGwhUA1WXJEd8UKBKQ.png" /></figure><p><strong>#3 Block Public ACLs</strong></p><p>We will now demo the use of block public ACLs.</p><p>In this section, we will now create an S3 Bucket Policy that requires data at rest encryption.</p><p>From the AWS console, click Services and select S3.</p><p>Click the bucket name to which you want to apply this policy</p><p>Click on the Permissions tab.</p><p>Under Bucket Policy click Edit.</p><p>Copy the bucket policy below, and paste it into the Bucket Policy Editor.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: [<br>                &quot;s3:PutObject&quot;,<br>                &quot;s3:PutObjectAcl&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::BUCKET_NAME/*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringEquals&quot;: {<br>                    &quot;s3:x-amz-acl&quot;: &quot;private&quot;<br>                }<br>            }<br>        }<br>    ]<br>}</pre><p>Replace arn:aws:s3:::BUCKET_NAME with the bucket ARN available above the Policy Heading above the editor. Make sure you do not delete the /* at the end of the bucket name. It should look similar to the policy below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*24EqikWB_ZNpRMFCJgDm_A.png" /></figure><p>Click Save changes</p><p>This bucket policy allows ACLs that are private but does not DENY anything.</p><p>It is important to <em>write policies that prevent actions</em>, <em>not allow it when trying to restrict actions against a bucket. </em>This bucket policy also allows Public access to the bucket <em>unintentionally</em> due to the Principal being a wildcard.</p><p>We will now replace the existing policy with the following DENY policy. Don’t forget to replace arn:aws:s3:::BUCKET_NAME with the bucket ARN available above the Policy Heading above the editor. Make sure you do not delete the /* at the end of the bucket name.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: [<br>                    &quot;s3:PutObject&quot;,<br>                    &quot;s3:PutObjectAcl&quot;<br>                    ],<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::sid-security-7a041a90-7a6c-11ee-861a-0a590db4d40d/*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringEquals&quot;: {<br>                    &quot;s3:x-amz-acl&quot;: [<br>                           &quot;public-read&quot;,<br>                           &quot;public-read-write&quot;,<br>                           &quot;authenticated-read&quot;<br>                    ]<br>                }<br>            }<br>        }<br>    ]<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*gcpNqhZqiQ2VOmuhEQahww.png" /></figure><p>The request to put an object using a public-read ACL fails as the bucket policy now restricts public-read ACL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*ACCOPNH16jsqP0ST4peArg.png" /></figure><p>A PUT Object request should succeed since the default for an object ACL is private.</p><p><strong>#4 Configure S3 Block Public Access</strong></p><p>In this part, we will configure S3 Block Public Access, which is a straightforward way to prevent public access to your bucket.</p><p>From the AWS console, click Services and select S3.</p><p>Click the bucket name to which you want to block public access</p><p>Click on the Permissions tab.</p><p>Under Bucket Policy click Delete in case there is a bucket policy present. You may save the policy in a text editor in case you need to restore the policy.</p><p>Type Delete and click Delete to confirm.</p><p>Under Block public access (bucket settings) click Edit.</p><p>Select Block all Public Access.</p><p>Click Save changes.</p><p>Type confirm to confirm the new settings then click Confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*d_uim601vD6ejUmC7IX0lQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*N4V9QgCnyuJmhzBw2ssSXw.png" /></figure><p>The request to put an object using a public-read ACL fails as the bucket policy now restricts public-read ACL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*ACCOPNH16jsqP0ST4peArg.png" /></figure><p>A PUT Object request should succeed since the default for an object ACL is private.</p><p><strong>#5 Restrict Access to a S3 VPC Endpoint</strong></p><p>S3 VPC endpoints allow access to S3 resources from within a VPC and are easy to configure, highly reliable, and provide a private connection to S3 that does not require an Internet Gateway or NAT instance.</p><p>In this section, we will configure a S3 VPC Endpoint and a bucket policy to limit access to only requests that go through the VPC Endpoint.</p><p>From the AWS console, click Services and select VPC.</p><p>Click Endpoints on the left panel.</p><p>Click Create Endpoint.</p><p>Enter a Name tag of your choice</p><p>Select AWS services as the <strong>Service category</strong></p><p>Under <strong>Services</strong>, type S3 in the search bar and press enter in order to filter to the list of S3 endpoint services. Select the <strong>Service Name</strong> with the <strong>Type</strong> of Gateway.</p><p>Under VPC, select the VPC that you would like to limit access to only clients in that particular VPC. Your configuration should look similar to below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7evl7nPyOPOXBFp_FFFcA.png" /></figure><p>Do not configure any route tables. Leave the Policy set to Full Access.</p><p>Click Create endpoint.</p><p>Copy the VPC Endpoint ID to your text editor.</p><p>From the AWS console, click Services and select S3.</p><p>Click the bucket name to which you want to restrict access</p><p>Click on the Permissions tab.</p><p>Under Bucket Policy click Edit.</p><p>Copy the bucket policy below and paste into the Bucket Policy Editor.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Action&quot;: &quot;s3:*&quot;,<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::BUCKET_NAME/*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringNotEquals&quot;: {<br>                    &quot;aws:sourceVpce&quot;: &quot;VPC_ENDPOINT_ID&quot;<br>                }<br>            },<br>            &quot;Principal&quot;: &quot;*&quot;<br>        }<br>    ]<br>}</pre><p>Replace BUCKET_NAME with the bucket name and VPC_ENDPOINT_ID with the Endpoint ID. It should look similar to the policy below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*FGEknqddynQ2gJUNoODJ1A.png" /></figure><p>Click Save changes.</p><p>A HeadObject request fails because there is no route table associated with the VPC Endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*CwXzMx7iH_oXPO3jwkpdRg.png" /></figure><p>From the AWS console, click Services and select VPC.</p><p>Click Endpoints on the column to the left.</p><p>The VPC Endpoint we created earlier should be selected. Click Actions and select Manage Route Tables.</p><p>Select the relevant Route Table ID in my case SID-routes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Za1seLnsrf1YbUo10br_Q.png" /></figure><p>The request now succeeds because you associated a route from a route table to the VPC Endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*Lvh7_09rXHF5XQqKBpvPQA.png" /></figure><p>Congratulations, you have successfully completed all the practice sections for Amazon S3 Security Best Practices. In this practical guide, you were able to successfully create a S3 Bucket Policy that requires connections to use HTTPS. You then went on to create a S3 Bucket Policy that requires data at rest encryption and demonstrate the use of block public ACLs. You thereafter configured S3 Block Public Access and finally limited S3 access to only clients in your VPC using a S3 VPC Endpoint.</p><p>There are two more ways to secure access to your Amazon S3 buckets:</p><p><strong>Using AWS Config Rules to Detect a Public Bucket</strong></p><p>For more information and an example of an AWS Config Rule for S3 following operational best practices, check the link below.</p><p><a href="https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-amazon-s3.html">https://docs.aws.amazon.com/config/latest/developerguide/operational-best-practices-for-amazon-s3.html</a></p><p><strong>Use Amazon Access Analyzer for S3</strong></p><p>To know more about reviewing bucket access using IAM Access Analyzer for S3, check the link below.</p><p><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-analyzer.html">Reviewing bucket access using IAM Access Analyzer for S3</a></p><p>If you found this post insightful, feel free to leave a clap and follow for more posts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cee350562f0f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/amazon-s3-security-best-practices-a-practical-guide-cee350562f0f">Amazon S3 Security Best Practices: A Practical Guide</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Amazon VPC Peering — A Practical Guide]]></title>
            <link>https://medium.com/awesomeaws/getting-started-with-amazon-vpc-peering-a-practical-guide-2521186a0981?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/2521186a0981</guid>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[vpc-peering]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Kevin Tuei]]></dc:creator>
            <pubDate>Sun, 29 Oct 2023 14:15:47 GMT</pubDate>
            <atom:updated>2023-10-29T14:15:47.033Z</atom:updated>
            <content:encoded><![CDATA[<h3>Getting Started with Amazon VPC Peering — A Practical Guide</h3><p>In order to transport traffic between two VPCs using private IPv4 or IPv6 addresses, you need to establish a networking link known as a VPC peering relationship.</p><p>We will create VPC peering links between VPCs A and B and C in this guide, demonstrating that traffic only travels between those VPCs that have direct peering links.</p><p>Keep in mind that the CIDRs of the three VPCs do not overlap. Matching or overlapping IPv4 CIDR blocks prevent VPCs from establishing a VPC peering connection.</p><p>For this guide, all resources are created in the US East (N. Virginia) us-east-1 region</p><p>To get started you can provision the pre-requisite resources using the Cloudformation Templates below in that order:</p><ol><li><a href="https://static.us-east-1.prod.workshops.aws/public/2459f8bb-2657-49d1-913d-7119d34131b8/static/foundational/cfn/pre-requisites.yaml">Pre-requisites Template</a></li></ol><p><a href="https://static.us-east-1.prod.workshops.aws/public/2459f8bb-2657-49d1-913d-7119d34131b8/static/foundational/cfn/multi-vpc-create-all-vpcs.yaml">2. Multiple VPCs Create all three VPCs</a></p><p>We have <strong>VPC A</strong>, <strong>VPC B,</strong> and <strong>VPC C</strong> with CIDR blocks of 10.0.0.0/16, 10.1.0.0/16 and 10.2.0.0/16. Each VPC has two public and two private subnets.</p><p>Each VPC has an EC2 instance in the private subnet located in the <strong>us-east-1a</strong> availability zone.</p><figure><img alt="An architectural diagram showing a VPC Peering Connection between VPC A, B and C" src="https://cdn-images-1.medium.com/max/1024/0*rQwxYDLhRXYF0Yzr.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2qSageHLu04CCwDUWBm0Rg.png" /><figcaption>VPC A, B and C on the AWS Management Console</figcaption></figure><h3><strong>Part A: Setup VPC A and VPC B Peering<br>Task 1: Create the Peering Connection Between VPCs A &amp; B</strong></h3><ol><li>In the VPC Dashboard click on <a href="https://console.aws.amazon.com/vpc/home?#PeeringConnections:sort=vpcPeeringConnectionId">Peering Connections</a></li><li>Click on <strong>Create peering connection</strong> in the right-hand corner</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OlYkhKyBCR1hGYjCw2TJrw.png" /><figcaption>Peering connection page on the AWS Management Console</figcaption></figure><p>3. Set up the VPC peering connection settings between VPC A and B as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*vS9XCg_PhWKY_Kd9F58uXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*eDlOvdcjfdvrWtRAOForbw.png" /></figure><p>4. Click on <strong>Create peering connection</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OXSRrIydjdFXQqNFJMptmA.png" /></figure><p>5. The peering connection will be in <em>Pending Acceptance</em> state.</p><p>6. Navigate under <strong>Actions</strong> and click <strong>Accept request. </strong>You should be able to see a screen similar to below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dLEePIIiTSnuwiJPRuKdzw.png" /><figcaption>VPC Peering Connection is established</figcaption></figure><p>7. Click on <strong>Modify my route tables now </strong>then Select the <em>check box</em> for the VPC A Private Route Table</p><p>8. Scroll down and click on <strong>Routes</strong> tab</p><p>9. Click <strong>Edit routes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sK0JhYpopGW_ozypjbxVMg.png" /></figure><p>10. Add route entry for VPC B with the CIDR range as10.1.0.0/16 and Peering Connection VPC A &lt;&gt; VPC B for the target</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bPI9ZqOC1hfm5thViEkB-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYEvpCuiL3yzxIU20WHgxw.png" /></figure><p>11. Using the same procedure as above, update the route table in VPC B by adding a route entry for <strong>VPC A</strong> with the CIDR range 10.0.0.0/16 as the Destination and VPC A &lt;&gt; VPC B as the target for VPC B Private Route Table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WOH0o6b7jE3lB6qFA_Dc5A.png" /><figcaption>Adding the Peering connection in the Route Table in VPC B</figcaption></figure><h3><strong>Task 2: Create the Peering Connection Between VPCs B &amp; C</strong></h3><p>Using the same procedure as Task 1 above, create the Peering Connection Between VPCs B &amp; C</p><p>Note the updates of the Route Tables as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRCvqKW0_SsvyJSzV_lc8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6B6MepNQyz2WaK96yIitw.png" /></figure><h3><strong>Task 3: Check Connectivity</strong><br>1. Check Connectivity from VPC A by navigating to the EC2 Console and performing the following:</h3><p>Select the VPC A Private AZ1 Server EC2 instance and click the <strong>Connect</strong> button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OIjI0x-PNHYTGa3SLpooTw.png" /><figcaption>Connecting to the VPC A Private AZ1 Server from the EC2 Console</figcaption></figure><ol><li>Click <strong>Connect</strong> from the <strong>Session Manager</strong> tab and ping EC2 instances in <strong>VPC B</strong> and <strong>VPC C</strong> using the private addresses of those instances using the command below:</li></ol><blockquote>ping 10.1.1.100 -c 5<br>ping 10.2.1.100 -c 5</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*G54V4kNVIldnos7PosaU5Q.png" /><figcaption>Successful ping of both instances</figcaption></figure><p>Terminate the session manager once done with the connectivity tests, the browser tab will close automatically.</p><p>Congratulations on establishing a peering architecture that connects VPC A to VPC B and VPC C while preventing VPC B and VPC C from talking with one another!</p><p>Numerous VPCs can be connected using this method, but at scale, maintaining a large number of point-to-point connections might be difficult. Using AWS Transit Gateway is a more scalable method.</p><h3><strong>Task 4: Cleaning Up the Resources</strong></h3><p>Delete VPC A &lt;&gt; VPC CVPC Peering Connection as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*3zi5hF5d6Qh11GnO7sSuWw.png" /></figure><p>Delete VPC A&lt;&gt; VPC B VPC Peering Connection as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*hb_GQxRP7kaEibgIMGZJsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wyxdDtYGjXIf1BRfsTeDhQ.png" /></figure><p>Since you created the VPCs, NAT Gateway, and the EC2 Instances, using a Cloudformation template, don’t forget to delete the stacks for the associated resources to be deleted.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2521186a0981" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/getting-started-with-amazon-vpc-peering-a-practical-guide-2521186a0981">Getting Started with Amazon VPC Peering — A Practical Guide</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a 2-tier Amazon VPC using Terraform]]></title>
            <link>https://medium.com/awesomeaws/how-to-create-a-2-tier-amazon-vpc-using-terraform-169bcc7ef942?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/169bcc7ef942</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[vpc]]></category>
            <dc:creator><![CDATA[Kevin Tuei]]></dc:creator>
            <pubDate>Sun, 29 Oct 2023 14:14:06 GMT</pubDate>
            <atom:updated>2023-10-29T14:14:06.866Z</atom:updated>
            <content:encoded><![CDATA[<p>VPC is a powerful feature of AWS that allows you to build secure, isolated, and customizable network environments in the cloud, giving you full control over your network architecture and enabling seamless integration with other AWS services.</p><h3>Introduction to Amazon VPC</h3><ul><li>VPC stands for <strong>Virtual Private Cloud</strong>.</li><li>It’s a custom-defined virtual network within the AWS Cloud.</li><li>Users can logically create their personal network, designing and implementing a separate and independent network that would operate in the AWS Cloud.</li><li>Primary components are Subnets, IP addresses, NAT Devices (Instances and Gateways), Route Tables, Internet and Virtual Private Gateways, Access Control Lists, Security groups, and VPC Endpoints.</li><li>A subnet is a segment of the VPC IP address range, where we can launch EC2 Instances, RDS, and other AWS resources.</li><li>Subnets can be further classified as Public Subnets and Private Subnets.</li><li>When you create an Amazon AWS VPC, you specify a set of IP addresses in the form of a Classless Inter-Domain Routing (CIDR) block E.g. 10.0.0.0/16</li><li>You can assign a single CIDR block to a VPC. The allowed block size is between a /28 netmask and /16 netmask. The VPC can contain from 16 to 65,536 IP addresses.</li></ul><h3>Introduction to Terraform</h3><ul><li>It is an open-source IaaC (Infrastructure as a code) software tool that allows you to define and create resources using providers in the declarative configuration language example JSON.</li><li>With Terraform, you can package and reuse the code in the form of modules.</li><li>It supports a number of cloud infrastructure providers such as AWS, Azure, GCP, OCI…</li><li>Terraform has four major commands:</li></ul><pre>terraform init</pre><pre>terraform plan</pre><pre>terraform apply</pre><pre>terraform destroy</pre><h3>Prerequisite</h3><p><strong>Terraform Installation</strong></p><ul><li>Install Terraform on your local machine using either of the following official guides by Hashicorp.</li><li>To install Terraform using CLI, <a href="https://learn.hashicorp.com/tutorials/terraform/install-cli">use this guide</a></li><li>To install Terraform by downloading, <a href="https://www.terraform.io/downloads.html">use this guide</a></li></ul><p><strong>Visual Studio Code Installation</strong></p><ul><li>Download and Install Visual Studio Code editor using this guide <a href="https://code.visualstudio.com/download">https://code.visualstudio.com/download</a></li></ul><p>Create a Working folder for this guide using Visual Studio Code</p><p>The working folder I am using is called <strong>task_10000_vpc</strong></p><p>Create variables files where you will declare all the global variables with a short description and a default value</p><p>Create a file named <strong>variables.tf</strong> within the working folder and add the following lines to the file:</p><pre>variable &quot;access_key&quot; {<br>    description = &quot;Access key to AWS console&quot;<br>}<br>variable &quot;secret_key&quot; {<br>    description = &quot;Secret key to AWS console&quot;<br>}<br>variable &quot;region&quot; {<br>    description = &quot;Region of AWS VPC&quot;<br>}   </pre><p>What is happening is that you are declaring a variable called, <em>access_key</em>, <em>secret_key</em>, and <em>region</em> each with a short description</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*X5Ks59QaNHVA8CwIK5VskA.png" /><figcaption>variables.tf file created in the folder task_10000_vpc working folder</figcaption></figure><p>Create a file named <strong>terraform.tfvars </strong>within the working folder and add the following lines to the file:</p><pre>region = &quot;us-east-1&quot;<br>access_key = &quot;&lt;YOUR AWS CONSOLE ACCESS ID&gt;&quot;<br>secret_key = &quot;&lt;YOUR AWS CONSOLE SECRET KEY&gt;&quot;</pre><p>Remember to replace &lt;YOUR AWS CONSOLE ACCESS ID&gt; and &lt;YOUR AWS CONSOLE SECRET KEY&gt; with their respective values retrievable from the IAM Console.</p><p>Details on how to access your Access Key and Secret Key can be found in this AWS Documentation: <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html">Managing access keys for IAM users</a></p><h3>Create VPC and its components</h3><p>Create a file named <strong>main.tf </strong>within the working folder and add the following lines to the file:</p><pre>provider &quot;aws&quot; {<br>     region     = var.region<br>     access_key = var.access_key<br>     secret_key = var.secret_key<br>}<br>resource &quot;aws_vpc&quot; &quot;vpc&quot; {<br>    cidr_block = &quot;10.0.0.0/16&quot;<br>}   </pre><p>In this case, you are defining provider as aws and defining resource block using <strong>aws_vpc</strong> for creating an Amazon VPC having CIDR Block as <strong>10.0.0.0/24</strong></p><p>Add the following lines after aws_vpc resource block:</p><pre>resource &quot;aws_internet_gateway&quot; &quot;gateway&quot; {<br>    vpc_id = aws_vpc.vpc.id<br>}<br>resource &quot;aws_route&quot; &quot;route&quot; {<br>    route_table_id         = aws_vpc.vpc.main_route_table_id<br>    destination_cidr_block = &quot;0.0.0.0/0&quot;<br>    gateway_id             = aws_internet_gateway.gateway.id<br>}<br>data &quot;aws_availability_zones&quot; &quot;available&quot; {}<br><br>resource &quot;aws_subnet&quot; &quot;main&quot; {<br>   count                   = length(data.aws_availability_zones.available.names)<br>   vpc_id                  = aws_vpc.vpc.id<br>   cidr_block              = &quot;10.0.${count.index}.0/24&quot;<br>   map_public_ip_on_launch = true<br>   availability_zone       = element(data.aws_availability_zones.available.names, count.index)<br>}</pre><p>These lines will instruct terraform to:</p><ul><li>Creating an Internet gateway and attaching it with the VPC.</li><li>Adding route as 0.0.0.0/0 and destination as an Internet gateway.</li><li>Checking all the present availability zones.</li><li>Creating subnets in all the present availability zones.</li></ul><p>Confirm the installation of Terraform by running the below command to check the version:</p><pre>terraform version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*qfuX14ps7XJOO2gZcNeG5g.png" /></figure><p>If you are getting output as <em>command not found: terraform</em>, this means that terraform is not installed on your system, To install terraform follow the official guide link provided in the Prerequisite section above.</p><p>Initialize Terraform by running the below command:</p><pre>terraform init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*6ZUVe8Smsd2vzX3qTLjGDA.png" /></figure><p><em>terraform init</em> will check for all the plugin dependencies and download them if required, this will be used for creating a deployment plan.</p><p>To generate the action plans, run the below command:</p><pre>terraform plan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aoir4peToWnsPuB0PMUMRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlM5JG-629b1mu6FgjhT-w.png" /></figure><p>To create all the resources declared in <strong>main.tf</strong> configuration file, run the below command:</p><pre>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GhS5dWgzN5rB1xG0F-DBEg.png" /></figure><h3>Verify the resources created in the AWS Console</h3><ol><li>Navigate to VPC by clicking on Services under the Networking &amp; Content Delivery section.</li><li>Click on Your VPCs from the left menu.</li><li>Verify that the Custom VPC is present.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQFYQnzsK3KSixbLdI4ZeA.png" /></figure><p>4. To verify the Subnets were created, click on the Subnets option from the left sidebar.</p><p>5. All the present subnets are of both the VPC, i.e., Default VPC and Custom VPC.</p><p>6. Apply the filter of Custom VPC by clicking on the Search bar and selecting VPC as Properties and VPC ID of custom VPC as VPC values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q20SoaVTe8bxf5yz8ZpiEw.png" /></figure><p>Congratulations! You have created a 2-tier Amazon VPC using Terraform.</p><p>Cleaning up Resources</p><p>Delete the resources created by Terraform by running the below command:</p><pre>terraform destroy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*j5muWKnw4ZA74Q9Xlc7j4g.png" /></figure><p>Liked the post? Follow me for more and share the post with the community.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=169bcc7ef942" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/how-to-create-a-2-tier-amazon-vpc-using-terraform-169bcc7ef942">How to create a 2-tier Amazon VPC using Terraform</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to DevOps]]></title>
            <link>https://medium.com/awesomeaws/introduction-to-devops-d098a7d5057a?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/d098a7d5057a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[infrastructure]]></category>
            <dc:creator><![CDATA[Asma Akram]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 14:03:05 GMT</pubDate>
            <atom:updated>2023-10-26T14:03:05.908Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is DevOps:</h3><p>🚀 DevOps is a revolutionary methodology where Software Development(Dev 👨💻) Team and Operations(Ops 👨💻) team, work together in collaboration 🤝</p><p>DevOps enables faster and more reliable delivery of high-quality software to end-users 😎</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/0*XE6kwmOZnpDtG-G2" /><figcaption>Figure: DevOps Infinity Cycle with different phases</figcaption></figure><p>We can understand DevOps with a real-life analogy. Let’s relate Software Development to cooking a delicious meal 🍱. Here we consider Developers as the Chefs 👩🍳 in a five-star hotel who creates and prepare innovative recipe (i.e. code) and Operations as the hotel staff 👨🍳 who is responsible for serving the dish (i.e. deploying and maintaining software).</p><p>DevOps acts like a perfect recipe that guides both teams, ensuring they follow the same instructions and create a consistent and delicious dish.</p><h3>What is Automation, Scaling, and Infrastructure:</h3><p><strong>Automation </strong>🚀: Automation means to accelerate the tedious, manual task. DevOps Engineers use scripts and automation tools to automate manual and repetitive tasks. eg Dishwasher an Automation tool which automates the task of washing dishes with the hand, making dishwashing a quick task.</p><p><strong>Scaling </strong>🚀: Scaling means ability to handle workloads when the demand increases such as Big billion-day sale of Amazon and when the demand of resources decreases, the resources are minimized</p><p><strong>Infrastructure </strong>🏠 : Infrastructure in DevOps means that managing infrastructure with the help of code. Infrastructure must be robust and carefully designed to support the software applications effectively.</p><h3>Why is DevOps Important?</h3><ol><li>It maximizes efficiency with automation</li><li>Shorter development cycles and faster innovation.</li><li>Reduce implementation failure, and recovery time.</li><li>Better communication and collaboration.</li><li>Scalability and agility.</li></ol><p><em>Thank you for being a part of our community! Before you go:</em></p><ul><li><em>Be sure to </em><strong><em>clap</em></strong><em> and </em><strong><em>follow</em></strong><em> the writer! 👏</em></li><li><em>You can find even more content at </em><a href="http://freecloudlabs.com/"><strong><em>FreeCloudLabs.Com</em></strong></a><strong><em>🚀</em></strong></li><li><em>To Contribute join our </em><a href="https://discord.gg/cd74GaXS"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d098a7d5057a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/introduction-to-devops-d098a7d5057a">Introduction to DevOps</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secure Connections Using Bastion Host]]></title>
            <link>https://medium.com/awesomeaws/secure-connections-using-bastion-host-51bed02df74c?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/51bed02df74c</guid>
            <category><![CDATA[bastion-host]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[cloud-with-harry]]></category>
            <dc:creator><![CDATA[Harpreet Siddhu]]></dc:creator>
            <pubDate>Fri, 26 May 2023 16:05:17 GMT</pubDate>
            <atom:updated>2023-09-25T03:16:39.413Z</atom:updated>
            <content:encoded><![CDATA[<h4>DevOps Guide — How To</h4><h4>Learn Everything You Need To Know</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*SE3fnPd0VseoB1gq8t9Q-A.png" /><figcaption>Secure Connections Using Bastion Host</figcaption></figure><p>A bastion host is a special server whose purpose is to provide access to the private network from an external internet-facing network. Commonly used as SSH proxy servers for administrators and provide a secure and convenient path to connect to private servers.</p><h3>How Does Bastion Host Work?</h3><p>In AWS, a bastion host runs on an EC2 instance hosted typically in a public subnet of your Amazon VPC. The instance is set up with a security group that allows SSH to it from anywhere over the internet.</p><blockquote><strong><em>As a security best practice, access to the bastion host must be limited to authorized users.</em></strong></blockquote><p>To connect to EC2 instances hosted in the private subnet which are then set up with the security group to allow SSH from the bastion host. Once the inbound rule is set up correctly in the security group and added to EC2 instances, you can use SSH to connect to private EC2 instances using your private access keys.</p><p>But using a key pair with a Bastion host is a little challenging because connecting to the private Linux instance from the Bastion host would require you to have a private key available on the Bastion host and the best practice is to not store your access keys on the Bastion hosts.</p><p>The solution to this problem is to use SSH Agent Forwarding on the client. The SSH Agent forwarding feature allows a local SSH agent to reach through an existing SSH connection and authenticate on a remote server.</p><h3>Solution Architecture</h3><p>The diagram shows configuring the bastion host in your AWS VPC cloud. The bastion host runs on an Amazon EC2 instance and is typically hosted in the public subnet of your VPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BF0pHejcS36TgU2eTMBHeA.png" /></figure><p>The Linux instances are in a subnet that is not publicly accessible, and they are set up with a security group that allows SSH access from the security group attached to the underlying EC2 instance running the bastion host.</p><p>First, a Bastion host user connects to the Bastion host using simple SSH or via SSH agent forwarding. SSH agent forwarding allows using the local SSH keys instead of leaving keys (without paraphrases!) sitting on the server (Bastion host). As a best practice, you should not have your access key sit on the host machine facing the internet.</p><p>So, after connecting to the Bastion host, the SSH agent forwards your existing auth schema to the remote host (Linux server in the private subnet) and then authenticates you securely like you were on your local computer.</p><h3>Solution Implementation in AWS</h3><p>For the sake of this experiment, we can use the default VPC and the us-east-1 region. In the default VPC, we get public subnets only so we would need a private subnet to launch our private Linux instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sC29QAkeNd0fqsgg" /></figure><blockquote><em>In AWS, the default VPC IPv4 CIDR range is 172.31.0.0/16, and default subnets within a default VPC are assigned /20 netblocks within the VPC CIDR range.</em></blockquote><h3>Steps To Create Required Resources -</h3><h3>STEP 1: Create a Private Subnet</h3><p>First, create a private subnet in the existing default VPC. The next available CIDR block that you can use is shown below. I have created this private subnet in the US-East-1B availability zone. In this example, I’m planning to keep my public and private in different AZs just for testing but you can keep them in the same AZ if you would like to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/0*o-SocqBqcnUdo6Of" /></figure><p>Now we have 6 — public subnets in each availability zone in us-east-1 and one private subnet in us-east-1b.</p><h3>STEP 2: Private Route Table:</h3><p>By default, the private subnet will be associated with the main route table.</p><ol><li>A route for all destinations belongs to the IP address range 172.31.0.0/16, and,</li><li>A route to the Internet i.e. 0.0.0.0/0 via an Internet gateway.</li></ol><p>Since private instances in the private subnet can only have one local route i.e. all the destinations in the IP address range 172.31.0.0/16, so it’s a good idea to create a private route table for the private subnet.</p><p><strong>Create a Private Route Table</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*bnsut23ICGObNWA6zfH6nw.png" /></figure><p><strong>Associate Private Route Table To Private Subnet</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*bFcnPFV_nNN9t7RQC6ExkQ.png" /></figure><h3><strong>STEP 3: Security Group</strong></h3><p>Let’s create security group for the Private Instances hosted in a private subnet in our us-east-1b AZ.</p><p><strong>SG for Private Instances:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q_hm7zTYhyuoqUEJcqS8wg.png" /></figure><ol><li><strong>Inbound:</strong> Since these are hosted in a private subnet, we can allow inbound SSH connection to these instances from instances with network IP addresses within the VPC CIDR range i.e. 172.31.0.0/16 (default VPC).</li><li><strong>Outbound:</strong> None</li></ol><p><strong>SG For Bastion Host:</strong></p><ul><li><strong>Inbound: </strong>Allow inbound SSH connection from anywhere i.e. 0.0.0.0/0 (internet).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XUvnhi6tZVmgXLBoYqPvjw.png" /></figure><ul><li><strong>Outbound: </strong>Allow outbound SSH connection to network IP addresses within the VPC CIDR range i.e. 172.31.0.0/16 (default VPC).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AQlte-wQ4IOivGHj" /></figure><h3>STEP 4: Launch Instances</h3><p>Next, launch two EC2 instances. One in a public subnet us-east-1a, and one in the private subnet us-east-1b as shown above in the diagram.</p><p><strong>Bastion Host EC2 Instances Configuration -</strong></p><ol><li>Instance name — Bastion Host</li><li>AMI<em> </em>— Amazon latest AMI</li><li>Instance type — t2 Micro</li><li>Key-Pair<em> </em>— Create a new one or use the existing one.</li><li>Network Setting — See the below image.</li><li>Everything else is as default and launch the instance.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*yNvCTSo8O-7u2FZly8HjTQ.png" /></figure><p><strong>Now, for the second EC2 instance, use this option as shown below -</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oKP7yEo0vorQyFWn850H_w.png" /></figure><p>After you click on this, you will see all the settings and the default will be pre-filled for you. Make the following changes and launch a second instance -</p><ol><li>Name: Private Instance</li><li>Select the same key pair you choose or create for the first EC2</li><li>Update network settings and keep other things default and launch the instance.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*ac0zDeeiqxcA9LdHC3zNqw.png" /></figure><h3>STEP 5: Connect To Bastion Host</h3><h3>Mac Users:</h3><ol><li>Open Terminal and locate the folder where you have your access keys.</li><li>Run ‘ssh-add -K your-accesskeys.pem’. This will add your access keys to the agent and lets you use SSH to connect to an instance without having to use the ‘–i your-Accesskeys.pem’ option when you connect.</li><li>Run ‘ssh -A ec2-user@&lt;IP Address or DNS name&gt;’ to connect to the bastion host.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/0*T3U49W0PqOnVYtW5" /></figure><h3>Window Users:</h3><p>In Windows, you can connect to Linux VPC instances using PuTTY. Here is its <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">download page</a>. (64-bit x86: <a href="https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.78-installer.msi">putty-64bit-0.78-installer.msi</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*nWEKbHyCkMJSItVu-axGLw.png" /></figure><p>After installing this, you can use the agent forwarding option in PuTTY to connect to instances in private subnets without giving the private key.</p><ol><li>The first step is to convert your private key from PEM to PuTTY format using PuTTYGen.</li><li>Now open Peageant and add your private key.</li><li>Open PuTTY and check the “agent forwarding option” in Auth.</li><li>Open the SSH connection to the Bastion host and leave the Private key file for the authentication field empty.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/0*MEdre2Rh5WYYy0xQ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*GrZWMNP_e2dtEg4z" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*hlI2u8Pju9968wmXEGUXpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*-EiySbZJD6a6FDvP4uEKDg.png" /></figure><h3>STEP 6: Connect To Private Hosts</h3><ol><li>Run ‘ssh ec2-user@&lt;IP Address or DNS&gt; to connect with a private Linux instance.</li><li>Try to run ‘sudo yum update all’ or ‘ping google.com’ to see if you can connect to the internet from the private Linux instances.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*rY147FfhvsFhs6vaPqaK3A.jpeg" /></figure><p>As you can see, we can interact with our Private Instance through the Bastion Host, however, it is still cut off from the internet. We don’t want to just open it up to the internet now because that would defeat all the work we just put in to secure our network. Instead, we will add a NAT Gateway to our public subnet and update our private subnet routing table to allow instances to connect to the Internet securely. We will also need to update the private instances security group to allow outbound traffic.</p><blockquote><strong><em>A NAT Gateway is an AWS service that allows a private subnet to have access to the Internet but prevents the Internet from initiating a connection directly to the instances.</em></strong></blockquote><h3>Updated Architecture Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YgtzmbBNdqJYhyX1kuCb9A.png" /></figure><p><strong>Add NAT Gateway as shown below -</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*lFm1xYqoGAkyzUu4C_Dh2g.jpeg" /></figure><p><strong>Update Route Table associated with Private Subnet</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YW3s5XxwG8aNKw1fnUWoqg.jpeg" /></figure><p><strong>Add Outbound Rule In Private Hosts Security Group</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-nTo5Ws53XOmeiQTvqfqQ.jpeg" /></figure><h3>STEP 7: Test The Solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*TuUh1tLAufEF2fXxqviO1g.jpeg" /></figure><p><strong>Congratulations! </strong>We have created and configured a bastion host to connect to our private server to receive updates.</p><h3>STEP 8: Clean Up</h3><ol><li>Terminate EC2 Instances. You can stop them in case you want to do more testing later and avoid EC2 charges. Remember that you will still incur some charges related to the EBS volume attached to your EC2. Read <a href="https://aws.amazon.com/ebs/pricing/">this</a> for more information.</li><li>Delete NAT Gateway. This will take some time so make sure that it’s deleted before you proceed to #3.</li><li>Release Elastic IP address.</li></ol><p>Resources like security groups, subnets, access keys, route tables, etc are free and you won’t need to pay to use those services in AWS. You can keep them or delete them as well.</p><h3>Conclusion</h3><p>In conclusion, a bastion host is a crucial security measure for any organization utilizing cloud computing infrastructure, particularly in the Amazon Web Services (AWS) Virtual Private Cloud (VPC). It acts as a single point of entry into the private network and serves as a secure gateway to other instances in the private network. It’s important to tighten security rules when using Bastion hosts in AWS based on the needs and It’s always recommended to regularly review and update your security groups to ensure that your infrastructure remains secure over time.</p><p>Would be great to know how you plan to implement a bastion host in your organization’s AWS VPC, and what steps will you take to ensure that your security rules are tight and your infrastructure remains secure.</p><p>Share your thoughts and strategies in the comments below. Thanks, Harry!</p><blockquote><strong><em>Do you know there is another popular way to connect to EC2 instances using Session Manager (a feature of Systems Manager) instead of using ssh?</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51bed02df74c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/secure-connections-using-bastion-host-51bed02df74c">Secure Connections Using Bastion Host</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS CloudShell: A Browser-Based Shell To Access AWS Resources]]></title>
            <link>https://medium.com/awesomeaws/aws-cloudshell-a-browser-based-shell-to-access-aws-resources-4c9468efbe34?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/4c9468efbe34</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[aws-cloudshell]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-shell]]></category>
            <dc:creator><![CDATA[Harpreet Siddhu]]></dc:creator>
            <pubDate>Fri, 26 May 2023 16:05:03 GMT</pubDate>
            <atom:updated>2023-05-02T14:18:50.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/752/0*c0IzMOJv_5TKfO6U" /><figcaption>AWS CloudShell — A Browser Based CLI Tool</figcaption></figure><p>As a cloud administrator/engineer/developer, you might have used the AWS CLI most of the time to create, update, delete, or manage your AWS resources. It’s a powerful and developer-friendly tool to interact with AWS. The AWS service APIs are so cool and working with them using CLI helps you to understand them in a much better way compared to using the services via the AWS management console.</p><p>Unfortunately, using AWS CLI need a one-time setup and sometimes it needs you to refresh your keys after expiry. You must run ‘AWS Configure’ to set up the CLI on your local terminal. Configuring AWS CLI requires you to save your access keys on your computer and god forbid if any bad actor gets your access keys, it can be disastrous. Moreover, if you have to use multiple AWS accounts, reconfiguring the CLI or even setting the AWS configure profile would be a tedious, time-consuming job sometimes. And say, if your access keys have a TTL then setting them up again and again is a little frustrating.</p><p><strong>AWS CloudShell is there for the rescue.</strong></p><p>Let’s learn about it and see how can we use AWS CloudShell and increase productivity.</p><blockquote><em>We cannot completely avoid using access keys. For local development work, you might still need access keys. For example, setting up AWS plugin on the IDE.</em></blockquote><h3>What is AWS CloudShell?</h3><p>AWS CloudShell is a browser-based shell that you can access directly from your AWS management console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/0*6vk8EvbudUJWGcSr" /><figcaption>Access CloudShell From Here</figcaption></figure><p>CloudShell pre-authenticates the access on the shell which runs on an Amazon Linux computing environment. It provides pre-installed developer tools, browser-based download and upload options, and persistent storage between multiple login sessions to the shell. If you don’t want to persist your session data, you can always delete the /home directory and clean up the resources after using CloudShell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hIMTat95Up7KONyO" /><figcaption>AWS CloudShell</figcaption></figure><h3>CloudShell Features</h3><h3>1. Support of Multi Shell Environment:</h3><p>CloudShell support all different shells that you are familiar to work with. For example, you can very easily switch between ‘Bash’ to ‘Powershell’ to “Z Shell”. See below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*Aiw4xOC-2BtNh52w" /><figcaption><em>CloudShell Supports Bash, PowerShell, and ZSH</em></figcaption></figure><p>2. Development Tools:</p><p>It comes with many pre-installed utilities for developers like -</p><ol><li>AWS CLI</li><li>Python</li><li>Node</li><li>npm</li><li>git</li><li>bash Utilities</li><li>pip, sudo, zip, and many more.</li></ol><h3>3. CloudShell Environment Resources:</h3><p>When CloudShell is launched, a computing environment is assigned with the following resources -</p><ul><li>1 vCPU (Virtual central processing unit)</li><li>2 GiB RAM</li><li>1 GB of persistent storage</li></ul><p>The persistent storage of up to “1 GB in each AWS region” at no additional cost. Storage is available in the $HOME directory and it’s private for the user.</p><p>IMPORTANT: Storage is regional. For example, data stored in ‘us-east’ will not be available if you switch the region and start a CloudShell session in ‘us-west’.</p><blockquote><em>The data in the persistent storage in any region will last for 120 days from the last session. After 120 days, the data automatically deleted from the region.</em></blockquote><h3>4. CloudShell Security</h3><p>The following security features are available to the users -</p><ul><li>Permission management — Using Identity &amp; Access Management</li><li>Shell management — Auto stop and recycle user inactive session after 20–30 mins. All active sessions can last for a maximum of 12 hours.</li><li>Safe Paste is enabled default — For the multiline paste, safe paste notifies users if they want to review the script for malicious scripts and take any action execution.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*WO1hufVumveIrig-" /><figcaption>Default Safe Paste Option</figcaption></figure><h3><strong>5. Command Size</strong></h3><p>The maximum command size in AWS CloudShell is 65412 Characters. For commands longers than 65412, we can create a shell command script file or a Python script to run the commands -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/0*iFJ7cQykzeazjRi7" /><figcaption>python script to mass execute shell commands</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*52TkSJthW1_LIkAe" /><figcaption>Running shell commands using Python script</figcaption></figure><h3>6. Network Access &amp; Data Transfer</h3><ul><li><strong>Egress — </strong>Traffic to the internet is allowed.</li><li><strong>Ingress — </strong>no access to inbound ports from the Internet.</li></ul><blockquote><em>IAM administrators can create a custom policy using the </em>“<strong>AWSCloudShellFullAccess</strong>”<em> managed policy as a template to manage the action of IAM users/roles/federated identities in the CloudShell.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/0*LQkyol-WwA3ektRY" /><figcaption>Visual Editor to create a custom CloudShell policy</figcaption></figure><p><strong><em>“putCredentials” </em></strong><em>— Without “putCredentials”, the user would need to manually configure their credentials using the “AWS Configure” command to access AWS resources.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QsKog0U8GaYQOWMW" /><figcaption>Listing S3 Bucket without putCredential throwing error in CloudShell</figcaption></figure><p>This CloudShell permission would allow the user to use the CloudShell environment however, explicit permission will be required for the user to access the AWS services from Cloudshell. For example, if the user does not have permission to list S3 buckets then “aws s3 ls” won’t work. An explicit permission policy would be required to be attached to the identity in the IAM console.</p><h3>CloudShell In Action</h3><p><a href="http://github.com/hsiddhu2/learn-aws-labs/tree/main/Simple/CloudShell">Click Here</a> to see cloudShell CLI in action.</p><h3>Conclusion</h3><p>Based on my experience working with AWS CloudShell, I believe it is a convenient and secure way for AWS users to manage their resources using a browser-based CLI environment. Its pre-installed tools, persistent environment, integration with AWS services, and secure isolation from the user’s local machine make it an advantageous option over the traditional AWS CLI for managing and monitoring AWS resources. Additionally, I appreciate that it provides a seamless experience and eliminates the need for local installations. The automatic credential forwarding also allows users to focus on their work without worrying about configuring their CLI, setting environment variables, or updating their access keys after the session expiry.</p><p>Have you personally used AWS CloudShell, and if so, what is your experience been like? Are there any specific advantages or features that you find particularly helpful?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c9468efbe34" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/aws-cloudshell-a-browser-based-shell-to-access-aws-resources-4c9468efbe34">AWS CloudShell: A Browser-Based Shell To Access AWS Resources</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Migrate External Domain DNS Service to AWS Route 53]]></title>
            <link>https://medium.com/awesomeaws/how-to-migrate-external-domain-dns-service-to-aws-route-53-9769e4c744c7?source=rss----6a1b44e18bc---4</link>
            <guid isPermaLink="false">https://medium.com/p/9769e4c744c7</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[route-53]]></category>
            <category><![CDATA[dns-servers]]></category>
            <category><![CDATA[domain-registration]]></category>
            <dc:creator><![CDATA[Harpreet Siddhu]]></dc:creator>
            <pubDate>Fri, 26 May 2023 16:04:14 GMT</pubDate>
            <atom:updated>2023-05-12T14:07:59.672Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*h0RIG0qfyU4Z7cybze2w0g.png" /><figcaption>Migrate/Change External DNS Service to AWS Route 53</figcaption></figure><p>Do you have a domain name that you purchased from registrars like <a href="https://www.namecheap.com/?aff=99072">Namecheap</a>, GoDaddy, <a href="http://digitalharpreet.com/go/bluehost">Bluehost</a>, etc. in the past that is probably not in use (inactive) and now you might be looking to host a website using it with the minimum possible cost?</p><p>If yes, then read this post because today I’m going to show you how you can use an external domain name and migrate the registrar’s DNS to AWS Route 53. This process will eventually help you utilize that domain in AWS to host a simple web app or a static website for just $0.50 — $1.00 per Month.</p><p>Disclaimer: Price may vary based on your AWS services usage. A simple static website can be hosted for just $0.50 — $1.00 per month.</p><h3>What is a domain name?</h3><p>A domain is an easy-to-remember, user-friendly name which maps to an IP address to access a web server from the client machine. In plain English, it is a text that we type in the browser to reach any website on the internet. For example, ‘google.com’ is a domain name that we use to reach Google servers.</p><p>The actual IP address of a website is a complex numerical address like 35.153.63.85 which is very hard to remember but thanks to DNS or Domain Name System which help users to use domain names and can route traffic to web servers. In AWS, Route 53 is a globally distributed DNS service that translates custom human-readable domain names into IP addresses.</p><h3>What is DNS?</h3><p>DNS stands for Domain Name System. It’s a group of globally distributed database servers that act as a “Phonebook” for the whole Internet and maps a domain name/subdomain name to the device’s IP address. This group of database servers works together by delegating the request to another server to resolve the domain name to the IP address. The actual process of resolving a domain name is complex and involves querying multiple name servers but DNS also maintains a cache of widely used resolved domains at a different layer for faster discovery. I won’t go into more details of how exactly it works but here is an infographic that explains the process on a high level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/0*VNyXWBokbjZF3s8r" /><figcaption>Figure: 1 How Route 53 routes traffic for your domain</figcaption></figure><p>Intro To AWS Route 53?</p><p>AWS Route 53 is a highly available, scalable Domain name web service. It’s an AWS-managed service where you can manage all your DNS records to connect your AWS resources to domain names.</p><p>It can be used to perform three main functions -</p><ol><li>Domain Registration or Transfer</li><li>DNS Routing</li><li>Health checks on resources</li></ol><p>When you register a domain name using Route 53, the service automatically provides the DNS service for your domain. The DNS service is provided by Route 53 by creating a “hosted zone” for your domain. Once it creates a hosted zone, a set of four services are assigned to your domain name and configured as Domain Name Servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PnT-UHBfqfPqTmIt" /><figcaption>Figure 2: Hosted Zone — Set of name servers</figcaption></figure><p>This set of four servers is responsible to resolve the domain name, say — example.com to AWS resources like an application load balancer, S3 bucket static website endpoint, cloud front distribution endpoint, or any other AWS resource with the IP address.</p><h3>Common DNS Records In Route 53</h3><ol><li>A Record: Route traffic to a web server using an IPv4 address in dotted decimal format. For example — 192.0.2.1</li><li>AAAA Record: Route traffic to a web server using an IPv6 address in hexadecimal format. For example — 2001:0db8:85a3:0:0:8a2e:0370:7334</li><li>CNAME Record — Route traffic from a sub-domain to a domain name. For example, it would route traffic from <a href="http://www.example.com/">www.example.com</a> to the apex or naked domain name example.com.</li><li>Alias records: Alias records let you route traffic to selected AWS resources like CloudFront distribution and Amazon S3 bucket. Unlike CNAME, you can create an alias record for the zone apex (example.com) and route traffic to the sub-domain (www.example.com), provided that there is no CNAME record present for the sub-domain(www.example.com).</li></ol><h3>Points to Remember:</h3><ol><li>The DNS protocol does not allow you to create a CNAME record for the top node of a DNS namespace, also known as the zone apex. For example, if you register the DNS name example.com, the zone apex is example.com. You cannot create a CNAME record for example.com, but you can create CNAME records for <a href="http://www.example.com,/">www.example.com,</a> newproduct.example.com, and so on.</li><li>If you create a CNAME record for a subdomain, you cannot create any other records for that subdomain. For example, if you create a CNAME for <a href="http://www.example.com,/">www.example.com,</a> you cannot create any other records for which the name field’s value is <a href="http://www.example.com./">www.example.com.</a></li></ol><h3>Steps to Migrate DNS From Third Party to AWS Route53</h3><p>Now that you have some basic understanding of domain name and DNS and the benefits of using Route 53 as a DNS service, we can now learn how to migrate DNS service from any third-party DNS provider to Route 53. Please note that migrating DNS is relatively a simple process, but it should be done carefully to avoid any downtime to your application.</p><blockquote><em>Domain registrars and DNS services both are two different things. Most domain registrars provide DNS services as an additional service along with domain registration.</em></blockquote><p>Before we go into migration steps, I just want to clear up how you can get DNS services:</p><ol><li>Domain name registrars can offer DNS hosting services as an additional service along with domain registration.</li><li>Web Hosting providers</li><li>Dedicated DNS Hosting (Route 53).</li></ol><h3>Scenario 1: Brand New Domain from External Registrar to Route 53</h3><p>To begin the process, it is necessary to have a registered domain name that is not managed through Route 53. While you can typically register a domain name using Route 53 for a cost ranging from $9.00 to $13.00 for most top-level domains (TLDs), there are occasions when you can find the same domain names at lower prices from third-party registrars such as <a href="http://digitalharpreet.com/go/namecheap">Namecheap</a>. Currently, Namecheap is running a special promotion where new customers can obtain a “.COM” domain for just $5.98 by using the promo code NEWCOM598.</p><p>Therefore, if you are experimenting and require a domain name for hands-on usage in AWS, you can purchase an inexpensive domain from a registrar outside of Route 53. Later on, you can migrate the DNS to Route 53 to utilize it within your AWS Account. Let’s get started.</p><h3>Step 1: Domain Name</h3><p>In this tutorial, I’m using one of the domains “example.com” that I had registered at Namecheap long back but never used to host any website. I will be using it for this experiment.</p><h3>Step 2. Create a Hosted Zone in Amazon Route 53</h3><p>Route 53 allows you to create a “Hosted Zone” which is a container where you will keep all your DNS records to define how you would like the traffic to route from the domain name and its subdomain names.</p><p>To create hosted zone:</p><p>Log in to your AWS account and click on “Services” and under “Networking and Content delivery” you will see “Route 53”. Since Route 53 is a regional service, it can be accessed from any AWS region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/0*0bT96gOPgRMUedha" /><figcaption>Figure: 3 Route 53 — Networking And Content Delivery</figcaption></figure><p>Next, click on the Hosted Zone and fill out the domain name, description, type, and Tags (optional). Since you want the domain to get the traffic from outside the VPC, select “Public hosted zone”. Once you have the required information, click on “Create Hosted Zone”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*A0JG3FAJL-i0NUJa" /><figcaption>Figure 4: Create Public Hosted Zone In Route 53</figcaption></figure><p>As soon as you create the public hosted zone for your domain, AWS Route 53 will add 2 records to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZLp8NRkP260zBDex" /><figcaption>Figure: 5 Public Hosted Zone NS and SOA Records in Route 53</figcaption></figure><p>NS Record: It is the name server record, and it will list 4 name servers as “Authoritative Name Servers”. The authoritative name servers store the most up-to-date information about the domain and their associated IPs and provide recursive resolvers with the final answer to the user queries.</p><ul><li>SOA Record: It is called the Start of Authority record. It identifies the base DNS administrative information about the domain.</li></ul><pre>FYI, With Private Hosted Zone, you can use any domain name and you don&#39;t <br>need to register a domain mainly because the domain is created under <br>the &quot;Private Hosted Zone&quot; and traffic is only limited to your own VPC.</pre><p>If you want to read more about these records, <a href="https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html">click here</a>.</p><h3>Step 3. Update Name Servers and point them to AWS Name Servers</h3><p>The final step is to update the default name servers on the domain registrar portal and point them to the AWS Route 53 public-hosted zone-provided name servers. The name servers that you see above in Figure: 5 are what you would need in this step. In my case, I bought this domain from Namecheap.com and I would go and update the name servers after logging into my user account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mfHSz5xwnzhDenHK" /><figcaption>Figure 6: Basic DNS Name Servers at Namecheap.com</figcaption></figure><p>Click on the dropdown and choose custom DNS and add 4 name server records from Route 53 public hosted zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/0*lqW08lKW7m6RpCsE" /><figcaption>Figure 7: Add Custom DNS Records</figcaption></figure><p>For easy access to name server names in AWS Route 53, open the public hosted zone of the domain and click CHECK BOX in front of the NS record as shown below, and copy the value by clicking the icon highlighted in “yellow” to avoid any typo error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*niZmqzsg4Q8r_bkp" /><figcaption>Figure 8: Public Hosted Zone Route 53 NS and SOA Records</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SVmHmLUA3ndsKkv2" /><figcaption>Figure 9: Custom DNS From Route 53</figcaption></figure><p>As soon as you are done updating custom Name Servers, your domain will be pointed to the AWS Route 53 public hosted zone provided Name Server records.</p><h3>Step 4. Verify Migration</h3><p>To verify migration was performed successfully -</p><ul><li>Check the propagation of the domain’s Name Server using <a href="https://dnschecker.org/ns-lookup.php">DNSChecker.org/ns-lookup</a>. This change happens fairly quickly and just after you save your custom Name Servers from Route 53 in the domain registrar account, you would see that your domain is now pointing to AWS Route 53 Name Servers.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*q5ozDIO2xKMPsRP0" /><figcaption>Figure 10: DNSChecker.org/ns-lookup.php</figcaption></figure><p>You can also check if your domain is resolved to the correct IP address through “<a href="https://www.whatsmydns.net/">WhatsMyDNS</a>”. This tool helps you perform the DNS lookup to check a domain name’s current IP address and DNS record information against multiple nameservers in different parts of the world. Since we have not added any A record in the public hosted zone, DNS lookup won’t show anything.</p><h3>Scenario 2: Existing Domain from Third Party Web Host to AWS Route 53 Using DNS Zone File</h3><p>If your website is currently hosted with a third-party hosting provider like HostGator or Bluehost, and you want to migrate only the DNS service to AWS Route 53 to take advantage of its benefits and ensure a seamless migration without losing any of your existing DNS records, you can make use of the existing DNS zone file from the cPanel of your current website hosting provider.</p><p>Some providers allow you to download the zone file directly from c-panel, but some might not have that option available like HostGator. If that’s the case with your provider, then read the below article -</p><p><a href="https://support.crucial.com.au/en/knowledgebase/article/download-a-dns-zone-file-from-cpanel">How to download DNS zone file from c-panel.</a></p><p>Once you have access to the DNS zone file then follow the below steps -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8ybnbQXsFYMk0xEM" /><figcaption>Figure 11: Import Existing DNS Zone File</figcaption></figure><p>Create a public hosted zone in Amazon Route 53 (See Step 2 above).</p><ol><li>Import the DNS zone file in Route 53 hosted zone using the import option as shown in Figure 11. In case of errors in importing the file, you can add those records manually also by clicking on “Create Record”.</li><li>Make sure all your DNS records are successfully migrated to Route 53 before moving on to the next step. Forgetting to add any records can result in website downtime.</li><li>After verifying everything, update the domain name servers on the third-party hosting account (See Step 3 above).</li><li>Verify Migration (See Step 4 above).</li></ol><h3>Next Steps:</h3><p>Next, we will see how to host a public website from an S3 bucket utilizing CloudFront distribution and restricting public access to S3 origins by utilizing “Origin Access Control” settings. We will also see how to encrypt the connection between the client and the origin by enabling HTTPS using a free public SSL/TLS certificate from Amazon Certificate Manager (ACM).</p><h3>Conclusion</h3><p>Migrating DNS from a third-party provider to AWS Route 53 is a straightforward process, but it can be a bit confusing if you are unfamiliar with DNS services and how they are provided when you purchase a domain name. DNS is an additional service that comes bundled with a domain name or is offered by your web hosting provider, and it can be migrated. However, it is crucial to execute the migration carefully to prevent any potential downtime, especially if your website experiences high traffic.</p><p>To ensure a smooth transition, it is essential to pay close attention and ensure that all your DNS records are successfully transferred from your previous provider to AWS Route 53 before making any changes to the “Name Servers” currently associated with your domain. By taking these precautions, you can minimize the risk of disruptions and ensure a seamless DNS migration.</p><p>I hope you enjoy the read! Please let me know if you have any questions in the comments and please share your experience specifically related to downtime and disruptions during the migration process. Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9769e4c744c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awesomeaws/how-to-migrate-external-domain-dns-service-to-aws-route-53-9769e4c744c7">How To Migrate External Domain DNS Service to AWS Route 53</a> was originally published in <a href="https://medium.com/awesomeaws">FreeCloudLabs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>