<?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 Wasif Ahmed on Medium]]></title>
        <description><![CDATA[Stories by Wasif Ahmed on Medium]]></description>
        <link>https://medium.com/@agilemaster3?source=rss-af0587aef3c0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hE-8RBe14ngO3vHJ</url>
            <title>Stories by Wasif Ahmed on Medium</title>
            <link>https://medium.com/@agilemaster3?source=rss-af0587aef3c0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:24:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@agilemaster3/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[Backing up SQL DB over GCP and Migrating the Backup to AWS S3 bucket using Cloud Function]]></title>
            <link>https://medium.com/@agilemaster3/backing-up-sql-db-over-gcp-and-migrating-the-backup-to-aws-s3-bucket-using-cloud-function-e405c93cd4aa?source=rss-af0587aef3c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e405c93cd4aa</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Wasif Ahmed]]></dc:creator>
            <pubDate>Wed, 31 Jan 2024 17:23:56 GMT</pubDate>
            <atom:updated>2024-01-31T17:23:56.427Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Aim:</strong> Save Backup of SQL DB on GCP to S3 Bucket.</p><p><strong>Summary:</strong> Make a cloud function that will take a SQL database backup, store it in a GCS bucket, and then delete it once it has been uploaded to a S3 bucket.</p><p><strong>Resources on AWS</strong></p><ol><li>IAM User with a policy restricting its ability to write to a particular bucket.</li><li>S3 bucket to store the DB Backup</li></ol><p><strong>Resources on GCP</strong></p><ol><li>Cloud Function</li><li>Pub/Sub</li><li>Cloud Scheduler</li><li>Google Cloud Storage Bucket</li></ol><h3>On AWS</h3><ol><li>Create the policy and associate it with the user so that the user’s login credentials can be used to save the database backup there.</li></ol><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:PutObject&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::Backup-bucket/*&quot;<br>        }<br>    ]<br>}</pre><p>2. Create a bucket named <strong><em>Backup-Bucket </em></strong>that will store the DB backup.</p><h3>On GCP</h3><p><strong>Creating a GCS Bucket</strong></p><ol><li>Click on search and type GCS.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AlAT6W1LaejCZPWq.png" /></figure><p>2. Click on <strong>cloud storage</strong> and then select <strong>Create.</strong></p><p>3. Now, fill in the details for the bucket.</p><p>4. After filling in all the details, click on Create at the bottom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ujL25CqxuTr-YEbe.png" /></figure><p><strong>Pub/Sub and Cloud Scheduler</strong></p><ol><li>Type pub/sub in the search bar and press enter.</li><li>Select <strong><em>Create Topic</em></strong>.</li><li>Now give a name to the topic and click on <strong><em>Create</em></strong> at the bottom.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*i2xA563o2t3sAZdO.png" /></figure><p>4. In the search, search cloud scheduler and press enter.</p><p>5. Click on <strong><em>create a Job</em></strong> and fill in the details. We created a cron job as per our demand, which was to have a backup every day at 6:30 am. Click on <strong><em>Continue.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IksmbwtNN0sr66qC.png" /></figure><p>6. In the next step, select the target as pub/sub from the drop-down and select the name of the topic you created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*naWrAN-JqUqwGAGp.png" /></figure><p>7. Now click on continue.</p><h3>Cloud Function</h3><ol><li>We made two cloud functions.</li></ol><ul><li>One is for creating a SQL Database backup and keeping it in a GCS bucket.</li><li>In the second function, the backup will first be uploaded to an S3 bucket and then removed from the GCS bucket using an event-based trigger method.</li></ul><p><strong>Cloud Function 1</strong></p><ol><li>Click on the create function and fill in the details as required. Select Pub/Sub as a trigger and select the topic you created.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q4ZLOg1Q3mD8xgp0.png" /></figure><p><strong>2.</strong> Assign memory to it now, then add variable values to be utilized in the function. Either the default service account was used, or you can specify a service account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mo1vAkfPL5Chz1PG.png" /></figure><p>3. Now click on next and from the drop down select the runtime as Python and add the function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4rOTngnb6NFDFEP4.png" /></figure><p>4. You can get the function and requirements.txt that I used here.</p><p><a href="https://github.com/wasifahmed-sudo/gcp-sql-db-backup-migration/tree/main/GCP/function-1">https://github.com/wasifahmed-sudo/gcp-sql-db-backup-migration/tree/main/GCP/function-1</a></p><p>5. Deploy the function now. If the database backup file is uploaded into the GCS Bucket, you may confirm that the function works.</p><p><strong>Cloud Function 2</strong></p><ol><li>Since this is an event-based function that is only triggered when an object is added to the GCS Bucket, we will create it using the CLI. The CLI is the only way to have the option of having a triggering event and resource. The command to create the function is below, replace the placeholders with your values.</li></ol><pre>gcloud functions deploy FUNCTION_NAME \<br>    --runtime RUNTIME \<br>    --trigger-resource BUCKET_NAME \<br>    --trigger-event google.storage.object.finalize \<br>    --entry-point ENTRY_POINT \<br>    --allow-unauthenticated \<br>    --region YOUR_REGION</pre><ol><li>Now once this function is created, from the console go to this function and add the python script for it. The AWS details are added as variables.</li><li>You can get the function and requirements.txt that I used here.</li></ol><p><a href="https://github.com/wasifahmed-sudo/gcp-sql-db-backup-migration/tree/main/GCP/function-2">https://github.com/wasifahmed-sudo/gcp-sql-db-backup-migration/tree/main/GCP/function-2</a></p><p>3. This function will upload the DB backup file to S3 from the GCS Bucket and later delete it from the GCS bucket.</p><h3>Workflow Explanation</h3><p>When the scheduled cron job initiates, function-1 is activated. This function orchestrates the process of creating a backup of the database and subsequently storing the backup file in a Google Cloud Storage (GCS) bucket.</p><p>This event triggers function-2, configured to respond to changes in the GCS bucket. function-2 is responsible for migrating the backup file to an AWS S3 bucket. Upon successful migration, the file is then deleted from the GCS bucket. This synchronized workflow ensures a seamless and automated process for backing up the database and efficiently managing the storage locations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e405c93cd4aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Difference: su -user vs. su - user in Linux]]></title>
            <link>https://medium.com/@agilemaster3/understanding-the-difference-su-user-vs-su-user-in-linux-bc502b4cbaf2?source=rss-af0587aef3c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc502b4cbaf2</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Wasif Ahmed]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 17:13:09 GMT</pubDate>
            <atom:updated>2024-01-29T17:23:31.197Z</atom:updated>
            <content:encoded><![CDATA[<h4>Decoding su</h4><h4>What does ‘su’ do?</h4><p>The ‘su’ command in Linux is used to switch to another user account in the system. This command can be used two different ways: ‘su -user’ and ‘su - user’. These two subtle variations can have significantly different outcomes.</p><h4><strong>su -user vs su - user</strong></h4><p>1. <strong>su -user</strong>: When we use the ‘su -user’ command, we are switching to the specified user account without changing the environmental variables of the original user. That means, while your user account is technically switched, your PATH, HOME, SHELL, USER, and LOGNAME environment variables remain the same as the initial user account. You indeed become the new user, but your surroundings in terms of the command-line environment stay as they were before.</p><p>2.<strong> su - user</strong>: On the contrary, when using the ‘su — user’ command, you switch to the specified user account and source the login profile of that user which in turn can change the environment variables. It’s a complete switch to the new user account — not only do you adopt the user’s privileges, but their environmental setup as well.</p><h4>Which to use when?</h4><p>The decision of employing ‘su -user’ vs ‘su - user’ largely depends on your need at that particular moment. Utilize ‘su -user’ in situations when you as a user want to switch users but still keep your original user environment. It is useful while executing a program/script that’s compatible with the environment variables of original user only.</p><p>In contrast, use ‘su - user’ when the applications or scripts you plan to run require the environment specific to the user you are switching to. ‘su - user’ is commonly employed to login as root or another user and have all environmental variables and paths just like as if we did a regular login with such a user.</p><p><strong>A simple comparison summarizes these key differences:</strong></p><p>| Command | User Identity | Environment Variables | <br>| — — — — -| — — — — — — — | — — — — — — — — — — — — — | <br>|su -user|Switch to specified user|Remains same as the original user| <br>|su — user|Switch to specified user|Changes to the new user|</p><p>Understanding these differences and when to apply them can increase your efficiency and reduce the potential for errors or complications in your Linux operations. Keep exploring and keep learning, that’s the true spirit behind comprehending &amp; mastering Linux!</p><p>Just remember, in Linux, even a space between characters is a powerful operator. Therefore, next time when you switch to another user, determine if you want a complete environment switch ‘su - user’, or merely a user switch without changing the environment ‘su -user’. After all, Linux is about choice and flexibility. And these little nuances are what make working with Linux so dynamic and interesting.</p><p>Stay tuned to our blog for more deep dives into the captivating world of Linux command line!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc502b4cbaf2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>