<?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[Stories by Archit Bidkar on Medium]]></title>
        <description><![CDATA[Stories by Archit Bidkar on Medium]]></description>
        <link>https://medium.com/@architbidkar_66467?source=rss-df383d6b8020------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Archit Bidkar on Medium</title>
            <link>https://medium.com/@architbidkar_66467?source=rss-df383d6b8020------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 09:32:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@architbidkar_66467/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AWS EC2 Connect: Another way to SSH into Private Servers]]></title>
            <link>https://medium.com/@architbidkar_66467/aws-ec2-connect-another-way-to-ssh-to-private-servers-ef478318a958?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef478318a958</guid>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-in-plain-english]]></category>
            <category><![CDATA[towards-aws]]></category>
            <category><![CDATA[aws-security]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 11:41:01 GMT</pubDate>
            <atom:updated>2025-01-30T11:41:25.631Z</atom:updated>
            <content:encoded><![CDATA[<p>A few days ago, one of my colleagues asked me what will be an alternative to SSH into a private server if SSM fails. My initial thoughts were to restart the server, check ports &amp; network related connectivity. But for some reason, all these didn’t help. To make situation even worse, the key used for this was lost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*GMcLY_oxwYLZwfVPOdVXRQ.jpeg" /></figure><p>Then I thought, why not use EC2 Connect endpoint. AWS did introduce this service for securely accessing private servers via public IPs. After some digging, trail &amp; error, steps that helped to resolve this issue are —</p><ol><li>Launch an EC2 in private subnet &amp; without any key pair</li><li>Create a new security group, but don’t add any rules in it as of now</li><li>Launch the instance &amp; wait for it be online</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-YLjNg6n4gFdB_PGP4GmqQ.jpeg" /><figcaption>EC2 configurations on initial launch</figcaption></figure><p>Now comes the next step. As this is a private server, to access it, we will use SSM.</p><p>4. For this we will create a new IAM role &amp; add SSM + EC2 endpoint <em>(can be added later during endpoint steps)</em> related policies in it. My role looks like —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6zbgvJsD7hsAkfcowSg19A.png" /><figcaption>IAM Role polices</figcaption></figure><p>5. Now add this IAM role to your EC2 instance &amp; try to connect via SSM. You will get an error —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A78VkrWg2wZMNy7qBwvtrw.jpeg" /><figcaption>SSM Agent is unreachable</figcaption></figure><p>6. Let’s <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-with-ec2-instance-connect-endpoint.html">create </a>EC2 endpoint. Go to VPC &gt; Endpoints &gt; EC2 Instance Connect Endpoint &gt; Choose VPC &amp; Subnets &gt; In SG, choose the one we create during server launch &gt; Create</p><p>7. Now till Endpoint gets created, open its SG &amp; add —</p><p>a. Port 22 from IP range of your EC2 region. You can find list of all in this <a href="https://github.com/joetek/aws-ip-ranges-json/blob/master/ip-ranges-ec2-instance-connect.json">link</a>.</p><p>b. Another entry for Port 22, but this time referencing own SG, i.e. ID of security group you are editing.</p><p>So finally, SG looks like —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZA8iUKqOgNR1P5yDiMFFQ.jpeg" /><figcaption>Security Group entries</figcaption></figure><p>8. Now let’s check if endpoint is created or not &amp; its status. If completed, it will show status as Available, else Pending. We can describe it using CLI command —</p><pre>aws ec2 describe-instance-connect-endpoints --instance-connect-endpoint-ids endpoint_id</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*KfKI1NR6SQQ9sB7Giuox1Q.jpeg" /><figcaption>After Endpoint is Available, above CLI command will give output as per image</figcaption></figure><p>9. Once it’s online head back to EC2 console &amp; click Connect &gt; EC2 Instance Connect &gt; Connect using EC2 Instance Connect Endpoint &gt; choose your endpoint ID &amp; user name &gt; Connect</p><p>In few moments, you will be getting access to your server without need of any key or SSM agent or even adding your own IPs in SG</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JjZLy9xq5x6Bxh0OQhAe8Q.jpeg" /></figure><h3>Conclusion:</h3><p>In summary, the ability to SSH into a private server from a public IP without the need for a .pem key, SSM agent or opening ports for your IP showcases the remarkable reliability of AWS EC2 Connect endpoints. This achievement underscores the potential of EC2 Connect as a dependable solution for accessing private servers when traditional methods or SSM agents fall short. By leveraging EC2 Connect, organizations can enhance their remote server management capabilities, ensuring seamless and secure access to their private infrastructure.</p><p>References —</p><p><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-with-ec2-instance-connect-endpoint.html">Connect to your instances using EC2 Instance Connect Endpoint</a></p><p><a href="https://github.com/joetek/aws-ip-ranges-json/blob/master/ip-ranges-ec2-instance-connect.json">ip-ranges-ec2-instance-connect</a></p><p><a href="https://www.youtube.com/watch?v=tzXtbW4tQBg">Connect to Your Instances Without Requiring Public Ipv4 Address Using EC2 Instance Connect Endpoint</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef478318a958" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better Security: How to Get Notified Immediately When an AWS User Signs Into the Console]]></title>
            <link>https://medium.com/@architbidkar_66467/better-security-how-to-get-notified-immediately-when-an-aws-user-signs-into-the-console-0908a5343b35?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/0908a5343b35</guid>
            <category><![CDATA[aws-eventbridge]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[aws-security]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Sun, 09 Jun 2024 14:19:09 GMT</pubDate>
            <atom:updated>2024-06-09T14:19:09.082Z</atom:updated>
            <content:encoded><![CDATA[<p>With so many companies moving to the cloud for better performance, reliability &amp; availability, security too, comes into play. Many of the companies have stringent security policies &amp; certain benchmarks that they need to meet. So today, let’s check one of the security rules that can be implemented in AWS cloud — Getting notified when a user signs into the Management Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*JDO-BKCEZF0jvTHuXGP-Rg.jpeg" /><figcaption>Architectural Diagram</figcaption></figure><p><strong>Overview</strong></p><p>The above diagram shows how we will get notified when a user signs into our AWS console. We will be using the following services —</p><ol><li>CloudTrail</li><li>Eventbridge</li><li>SNS</li><li>CloudWatch</li><li>SQS</li></ol><p><strong>Step 1: Enable CloudTrail</strong></p><p>Before we proceed with any further, ensure that you have an IAM user with admin rights. We need to create many resources, so Admin user will be helpful.</p><p>To enable CloudTrail, you can follow the steps from this <a href="https://mng.workshop.aws/cloudtrail/setup.html">page</a>. Do follow the steps in the section ‘Create a Trail in CloudTrail’. Rest can be ignored.</p><p>My current CloudTrail setup looks like —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwREbiloAc1OMo20gxEVfw.png" /><figcaption>CloudTrail configuration</figcaption></figure><p>Note: Enable multi-region. No need for data events.</p><p><strong>Step 2: Set up SNS</strong></p><p>Next, create a SNS topic that we will use. Subscribe to the topic. You can choose Email or SMS or any other delivery method. Do ensure you have successfully subscribed to a topic by sending sample events using the ‘Publish Message’ option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aadlq3ogUZ8_LDEmpckE-g.png" /></figure><p><strong>Step 3: Create SQS</strong></p><p>Now we will create a SQS queue which will act as a Dead Letter Queue to capture all failed event deliveries from our Event rules. This means, if for some reason the Event rule is not able to send our message/ event to the target system, it will send it to this DLQ.</p><p>Eg — One of my events failed to get forwarded to the target system as EventBridge was not having SNS permission that could make calls to KMS for encryption/ decryption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnAV7MWOSKXKof5NYe-lqA.png" /><figcaption>DLQ SQS</figcaption></figure><p><strong>Step 4: Create Rules in EventBridge</strong></p><p>Now, we will use the default EventBus. We will make 2 rules — one for Root login &amp; another for IAM user login. A rule to capture all events coming into EventBus for logging in CloudWatch will be used in both.</p><p><strong>4.1: Root user Rule</strong></p><p>Create new Rule &gt; Enter details &gt; In rule type choose — ‘Rule with an event pattern’ &gt; Next</p><p>In ‘Sample Event type’, choose ‘AWS Events’ &gt; ‘Sample events’ and choose ‘AWS Console Sign In via CloudTrail’. This will load a sample event. Now, this exact event will be sent in a SNS message if we don’t make changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*_lH6Ye8BZRUWOafhdNyddQ.png" /><figcaption>Root Console Login</figcaption></figure><p>In ‘<strong>Creation method’ &gt; </strong>Custom pattern (JSON editor) &gt; Event pattern &gt; enter the below pattern. The pattern checks if the user who signs in is of type ‘Root’. If yes, then only the rule will be triggered.</p><pre>{<br>  &quot;source&quot;: [&quot;aws.signin&quot;],<br>  &quot;detail-type&quot;: [&quot;AWS Console Sign In via CloudTrail&quot;],<br>  &quot;detail&quot;: {<br>    &quot;userIdentity&quot;: {<br>      &quot;type&quot;: [&quot;Root&quot;]<br>    }<br>  },<br>  &quot;id&quot;: [{<br>    &quot;exists&quot;: true<br>  }]<br>}</pre><p>In Target &gt; Select Target &gt; CloudWatch Log Group. Choose an existing group or create a new one.</p><p>Click on ‘Additional Settings’ &gt; Dead-letter queue &gt; Select an Amazon SQS queue in the current AWS account to use as the dead-letter queue &gt; Select DLQ that you created in step 3.</p><p>Now click on ‘Add another Target’ &gt; Select Target &gt; SNS &gt; Topic &gt; the topic you created in step 2.</p><p>Click on ‘Additional Settings’ &gt; Configure target input &gt; Configure Input Transformer &gt; <strong>S</strong>ample event &gt; AWS Events &gt; ‘AWS Console Sign In via CloudTrail’. Next, in the Input path, enter this —</p><pre>{<br>  &quot;ConsoleLogin&quot;: &quot;$.detail.responseElements.ConsoleLogin&quot;,<br>  &quot;MFAUsed&quot;: &quot;$.detail.additionalEventData.MFAUsed&quot;,<br>  &quot;arn&quot;: &quot;$.detail.userIdentity.arn&quot;,<br>  &quot;awsRegion&quot;: &quot;$.detail.awsRegion&quot;,<br>  &quot;eventTime&quot;: &quot;$.detail.eventTime&quot;,<br>  &quot;sourceIPAddress&quot;: &quot;$.detail.sourceIPAddress&quot;,<br>  &quot;type&quot;: &quot;$.detail.userIdentity.type&quot;<br>}</pre><p>I am just taking fields that I felt were needed. You can choose other fields to include from the sample event that was generated. Next, in Template, put —</p><pre>&quot;User with type &lt;type&gt;, ARN as &lt;arn&gt; with Source IP &lt;sourceIPAddress&gt; has login result as &lt;ConsoleLogin&gt;. The region is &lt;awsRegion&gt;, event time in UTC is &lt;eventTime&gt; and MFA used is &lt;MFAUsed&gt;&quot;</pre><p>This will help us transform the JSON in a more human-readable manner. Then click on Generate Output to see what will be the final message. Then click confirm if there are no errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*b5V5slzJSGSbqQ48_DZv4Q.png" /><figcaption>Root user Input Template</figcaption></figure><p>Click on ‘Additional Settings’ &gt; Dead-letter queue &gt; Select an Amazon SQS queue in the current AWS account to use as the dead-letter queue &gt; Select DLQ that you created in step 3.</p><p>After this, add tags if needed, review &amp; create rules. The output —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GS6kxSLIANdplPta5lQuyg.png" /><figcaption>SNS Mail received for Root</figcaption></figure><p><strong>4.2: IAM User Rule</strong></p><p>Create new Rule &gt; Enter details &gt; In rule type choose — ‘Rule with an event pattern’ &gt; Next</p><p>In ‘Sample Event type’, choose ‘Enter my own’ &gt; enter this event.</p><pre>{<br>  &quot;version&quot;: &quot;0&quot;,<br>  &quot;id&quot;: &quot;b83308b1-2587-7e29-9ceb-3a74cf13d532&quot;,<br>  &quot;detail-type&quot;: &quot;AWS Console Sign In via CloudTrail&quot;,<br>  &quot;source&quot;: &quot;aws.signin&quot;,<br>  &quot;account&quot;: &quot;123456&quot;,<br>  &quot;time&quot;: &quot;2024-04-26T14:08:29Z&quot;,<br>  &quot;region&quot;: &quot;us-east-1&quot;,<br>  &quot;resources&quot;: [],<br>  &quot;detail&quot;: {<br>    &quot;eventVersion&quot;: &quot;1.08&quot;,<br>    &quot;userIdentity&quot;: {<br>      &quot;type&quot;: &quot;IAMUser&quot;,<br>      &quot;principalId&quot;: &quot;hjggud78977gdd&quot;,<br>      &quot;arn&quot;: &quot;arn:aws:iam::123456:user/user&quot;,<br>      &quot;accountId&quot;: &quot;123456&quot;,<br>      &quot;userName&quot;: &quot;user&quot;<br>    },<br>    &quot;eventTime&quot;: &quot;2024-04-26T14:08:29Z&quot;,<br>    &quot;eventSource&quot;: &quot;signin.amazonaws.com&quot;,<br>    &quot;eventName&quot;: &quot;ConsoleLogin&quot;,<br>    &quot;awsRegion&quot;: &quot;global&quot;,<br>    &quot;sourceIPAddress&quot;: &quot;1.2.3.4&quot;,<br>    &quot;userAgent&quot;: &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36&quot;,<br>    &quot;requestParameters&quot;: null,<br>    &quot;responseElements&quot;: {<br>      &quot;ConsoleLogin&quot;: &quot;Success&quot;<br>    },<br>    &quot;additionalEventData&quot;: {<br>      &quot;LoginTo&quot;: &quot;https://console.aws.amazon.com/console/home?hashArgs=%23&amp;isauthcode=true&amp;nc2=h_ct&amp;src=header-signin&amp;state=hashArgsFromTB_eu-north-1_8ac2b7f288a26970&quot;,<br>      &quot;MobileVersion&quot;: &quot;No&quot;,<br>      &quot;MFAUsed&quot;: &quot;No&quot;<br>    },<br>    &quot;eventID&quot;: &quot;49dd24f7-c105-4933-a116-0915445cb3f3&quot;,<br>    &quot;readOnly&quot;: false,<br>    &quot;eventType&quot;: &quot;AwsConsoleSignIn&quot;,<br>    &quot;managementEvent&quot;: true,<br>    &quot;recipientAccountId&quot;: &quot;123456&quot;,<br>    &quot;eventCategory&quot;: &quot;Management&quot;,<br>    &quot;tlsDetails&quot;: {<br>      &quot;tlsVersion&quot;: &quot;TLSv1.3&quot;,<br>      &quot;cipherSuite&quot;: &quot;TLS_AES_128_GCM_SHA256&quot;,<br>      &quot;clientProvidedHostHeader&quot;: &quot;signin.aws.amazon.com&quot;<br>    }<br>  }<br>}</pre><p>The IAM user event has a few additional fields, which are not shown if we use ‘AWS Console Sign In via CloudTrail’ as it shows for the Root user.</p><p>Next, Creation method &gt; Custom pattern (JSON editor) &gt; Event pattern. The pattern will check if the user type is IAM or not.</p><pre>{<br>  &quot;source&quot;: [&quot;aws.signin&quot;],<br>  &quot;detail-type&quot;: [&quot;AWS Console Sign In via CloudTrail&quot;],<br>  &quot;detail&quot;: {<br>    &quot;userIdentity&quot;: {<br>      &quot;type&quot;: [&quot;IAMUser&quot;]<br>    }<br>  },<br>  &quot;id&quot;: [{<br>    &quot;exists&quot;: true<br>  }]<br>}</pre><p>Click on ‘Test Pattern’ to validate settings &gt; click Next.</p><p>Rule settings for CloudWatch will be the same. No changes in that. After configuring it, Select Target &gt; SNS &gt; Topic &gt; the topic you created in step 2.</p><p>Click on ‘Additional Settings’ &gt; Configure target input &gt; Configure Input Transformer &gt; In ‘Sample Event type’, choose ‘Enter my own’ &gt; Copy the sample event for IAM user.</p><p>Next in Input path, enter —</p><pre>{<br>  &quot;ConsoleLogin&quot;: &quot;$.detail.responseElements.ConsoleLogin&quot;,<br>  &quot;MFAUsed&quot;: &quot;$.detail.additionalEventData.MFAUsed&quot;,<br>  &quot;awsRegion&quot;: &quot;$.detail.awsRegion&quot;,<br>  &quot;eventTime&quot;: &quot;$.detail.eventTime&quot;,<br>  &quot;sourceIPAddress&quot;: &quot;$.detail.sourceIPAddress&quot;,<br>  &quot;type&quot;: &quot;$.detail.userIdentity.type&quot;,<br>  &quot;userName&quot;: &quot;$.detail.userIdentity.userName&quot;<br>}</pre><p>Again, you can choose which fields can be included in the message from the sample event. In Template, enter —</p><pre>&quot;User &lt;userName&gt; logged in from &lt;sourceIPAddress&gt; at &lt;eventTime&gt; with type &lt;type&gt; in region &lt;awsRegion&gt; with Console Login result &lt;ConsoleLogin&gt; and MFA Used &lt;MFAUsed&gt;&quot;</pre><p>Now click on Generate Output to see if all configurations are correct &amp; click Confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0LrujYEUk_c4RyyUfkGjcQ.png" /><figcaption>IAM User Input Template</figcaption></figure><p>Follow the same steps as per 4.1 for setting DLQ &amp; then review &amp; create the rule. The output will be —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yafay6aagKAwRKjjjkMrEg.png" /><figcaption>SNS Mail received for IAM</figcaption></figure><p>That’s it. You will receive an alert whenever a user tries to sign into the console. The rule will check for login successes &amp; failures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dU-2Z7rDsPofskpC2mubcg.png" /><figcaption>Failed attempt email</figcaption></figure><p>Hope you like this article. Suggestions &amp;feedback are always welcome. 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0908a5343b35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplify Your Workflow: Mounting AWS S3 on Windows at Start with Rclone]]></title>
            <link>https://medium.com/@architbidkar_66467/simplify-your-workflow-mounting-aws-s3-on-windows-with-rclone-c58a7e6abe69?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/c58a7e6abe69</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[towards-aws]]></category>
            <category><![CDATA[aws-in-plain-english]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Sun, 31 Mar 2024 10:33:59 GMT</pubDate>
            <atom:updated>2024-09-01T09:05:35.902Z</atom:updated>
            <content:encoded><![CDATA[<p>We have different options from cloud providers to get an extra amount of storage over the limited local storage that we get. Google Drive, MS OneDrive, Dropbox are a few of the popular ones. But the catch is, that you have to pay for the storage block, rather than the actual amount you have used. Eg 5 Gb, 100 Gb, etc. That’s where AWS S3 is great. You pay only for the amount of storage that you use &amp; plus you get lots of different security as well as data management options. How about, mounting this S3 bucket to get <strong>near unlimited</strong> amount of storage on our PC?? Let’s see how.</p><p><em>Edit 1: Added steps to launch the program at system start</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*gqSzFH6NbzIgo-GobRWdRQ.png" /></figure><p><strong>AWS S3 Bucket</strong></p><p>To begin this, we need an AWS account. Along with this, we need a S3 bucket created in our account as well as an IAM user with admin access &amp; it’s keys. For people well versed in AWS, they can create keys for IAM user with least privileges like having access only to a particular S3 bucket rather than different services. Few links —</p><p><a href="https://repost.aws/knowledge-center/create-and-activate-aws-account">How do I create and activate a new AWS account?</a></p><p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">Creating an IAM user in your AWS account</a></p><p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey">Managing access keys for IAM users</a></p><p><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html">Create your first S3 bucket</a></p><p>Once you have all 4 of the above steps done, we will work on setting up Rclone. Keep handy — S3 bucket name, region, IAM user secret &amp; access keys as they will be needed.</p><p><strong>Setting up Rclone</strong></p><p>Download Rclone for windows</p><p>Extract the zip file</p><p>Make a new folder on drive. Some easy name like rclone or whatever makes sense to you</p><p>Copy the rclone.exe file to this newly created folder</p><p>Now open CMD or Powershell in admin mode &amp; navigate to this new folder</p><p>Run — .\rclone.exe config</p><p>Type “<strong>n</strong>” to create New remote option</p><figure><img alt="Setup new remote in Rclone" src="https://cdn-images-1.medium.com/max/421/1*uO68LulGcvdJHO3B3vOARQ.png" /></figure><p>Type a name that you want to use</p><p>Now select the type of cloud storage to configure. Type <strong>5</strong> to select Amazon S3 cloud storage.</p><figure><img alt="Choose option for S3" src="https://cdn-images-1.medium.com/max/1024/1*buDjqFh3EgHnENQ3xWXf5A.png" /></figure><p>To choose your S3 provider, type <strong>1</strong> to select Amazon Web Services S3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*4jgYkzXytvipmXCWcs3v9A.png" /></figure><p>For get AWS credentials from runtime, type <strong>1</strong> — Enter AWS credentials in next step</p><p>Enter your IAM user’s secret &amp; access keys</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*I6E0QXdWMSkposMaygs_4w.png" /></figure><p>In region, type the region where you have created your bucket. Eg, if your bucket is in N. Virginia, type <strong>1</strong></p><figure><img alt="Enter bucket region" src="https://cdn-images-1.medium.com/max/402/1*q94638kIcrHdzyN7BMF0iQ.png" /></figure><p>Now keep pressing Enter to use ‘<strong>Default</strong>’ value till we see Option ACL or Canned ACL. Here we choose <strong>1</strong></p><p>After that, keep pressing Enter to use ‘<strong>Default</strong>’ value till we see ‘<strong>Edit advanced Configs</strong>?’. For this, enter ‘<strong>n</strong>’</p><p>Check the configuration and type ‘<strong>y’</strong> if all details are correct</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*LNchHZE6iK-cfickNGEuTg.png" /></figure><p>Type <strong>q</strong> to exit the config wizard</p><p>At this stage, rclone is configured. Next, to mount it on Windows, we need few extra steps. <em>Do not close your CMD yet</em></p><p><strong>Mounting on Windows</strong></p><p>Download &amp; install WinFSP which allows you to create user mode file systems.</p><p>Now we will mount this newly created config in rclone on Windows</p><p>.\rclone mount name_you_enterted_in_rclone:actual_bucket_name/ drive_letter: — vfs-cache-mode full</p><p>So, this command when replaced with correct values, becomes —</p><pre>.\rclone mount sgbps3:seagate-bg-s3 S: - vfs-cache-mode full</pre><figure><img alt="Rclone started" src="https://cdn-images-1.medium.com/max/832/1*89fBo8OSWzggiPWRY01B1g.png" /></figure><p>If all details are correctly entered, you will see the message Rclone has been started. Check ‘<strong>This PC</strong>’ to ensure that S3 bucket is mounted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0d35z_XBkWxXS8MXBoeNw.png" /></figure><p>Now you can explore all files that are present in S3 &amp; also use it to move any files from local system too. Just ensure that you need to keep CMD open once rclone is started. After restarting the machine, you need to run the command again. To skip running the command on every start up, you can create a .bat file or make entry of it in start up options.</p><p><strong>Bonus: Launch this .bat file at Windows Start</strong></p><p>So, now that the .bat file is created, we will ensure that it loads the S3 bucket on Windows start. Steps are — <br>1. Go to C:<br>2. Enable the option to view Hidden files<br>3. Go to this path:</p><p>C:\Users\your_user_name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup<br>4. Place the .bat file in this location<br>5. Now restart the system &amp; check the launch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzpKcTqyoZ6UxOP5oScnQw.png" /><figcaption>Path to copy .bat file for Start-up</figcaption></figure><p><strong>Conclusion</strong></p><p>Hope you find this article helpful to mount S3 as a drive on Windows. Do keep in mind that you pay for the amount of storage you have used in S3. So keep checking AWS billing for details.</p><p>If the article needs some corrections or for feedback, share them via comments.</p><p><strong>References</strong></p><p><a href="https://blog.spikeseed.cloud/mount-s3-as-a-disk/#mounting-an-s3-bucket-on-windows-server-2016"><em>MOUNTING AN S3 BUCKET ON WINDOWS AND LINUX</em></a></p><p><a href="https://www.nakivo.com/blog/mount-amazon-s3-as-a-drive-how-to-guide/"><em>How to Mount Amazon S3 as a Drive for Cloud File Sharing</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c58a7e6abe69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect to Private AWS RDS instances via Windows EC2]]></title>
            <link>https://medium.com/@architbidkar_66467/connect-to-private-aws-rds-instances-via-windows-ec2-8aa8a13047ee?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/8aa8a13047ee</guid>
            <category><![CDATA[rds-mysql]]></category>
            <category><![CDATA[towards-aws]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Sat, 03 Feb 2024 13:32:38 GMT</pubDate>
            <atom:updated>2024-02-03T13:32:38.481Z</atom:updated>
            <content:encoded><![CDATA[<p>As a best practice, we always keep our databases private so that they are not publicly accessible. This prevents any data breaches or malicious attacks. As these database instances are private, using tools like <strong>Workbench</strong> or <strong>PgAdmin</strong> to connect and do actions from our local machines is not possible. We need to create a private server in the same AZ as the DB instance and then connect from the bastion server. Plus, using queries to do any database actions is quite tiresome. So how about using a Windows EC2 to connect with RDS and do all the actions? Let see how to do it.</p><p><strong>Creating VPC and its resources</strong></p><p>Create VPC, 1 public subnet, 1 private subnet, Internet Gateway and configure the Route tables. I have created these in the below shown configs. Associate Public Subnet with Public Route table and Private Subnet with Private Route table. In Public Route Table, choose it and add ‘Internet Gateway’ under the ‘Routes’ section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pqqky_1kWn2fxcDywF_DQg.jpeg" /></figure><p><strong>Create EC2 instance</strong></p><p>Now, let&#39;s create a Windows EC2 instance. Choose any Windows AMI you want. Choose the correct VPC. Then in Subnets, choose Public subnet. For security groups, create new security group as shown in below image. <em>Note: When creating, do not add RDS port. We will add it at a later time.</em></p><p>As a best practice, restrict RDP to your IP. We will need HTTPS to install tools in EC2. Once you create security group, create instance. Keep the key pair used while creation handy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_f3Dn51wU7I_ldDSGZQ2MA.jpeg" /></figure><p>Once the EC2 is in Available state, click on ‘Connect’, then choose RDP. Upload the keyfile.pem to get decrypted password. Copy Public IP, username and password. Then open remote desktop and enter the details as prompted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYX_PN24gW_fhcLsBpY9qA.jpeg" /></figure><p>Once you have logged in, download the MySQL Workbench in it. We will use it to perform database actions.</p><p><strong>Create RDS Instance</strong></p><p>Now, we will create RDS instance. For demo purpose, we will be using MySQL engine. Follow the below video for creation steps. For security group, we will need only one entry that too from <strong>private IP of EC2</strong> server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIR1S8OzqjUTA0UmDBt2MA.jpeg" /><figcaption>RDS Security Group</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8vnCbFflzDGVF4piwetww.gif" /><figcaption>RDS Creation steps</figcaption></figure><p>Once you click Create, it will take around 5–10 minutes to get created. Ensure that you choose the correct VPC and Security group while creating. As this is for testing purposes only, I have disabled most of the configurations. For production use, you will choose the configurations accordingly.</p><p>Now, to connect with RDS, we need to know the IP or endpoint of RDS that we will add in Security group of EC2. We can get these details as shown in screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qeMV-wQVGvaaeL7tADHxIA.jpeg" /><figcaption>To see username, password and endpoint</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QMj0H83OvTDbLVAd76TthQ.jpeg" /><figcaption>To get IP address of RDS</figcaption></figure><p>Get the IP address of RDS instance as shown above. Now, enter the Private IP address to security group of EC2. Port will be MySQL/ Aurora — 3306. Refer the screenshot shown for creation of EC2.</p><p><strong>Establish Connection between EC2 and RDS</strong></p><p>Once you have edited the EC2 security group, we will configure the MySQL Workbench in it. Install Workbench using all default settings. After installation, open it. Then click on Add new connection and enter the details. Choose ‘Store in vault’ for password so that you don’t need to keep entering it every time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpoRBYzyEprFYAm48E3eNw.jpeg" /><figcaption>Adding RDS Details</figcaption></figure><p>After adding the details, choose ‘Test Connection’. If all Routing and Security are correctly configured, it will show success. <em>If you get any errors, check networking and security group settings.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4mPZEirE_y6Ia3Oapc-6w.jpeg" /><figcaption>Testing settings</figcaption></figure><p>After entering the credentials, you can use that connection by double-clicking on it. From here, you can perform all MySQL-related actions. Check below video to understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQnOpNnnsKrf_tD8nWi8ng.gif" /></figure><p>Now that we have established connection between two servers, we can easily do all DB related actions. We can using the import/ export option of Workbench to import/ export data. With help of GUI, simple click can do actions rather than using commands over terminal.</p><p>As mentioned above, this is just for learning/ testing purpose. Security for Windows as well RDS instance can be further tightened depending on requirements. Similarly, in Production, RDS configurations will also change.</p><p>Hope this is helpful for everyone. <strong>Once done, delete all resources</strong>. For any suggestions/ improvements/ feedback do comment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8aa8a13047ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use AWS S3 Bucket as a Drive on Windows]]></title>
            <link>https://medium.com/@architbidkar_66467/use-aws-s3-bucket-as-a-drive-on-windows-77e553e08abe?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/77e553e08abe</guid>
            <category><![CDATA[aws-in-plain-english]]></category>
            <category><![CDATA[towards-aws]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Sun, 24 Sep 2023 10:31:01 GMT</pubDate>
            <atom:updated>2023-09-24T10:51:31.244Z</atom:updated>
            <content:encoded><![CDATA[<p>AWS S3 is popular storage option. Many organizations — MSMEs/ large/ enterprise use this storage on daily basis to store TBs worth of data. The biggest advantage of S3 is that it&#39;s reliable, robust, highly available and CHEAP. Yes, its quite cheap compared to other cloud storage providers.</p><p>We can use S3 bucket as network drive on Windows machine. This way we can easily transfer the data from our local drives to S3 without having the need to log into AWS Console. So let’s see how this can be done.</p><p><strong>Pre-requisites :</strong></p><ol><li>AWS Account</li><li>IAM User that can do IAM Actions and create S3 buckets</li></ol><p>First, login to your AWS account and create new IAM user. We will give this user the permission to access only the bucket that we will be using (use existing or create new bucket). If you want, you can give S3FullAccess permission which will grant the user all S3 privileges.</p><p>While creating the user, do give it access to Console and don’t attach any policies. Once user is created, create a new IAM policy with below JSON (<em>this policy will grant permission to only mentioned S3 bucket</em>) —</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;Action&quot;: [<br>                &quot;s3:GetBucketLocation&quot;,<br>                &quot;s3:ListAllMyBuckets&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::*&quot;<br>        },<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;s3:*&quot;,<br>            &quot;Resource&quot;: [<br>                &quot;arn:aws:s3:::bucket-name&quot;,<br>                &quot;arn:aws:s3:::bucket-name/*&quot;<br>            ]<br>        }<br>    ]<br>}</pre><p>Attach this policy to the created user. Now we will create Access keys for this user.</p><figure><img alt="Creating Access Keys" src="https://cdn-images-1.medium.com/max/1024/1*tPP9KjE1QEPVnj3ilXa90A.png" /></figure><p>When creating Access Keys, choose ‘Third Party Service’ &gt; check the Confirmation box &gt; click ‘Next’</p><figure><img alt="Choose type" src="https://cdn-images-1.medium.com/max/1024/1*K7jmHjFxU5SKLa9xDJ7UCw.png" /></figure><p>Once Access keys are created, ensure that you download the CSV file as these credentials are only shown once in console.</p><figure><img alt="Download Creds" src="https://cdn-images-1.medium.com/max/1024/1*KDRPVxTQDAgb_JsF8yQYyA.png" /></figure><p>Now we will download a software called ‘<a href="https://tntdrive.com/"><strong>TnT Drive</strong></a>’. This will help us to map S3 as a drive on our Windows machine. The free trial comes with 30 days access having full suite of opertations. After that, user needs to purchase license to continue using it. Download and install it.</p><p>Open the software and click on ‘Account’ &gt; ‘Add New Account’.</p><figure><img alt="Add Account in TnT" src="https://cdn-images-1.medium.com/max/710/1*G-ZJSyynnheCwie47rwuJg.png" /></figure><p>On ‘Add New Account’ window, add the details as required. Once all details are filled, click on ‘Add New Account’ at bottom.</p><figure><img alt="Info in Add new Account" src="https://cdn-images-1.medium.com/max/794/1*WmOYUj6Mcx_Lzn5b2cFT1w.png" /></figure><p>Once account is added, you can click on add drive button. Choose the account, which S3 bucket you want to map, which letter you want to assign to the drive.</p><figure><img alt="Add Mapped Drive1" src="https://cdn-images-1.medium.com/max/1024/1*KftQivfqBcXmG3bDUYZw9A.png" /></figure><p>On left bottom, click on ‘advance properties’. Here you can configure different option for mapped drive, caching and storage as required. One main thing to change here is the drive label. Enter a meaningful name as the pre-populated on is randomly generated.</p><figure><img alt="Add Drive 2" src="https://cdn-images-1.medium.com/max/1024/1*FAaHEnIAZCwGbDt9UtXBGA.png" /></figure><p>In the ‘Storage’ option, you can choose the S3 class in which you want to store the files. This is really helpful feature as you can directly transfer the files in required class rather than doing any life cycle policies from S3. You also have the option to Encrypt the data while in transit. Select it for better security. Once you have selected the options, click on ‘Close’ at right bottom &gt; ‘Add new Drive’ button at right bottom.</p><figure><img alt="Add Drive 3" src="https://cdn-images-1.medium.com/max/955/1*brO2x3pdb6T56wqX3SxNJQ.png" /></figure><p>Once the drive is added, you can open it to start transfering files from local drive to S3.</p><figure><img alt="After drive is added" src="https://cdn-images-1.medium.com/max/400/1*_RotKMYk2NEgF8GAmQr3aQ.png" /></figure><p>Alternately, you can open the drive even from File Explorer.</p><figure><img alt="Drive shown in File Explorer" src="https://cdn-images-1.medium.com/max/1024/1*f0onPdHPSqdi5qzxFeEzhQ.png" /></figure><p>Copy any file from local drive and paste it in S3 drive. I will paste the credentials that I had downloaded.</p><figure><img alt="Transfer File" src="https://cdn-images-1.medium.com/max/830/1*JlSVmIzvqUFeCkHxsbRZtQ.png" /></figure><p>Now check the AWS S3 console. The copied file will be shown there. As I selected Standard-IA class, my file was uploaded in that class.</p><figure><img alt="File seen in S3" src="https://cdn-images-1.medium.com/max/1024/1*u_muReHZdgAg66sNjplkAQ.png" /></figure><p>Let’s change the storage option of TnT to something else and check once again.</p><figure><img alt="Storage set to Glacier" src="https://cdn-images-1.medium.com/max/1024/1*x3C5wcTileRMTF4lof1uGg.png" /></figure><p>Again transfer a file and then check S3 console.</p><figure><img alt="File in S3 with Glacier class" src="https://cdn-images-1.medium.com/max/1024/1*IEP9EZmb0nkRzrJUIsEQUw.png" /></figure><p><strong>Conclusion :</strong></p><p>With TnT Drive software, mapping S3 bucket as network drive becomes easy. Do note that after 30 days trail ends, you need to <a href="https://tntdrive.com/buypro.aspx">purchase</a> the software. Also, even if S3 storage is cheap, need to keep in mind the <a href="https://aws.amazon.com/s3/pricing/?p=pm&amp;c=s3&amp;z=4">transfer charges </a>that are levied.</p><p>Hope you like this. Do share feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77e553e08abe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Take Charge of AWS: Mandatory MFA for Unrestricted Resource Management!]]></title>
            <link>https://medium.com/@architbidkar_66467/take-charge-of-aws-mandatory-mfa-for-unrestricted-resource-management-95241bd13734?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/95241bd13734</guid>
            <category><![CDATA[aws-best-practices]]></category>
            <category><![CDATA[aws-iam]]></category>
            <category><![CDATA[mfa]]></category>
            <category><![CDATA[aws-security]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Sun, 27 Aug 2023 18:47:27 GMT</pubDate>
            <atom:updated>2023-08-27T18:47:27.063Z</atom:updated>
            <content:encoded><![CDATA[<p>We have always seen that enabling MFA is a good practice for root account of AWS. But what about IAM users? Don’t they also need MFA enabled? Many organizations have stringent password policies that require users to have 12–15 characters password having combinations of digits, special characters, uppercases, and lowercases.</p><p>However, with a password change policy that requires users to change their passwords every ‘x’ days, the users also become less creative with their passwords &amp; set incremental passwords. For eg — the initial password created is $uper4up3rLong@123. Now during next password change, the users tend to just add a digit to their password — $uper4up3rLong@1234. According to many security organizations, it&#39;s <a href="https://www.google.com/search?q=how+long+does+it+take+to+crack+passwords+of+different+character+length&amp;sca_esv=560520228&amp;bih=715&amp;biw=1536&amp;hl=en-US&amp;source=lnt&amp;tbs=cdr%3A1%2Ccd_min%3A1%2F1%2F2023%2Ccd_max%3A8%2F27%2F2023&amp;tbm=">quite easy </a>to just crack a password that is more than 10 characters long.</p><p>This is where Multi-Factor Authentication (MFA) comes to help. Even if someone were to crack or guess user’s password, additional code would be needed to get access. MFA codes are generated on apps that are installed on user’s virtual devices. In fact, AWS recommends having <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa.html">MFA enabled </a>for all users to have better security. They also have a check for this in their <a href="https://aws.amazon.com/architecture/well-architected/?wa-lens-whitepapers.sort-by=item.additionalFields.sortDate&amp;wa-lens-whitepapers.sort-order=desc&amp;wa-guidance-whitepapers.sort-by=item.additionalFields.sortDate&amp;wa-guidance-whitepapers.sort-order=desc">Well-Architected Framework</a>.</p><figure><img alt="MFA applications" src="https://cdn-images-1.medium.com/max/1024/1*M3K4kvJUSPvipfRrci5LJQ.png" /><figcaption>MFA Apps</figcaption></figure><p>So how about making IAM users mandatory to have MFA? If MFA is not enabled, the user will be able to log into AWS Console, but won’t be able to view/ create/ delete any of the services or resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6XfYBNwv4e7pFNs0-uqKOQ.png" /><figcaption>No MFA device</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*rWNcZfm4UdkWzFtT4Ch7wg.png" /><figcaption>IAM Console to user who doesn’t have MFA enabled</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6F1TjEiZwjU9tyzTgfhMw.png" /><figcaption>DynamoDB page if MFA is disabled</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lM8mEw83OoDTve9gxyT65A.png" /><figcaption>S3 page if MFA is disabled</figcaption></figure><p>Let’s create a policy and attach it to user/ group/ role so that user will need to enable MFA to perform anything. This policy allows the user to perform any action, if the condition — <em>“aws:MultiFactorAuthPresent”: “true” </em>is met.</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;Action&quot;: &quot;*&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;Bool&quot;: {<br>                    &quot;aws:MultiFactorAuthPresent&quot;: &quot;true&quot;<br>                }<br>            }<br>        }<br>    ]<br>}</pre><p>As the user doesn’t have access to IAM page to enable MFA, admin needs to share the QR code with user, which the user needs to scan in their MFA app. Steps to activate MFA can be found <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable_virtual.html?icmpid=docs_iam_console#enable-virt-mfa-for-own-iam-user">here</a>. Once MFA is enabled, user will be able to perform all actions. (<em>User will need to sign out then sign in for change to take effect</em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zzDRZlqtPHnLT2yZLKHzAw.png" /><figcaption>Add device for MFA</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*T2-TwNVRMHvEzG0pRp1lyA.png" /><figcaption>IAM Console after enabling MFA</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7d2ya0AedqrFQerd1vILQ.png" /><figcaption>S3 Console after enabling MFA</figcaption></figure><p>With this, you can move towards having better security on AWS. Read more on MFA for IAM user on this <a href="https://aws.amazon.com/iam/features/mfa/?audit=2019q1">page</a>.</p><p>Hope this is helpful! Any suggestions/ feedback are welcome!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95241bd13734" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prevent an AWS IAM user from changing the permissions of another IAM user]]></title>
            <link>https://medium.com/@architbidkar_66467/prevent-an-aws-iam-user-from-changing-the-permissions-of-another-iam-user-c7467a0c4cc8?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7467a0c4cc8</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-iam]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Wed, 23 Aug 2023 19:48:08 GMT</pubDate>
            <atom:updated>2023-09-02T15:34:28.919Z</atom:updated>
            <content:encoded><![CDATA[<p>AWS IAM user with admin permissions (AdministratorAccess) wields tremendous power. The user can make any changes to the account, including new launches and removals. The user can even change the IAM roles and policies assigned to it or another admin user. The same can be done by any other IAM user that has required access of IAM.</p><p>What about designing a policy that allows the IAM user to execute all operations but prevents it from changing the policies that are associated with it or even modifying the policies of another IAM user?</p><p>Let&#39;s see how we can do this. Pre-requisites —</p><ol><li>Amazon Web Services Account</li><li>An IAM user with administrative privileges</li></ol><p><strong>Step 1</strong> — Create a new IAM user with admin permissions</p><ol><li>Log into AWS console with IAM user having admin rights</li><li>In <strong>Identity and Access Management (IAM), </strong>click on ‘<strong>Users</strong>’ &amp; then click on ‘<strong>Create user</strong>’</li><li>On ‘<strong>User Details</strong>’ page, enter any name that you want. Then choose options as shown in the screenshot below —</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lgDuWIbSf6_9OvFRLXc2gw.png" /></figure><p>4. Click ‘<strong>Next</strong>’. Do not add any permissions/ roles for now. Click ‘<strong>Next</strong>’ to proceed to ‘<strong>Review and create</strong>’ page. Click on ‘<strong>Create User</strong>’</p><p>5. On the next page, download the .csv file to have the user credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GnJ1HWrxSJuoy1UpJyz2gA.png" /></figure><p>6. Now open ‘<strong>Policies</strong>’ &gt; ‘<strong>Create Policy</strong>’ &gt; click on ‘<strong>JSON</strong>’ option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qiU67KZ-DRDZI_l0Q4X1JA.png" /></figure><p>7. Paste the following policy in the ‘<strong>Policy Editor</strong>’ text box. Click on ‘<strong>Next</strong>’.</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;Action&quot;: &quot;*&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;<br>        },<br>        {<br>            &quot;Action&quot;: [<br>                &quot;iam:AttachRolePolicy&quot;,<br>                &quot;iam:DeletePolicy&quot;,<br>                &quot;iam:DeleteRole&quot;,<br>                &quot;iam:DeleteRolePolicy&quot;,<br>                &quot;iam:DetachRolePolicy&quot;,<br>                &quot;iam:PutRolePolicy&quot;,<br>                &quot;iam:AttachUserPolicy&quot;,<br>                &quot;iam:DeleteUserPolicy&quot;,<br>                &quot;iam:DetachUserPolicy&quot;,<br>                &quot;iam:PutUserPolicy&quot;,<br>                &quot;iam:PutUserPermissionsBoundary&quot;,<br>                &quot;iam:DeleteUserPermissionsBoundary&quot;<br>            ],<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;Resource&quot;: [<br>   #Prevents changing policy for Admin1 user, who many be lead admin or user who granted policy to admin 2. Remove this whole line before pasting#<br>                &quot;arn:aws:iam::account-id:user/Admin1-user&quot;,<br>   #Prevents changing policy for Admin2 user, i.e the user to whom this policy will be assigned. Remove this whole line before pasting#<br>                &quot;arn:aws:iam::account-id:user/Admin2&quot;<br>            ]<br>        }<br>    ]<br>}</pre><p>8. On the ‘<strong>Review and Create</strong>’ page, enter details for the policy. Then click on ‘<strong>Create Policy</strong>’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aN6Q0Ti-eZNDfm5nyDsa9g.png" /></figure><p>9. Attach this policy to new IAM user that we have created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WG65jAo80AM5b30a41PiNw.png" /></figure><p>Step 2 — Validating the policy from new user’s account</p><ol><li>Log into the AWS console with the new user that you have created</li><li>Try to browse any of the services like EC2, Lambda, S3. Verify that you can view and create resources</li><li>Now head to the IAM console</li><li>In the ‘<strong>Users</strong>’, select this <strong>new user</strong>. Try to add/ remove policies to this user. Try the same with ‘<strong>Permission Boundary</strong>’. It will give error.</li></ol><figure><img alt="Error when trying to add permission" src="https://cdn-images-1.medium.com/max/1024/1*BkqNifa2dxBkIbK5YFeZzg.png" /></figure><figure><img alt="Error when removing policy" src="https://cdn-images-1.medium.com/max/1024/1*RkK7QAaqIk-X_NSb_WqvsQ.png" /></figure><figure><img alt="Error when adding permission boundary" src="https://cdn-images-1.medium.com/max/1024/1*_o6X-nLOVsyfGLbgo0cGdw.png" /></figure><p>5. This same error will be seen when new user tries to <strong>remove permission boundary </strong>or create an <strong>inline policy </strong>too</p><p>6. Now let’s try to change permissions for another IAM user that we mentioned in policy.</p><figure><img alt="Error when trying to remove the permission of IAM User mentioned in policy" src="https://cdn-images-1.medium.com/max/1024/1*DupTrz7ArxlsHLgmq32QOQ.png" /></figure><figure><img alt="Error when trying to add permission to another IAM user mentioned in policy" src="https://cdn-images-1.medium.com/max/1024/1*z_uTYhuEMzKNAlG07GgStQ.png" /></figure><p>With this, we have ensured that one IAM user cannot modify the IAM permissions of another user. Do note that this does not prevent any alterations to the group settings of either user.</p><p>Hope this is helpful. Do share any suggestions/feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7467a0c4cc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Establishing a connection between Public & Private AWS EC2 servers using Squid Proxy]]></title>
            <link>https://medium.com/@architbidkar_66467/establishing-a-connection-between-public-private-aws-ec2-servers-using-squid-proxy-d288be81292f?source=rss-df383d6b8020------2</link>
            <guid isPermaLink="false">https://medium.com/p/d288be81292f</guid>
            <category><![CDATA[aws-networking]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[squid-proxy]]></category>
            <dc:creator><![CDATA[Archit Bidkar]]></dc:creator>
            <pubDate>Sun, 23 Jul 2023 20:09:31 GMT</pubDate>
            <atom:updated>2023-08-23T20:05:34.737Z</atom:updated>
            <content:encoded><![CDATA[<p>Squid Proxy is a caching server that acts as a forward proxy, supporting HTTP, HTTPS, FTP, and more. It can be configured to set ACLs for network access, block/allow access to certain websites, cache frequently accessed websites, and hide internal IP addresses.</p><p>It can be really useful to connect an EC2 server in a Public subnet with EC2 server in a Private subnet. This is helpful to conduct a small PoC for a two-tiered architecture.</p><p>Let’s start setting this up in AWS cloud. You need to be familiar with basic AWS concepts like creating VPC and its components, creating Security Groups, and launching a server in different subnets.</p><p>Create a VPC. CIDR can be of any choice that you want. Create two subnets — one private subnet and one public subnet. For <strong>Public subnet</strong>, ensure that the “<em>Enable auto-assign public IPv4 address</em>” and “<em>Enable resource name DNS A record on launch</em>” options are checked. Create an Internet Gateway and attach it to VPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMmA-odymDdi-c1Z2tlI3Q.png" /></figure><p>In Route tables; create two. One for Public — associate Public subnet and add Internet Gateway in Route section. Second for Private Subnet, just associate Private Subnet with it.</p><p>Create a Security Group for Public server. In this, allow HTTP, HTTPS from anywhere. Add another Custom TCP — 3128 and allow from anywhere. This port is used by Squid proxy to communicate. Also, allow SSH from MY IP. In Outbound, keep all traffic to the internet.</p><p>When creating Security Group for Private instance, add only SSH from Security group of Public instance. In Outbound allow all.</p><p>Now, let’s launch two EC2 servers (t2.micro if the account is in free tier or else t3.micro). The first server will be launched in Public Subnet. Choose the Amazon Linux2 AMI. Then choose — VPC, Subnet, Security group &amp; key created for this instance and launch it. The Second sever will be launched in Private subnet — same AMI and VPC. But Subnet and security group will be different. Key pair can be same as public or new one can be created.</p><p>SSH into Public server. Perform linux updates using —</p><blockquote>sudo yum update -y</blockquote><p>Now let&#39;s install Squid proxy &amp; start it. Follow the commands —</p><blockquote>sudo yum install squid -y</blockquote><blockquote>sudo systemctl start squid</blockquote><blockquote>sudo systemctl status squid</blockquote><p>Now we need to make changes to squid.conf file to allow HTTP access. By default, it is blocked in configuration file. This configuration file provides various option that can be used to whitelist/ blacklist the sites. For now, we will allow HTTP access. Steps for that are —</p><ol><li>Open <em>squid.conf </em>using command —</li></ol><blockquote>sudo nano /etc/squid/squid.conf</blockquote><p>2. Locate “<em>http_access deny all</em>” and comment it. Just add <strong>#</strong> before it to comment it</p><p>3. Then add <em>http_access allow all</em> in new line</p><p>4. Save and exit the configuration</p><blockquote>5. Restart Squid — sudo systemctl restart squid</blockquote><p>6. Check status of Squid using the command mentioned above. If all changes in <em>squid.conf</em> are saved currently, the status should be <em>running</em>.</p><p>We will create a key.pem in Public server which will be used to SSH into private server.</p><blockquote>Run command — sudo nano key.pem</blockquote><p>Copy the content of pem file for private server and paste it in nano editor. Save and exit it. Give it permission — <em>sudo chmod 400 key.pem </em>so that it can be used to SSH. Try to ssh into private instance using command —</p><blockquote>sudo ssh -i key.pem ec2-user@ip_of_pvt_server</blockquote><p>Now, we need to make changes in Security groups for both servers. For <strong>Inbound rules in Private SG</strong>, add <em>HTTPS, HTTP and Custom TCP (3128) </em>all from <strong>private IP address of Public server</strong>. Final rules are —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TesliC0bVf4DJVwQ_cpcIA.png" /></figure><p>In <strong>Outbound of Private SG</strong>, add Custom TCP 3128 to the destination <strong>private IP address of Public server.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XKb6cF0WuO2pPTztNu5a1A.png" /></figure><p>In <strong>Public SG</strong>, add rule <strong>Custom TCP 3128 to Private IP address of Private server</strong>. The final rules are —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-_hSN4SntUJZ-9Hb_b2ARg.png" /></figure><p>In Outboud, add “All Traffic” to <strong>Private IP address of Private server.</strong></p><p>SSH into private server from public server. Try to do update or curl -v <a href="https://reddit.com./">https://reddit.com</a>. In both cases, the connection will timeout due to a network error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wLVqKuExXIHKoukncHD0yw.png" /></figure><p>We already have Squid proxy running in Public server. So now, how to use it to get internet for our private server. Simple — we will run two commands.</p><blockquote>export http_proxy=pvt_ip_pub_ec2:3128</blockquote><blockquote>export https_proxy=pvt_ip_pub_ec2:3128</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*gjcaX9-ZZBiMWmgF5tfLrw.png" /></figure><p>Now try to run the curl commands again or even wget commands. This time connection will be established &amp; content will be downloaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*1131W6ExD8nKzenZqLVplw.png" /></figure><p>We have seen how to successfully use Squid Proxy to establish a connection between public &amp; private ec2 servers.</p><p>How about a Bonus?? Why not use this proxy to serve our other needs too? For example, accessing websites that are blocked in a country. To allow setting up a proxy on Android device, follow the steps in this <a href="https://proxyway.com/guides/android-proxy-settings">link</a>.</p><p>Before setting up a proxy on my phone, I was getting site abc is blocked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/0*JfV_K3eDlkMm1U4A" /></figure><p>Remember we enabled “<em>Enable resource name DNS A record on launch</em>” during subnet settings? This comes in handy when doing proxy setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/0*b1qqiPdPn46qZwYA" /></figure><p>Now, I am able to access the same site which was blocked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/0*ab5QPvVbCg8JuU_N" /></figure><p>After doing this, ensure that you clean up all the resources and also remove the proxy settings from phone settings.</p><p><em>Note — While Squid Proxy can be used to communicate between public and private servers, it may not be the most efficient solution compared to a NAT Gateway in terms of cost savings and ease of use. Squid Proxy requires manual configuration and management, and may not provide the same level of scalability and availability as a NAT Gateway</em></p><p>Any suggestions are welcome!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d288be81292f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>