<?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 Gregory Chingwe on Medium]]></title>
        <description><![CDATA[Stories by Gregory Chingwe on Medium]]></description>
        <link>https://medium.com/@gchingwe?source=rss-b548df936349------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kfpbHhYW8LFQgLXhITwAqA.jpeg</url>
            <title>Stories by Gregory Chingwe on Medium</title>
            <link>https://medium.com/@gchingwe?source=rss-b548df936349------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 14:31:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gchingwe/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[Implementation of a factory pattern in C#]]></title>
            <link>https://medium.com/@gchingwe/implementation-of-a-factory-pattern-in-c-dd5406a0fd6d?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd5406a0fd6d</guid>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Sat, 25 Oct 2025 17:37:33 GMT</pubDate>
            <atom:updated>2025-10-25T17:37:33.905Z</atom:updated>
            <content:encoded><![CDATA[<p>Project description:</p><p>In this real world scenario, I implemented a C# factory pattern using the best practices, and the most advanced abstracts concept using LINQ. This example shows how applying such concepts achieve better code reuse, cleaner code, extensibility, flexibility of design, ease of code maintenance, separation of concerns, the enablement of effective unit testing and the provision for overall better performance and efficiency of applications.</p><p>Step 1:</p><p>Open visual studio 2022 (2012 or later is fine)<br>Create a Project called SchoolHRAdministion<br>Create a base class library called HRAdministrationAPI<br>Create an interface called IEmployee</p><p>Interface IEmployee</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*x708l4c8lPp7e7ivfXwC7g.png" /></figure><p>Add another class called EmployeeBase and implements IEmployee</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*VInIjnVTnKr5YIygbPRpTQ.png" /></figure><p>From the main SchoolHRAdministration project make a reference to HRAdministrationAPI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*B0nunX1pCJmqoDKHmXF55Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd5406a0fd6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementation of an E-Commerce System on AWS in an automated way using Terraform and Ansible]]></title>
            <link>https://medium.com/@gchingwe/implementation-of-an-e-commerce-system-on-aws-in-an-automated-way-using-terraform-and-ansible-1e7430f5e1d0?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e7430f5e1d0</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[ansible-playbook]]></category>
            <category><![CDATA[magento]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Wed, 28 Dec 2022 16:52:13 GMT</pubDate>
            <atom:updated>2022-12-28T16:52:13.382Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zx71oTnvNn010ARqVGIrvg.png" /></figure><p><strong>Project description:</strong></p><p>In another project based in a real-world scenario, I worked as Cloud Engineer using DevOps, where I created and implemented an e-Commerce MVP (Minimum Viable Product) on AWS in less than 2 hours and in an automated way using Terraform and Ansible (Infrastructure as Code — IaC).</p><p>I provisioned the infrastructure in an automated way using Terraform and Ansible to automate the configuration management process, software installation and package management of the EC2 instance. I also used Magento, PHP, MySQL, and Redis to complete this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20hAjDunzoHchCDcdHR0Yw.png" /></figure><p>E-commerce MVP deployment</p><p>Step 1: Create Magento free account on:</p><p><a href="https://marketplace.magento.com/">https://marketplace.magento.com/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6o0Psj5PkbL-is-w9nNkw.png" /></figure><p>Take note of the 2 keys:</p><p>Public Key:<br>648ccf7c8dfc340fbd2c7b83eb07fcf1<br>Private Key:<br>d1909e200426d555cc6c06a0a006a636</p><p>Step 2: Open AWS Cloud Shell</p><p>- Install Terraform on AWS Cloud Shell</p><p>sudo yum install -y yum-utils</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NouW3a-beYue9ItxQ9uO4Q.png" /></figure><p>sudo yum-config-manager — add-repo <a href="https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo">https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FLVH_7KA4s4S1HJDY3UBhg.png" /></figure><p>sudo yum -y install terraform</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILswDuEQhnWPbpneHa0V0A.png" /></figure><p>Step 3: Download the Terraform files on AWS Cloud Shell<br>mkdir final_project<br>cd final_project<br>wget <a href="https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/final-project-terraform.zip">https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/final-project-terraform.zip</a><br>unzip final-project-terraform.zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*0h2bUFZy4X1K6dKzWJMqvg.png" /></figure><p>Step 4: Get the default AWS VPC<br>vpc-067d797aac1be644b</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2CezkZprfLadcZE3TErbWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XeSs1H41Pqi7hk50rJVTqQ.png" /></figure><p>Step 5: Edit main.tf file using the vi editor, replace the default VPC from the AWS and use the key pair created earlier in the module. <br>Save file ESC + :x&lt;enter&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*Q0nGrTv_ae6RLq8bKgkGUA.png" /></figure><p>Step 6: Running Terraform to deploy the EC2 VM:</p><p>cd terraform<br>terraform init<br>terraform plan<br>terraform apply</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGFdYre6DYwKXEZdNXgbVQ.png" /></figure><p>Step 7: Get the Public IP of the recently created ecommerce1 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YlmhItv_oTNKNYo04SgUPA.png" /></figure><p>Step 8: Connect the EC2 instance using SSH<br>Ensure that the pair key (sshkey1.pem) is the most recent. I ran into trouble were I was unable to SSH into my EC2 instance. I tried chmod 400 ssh1key.pem to secure the pair key and added permissions to no avail. Last option to recreate the EC2 instance and this made it work.</p><p>ssh -i sshkey1.pem <a href="/service/mailto:ec2-user@ec2-44-211-238-112.compute-1.amazonaws.com">ec2-user@ec2–44–211–238–112.compute-1.amazonaws.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aRHaoYJ6ObDqkFYHn73A3w.png" /></figure><p>Part 2<br>Step 1: Install Ansible in the EC2 VM</p><p>sudo yum-config-manager — enable epel<br>sudo yum install ansible -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mBaqtQ248Umo-QgfTpoX0Q.png" /></figure><p>Step 2: Download the Ansible playbooks<br>wget <a href="https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/final-project-ansible-magento2.zip">https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/final-project-ansible-magento2.zip</a><br>unzip final-project-ansible-magento2.zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kWiTBKDFBNO1vuVSiIfHrg.png" /></figure><p>list of downloaded files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*jhSIHHVIzpP7VhA0HFPmuA.png" /></figure><p>Step 3: Edit the all.yml file in the group_vars folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*w-54-lcnt0QlAey3jMgf9w.png" /></figure><p>Copy the public IP address from the EC2 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fRbwY9yu1sdQ2ww3M-URUQ.png" /></figure><p>Replace EC2 Public IP address, public and private keys from Magento(Saved earlier in the module) in all.yml file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfHcl83WMJnuFoZNFUJ-DA.png" /></figure><p>Step 4: Run Ansible to deploy the stack of tools for the e-commerce</p><p>cd ..<br>ansible-playbook -i hosts.yml ansible-magento2.yml -k -vvv — become<br>Ensure that ansible ran without any errors:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JeyW9wSmASVXdZWTlPR5CA.png" /></figure><p>Step 5: Access the website using the EC2 public IP. At this point the website is already provisioned</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FfCbaH5co_9VsFKdLcwPhg.png" /></figure><p>Step 6: Access the secure website by typing the following in the URL:<br>44.211.238.112/securelocation<br>Enter the site using the admin credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5y2sk0QQFzgdfU-B3JPeAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfIzIwZS6c10eMuQTOassQ.png" /></figure><p>Step 7: Change the default page title</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y04njau0DgASZYUmxgqaxQ.png" /></figure><p>Step 8: Go to system setting and ensure that all cache types are enabled</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bpWbQ5k5TsnIKcz-HrZDQg.png" /></figure><p>Step 9: Test adding a new product</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ItcaRhf-npe3n8_Ca9tM3A.png" /></figure><p>Step 10: Images added for new products</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsUHj_FJqmnluBa_L3FYfw.png" /></figure><p>Inventory shows that a new product items has been added</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rbHf4wPXvwsUuprBfI-UYw.png" /></figure><p>Step 11: Test the payment method</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H8ZkQ0uGIdZp4_AZljuq-A.png" /></figure><p>Customer view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8gSrfiaslk5ZysULRcZs3w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e7430f5e1d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elaboration of Executive Presentation of Infrastructure costs for an SAP Migration project from…]]></title>
            <link>https://medium.com/@gchingwe/elaboration-of-executive-presentation-of-infrastructure-costs-for-an-sap-migration-project-from-6b302bb7e2e8?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b302bb7e2e8</guid>
            <category><![CDATA[aws-support-services]]></category>
            <category><![CDATA[calculator]]></category>
            <category><![CDATA[sap-migration]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Sat, 24 Dec 2022 02:21:07 GMT</pubDate>
            <atom:updated>2022-12-24T02:27:34.836Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Elaboration of Executive Presentation of Infrastructure costs for an SAP Migration project from On-Premises to AWS</em></h4><p>In this project based on a real-world scenario, I acted as a Cloud Architect and created an executive presentation of infrastructure costs for a SAP migration project from On-Premises to AWS.</p><p>SAP workloads were running in a corporate DataCenter with the environment divided into Production, Quality Assurance — QA and Development/Test layers.</p><p>My mission was to estimate the costs of migration to AWS, considering that this infrastructure will be running on AWS for at least the next 3 years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKyCY8xiJON65isaaWsAKg.png" /></figure><p>Solution Architecture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-L3DsQvIi6pKOjum3-K5A.png" /></figure><p>Corporate Data Center</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGZy1Padbup1MhqUQNV4vA.png" /></figure><p>Step 1: Open the calculator.aws website and click on create estimate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUnhaOAKZBqDvPbKMkApKw.png" /></figure><p>Step 2: Search for EC2 service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYYFvNpkviIo7upoCGs41g.png" /></figure><p>Step 3: Configure production <br>5 Application servers with 8 vCPUs and 16 GiB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-2R3LxNsxVbenzJwNkM8Mw.png" /></figure><p>Pick instance family:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYhfFxlpQS0sng75zwmvPg.png" /></figure><p>Payment options</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*zY_C0Cr_3RrEn5CDu_JaCg.png" /></figure><p>Configure Elastic Block Store (EBS)</p><p>2TB/5 = 400GiB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*6nwn4Mt_Rdda7KLLlZBKtg.png" /></figure><p>Step 4: Add EC 2 instances for Stage and Development<br>3 + 2 = 5 Application servers at 4 vCPUs/ 8 GiB memory<br>Go to search box, enter EC2, configure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mq8kZ8qpQFBsRJwkG6u9sQ.png" /></figure><ol><li>5 TB / 5 = 3 GiB</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*iGv7Hw3WQY7v4Sy9qguRtw.png" /></figure><p>Amazon EBS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*etDZW4jyqyQowX-i6FDWuQ.png" /></figure><p>Configure Elastic Load Balacing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*HyWeF9SR9RpbORlRR5rJPA.png" /></figure><p>ELB continued</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*kg12TScyPNtcLdVqHVfJKw.png" /></figure><p>Calculation summary</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*y1_pIImLDW81dlxcRDXDyg.png" /></figure><p>Step 5: In search bar, enter Elastic file to add the Elastic File System (EFS)</p><p>1 TB prod<br>500 GB stage<br>250 GB Dev &amp; Testing<br>Total us 1.75 TB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ll7twqOQmHhOHEVq300jUQ.png" /></figure><p>Database layer estimate:</p><p>Step 6: Production configuration<br>Add service &gt; Search for RDS &gt; Select Amazon RDS for Oracle</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Og0nP-WjIeOLwWmrGJ2iEA.png" /></figure><p>Utilization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*7TbMNcuGlNv1nEH9CjuVxQ.png" /></figure><p>Enter storage details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*VV0vJLGi4H65Ea1fWl5yFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*2vx_Bvzr2K22G_fiXcaWjw.png" /></figure><p>Step 7: Stage + Dev environment configuration<br>Add service &gt; Search for RDS &gt; Select Amazon RDS for Oracle<br>Stage configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nh0AiPhGUqP3KKSAjkOm4g.png" /></figure><p>Deployment option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*CDLa6QWblwXBGTd-4mxxgQ.png" /></figure><p>Development configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CyRK2CWT5XQEPnT1ASfOw.png" /></figure><p>Utilization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*_VDOXJas8gTDdPb6K-h4WA.png" /></figure><p>Step 8: Since this is a critical environment, we would like to meet clients SLAs, response time should be less than 15min, we need to add AWS Support</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*slEVV8a3t3dDWpcQORbl3Q.png" /></figure><p>Support estimate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3AgUm68aNUG8ebgbhSJjLw.png" /></figure><p>Add technical support</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyC0TWdVzDAVa6fGsL1gdQ.png" /></figure><p>Summary of estimate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*du0M-Dq3xaGoxd06v7Eqdw.png" /></figure><p>Step 9: Export file as CSV and open it in excel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HV0NZe3MjMA9stqKU9KrQQ.png" /></figure><p>Step 10: Insert Data from the excel in a Powerpoint Slide as shown below.<br>Monthly view</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mYfW0EPJv1BGQu8wpL5TIQ.png" /></figure><p>Insert Data from the excel in a Powerpoint Slide as shown below.<br>Yearly view</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LUP-q5-euiiQsGRsdr5UA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b302bb7e2e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementation of a set of EC2 instances using Terraform and AWS Systems Manager configuration with…]]></title>
            <link>https://medium.com/@gchingwe/implementation-of-a-set-of-ec2-instances-using-terraform-and-aws-systems-manager-configuration-with-bb0ce8ad7aab?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb0ce8ad7aab</guid>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[systems-manager]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[run-commands]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Thu, 22 Dec 2022 23:49:54 GMT</pubDate>
            <atom:updated>2022-12-23T01:31:53.657Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Implementation of a set of EC2 instances using Terraform and AWS Systems Manager configuration with Amazon Simple Notification Service for automated installation of security officers</em></h4><p><strong>Project description:</strong></p><p>In this project based on a real-world scenario, I acted as DevSecOps Engineer, and I deployed a set of EC2 instances and infrastructure in an automated way using Terraform (infrastructure as code — IaC). Also, it was necessary to install a specific security agent on all these instances in an automated way.</p><p>After the infrastructure is provisioned, AWS System Manager and its component Command Run were used to install the security agents in an automated way. I used the Amazon Simple Notification Service — SNS to send emails notifying the stakeholders of the process status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n8BpukIewiIZSwDg227TZg.png" /></figure><p>Solution Architecture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_lfls-gHWpTs4eqW2Duecg.png" /></figure><p><strong>Hands On Project — Part 1 — Terraform</strong></p><p>Step 1: Download VSCode and install the Terraform extension:<br>https://code.visualstudio.com/download</p><ul><li>Download and unzip Terraform files<br>https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/terraform-mod5.zip</li></ul><p>Step 2: Open AWS CloudShell and install terraform<br>sudo yum install -y yum-utils</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*rEhVWQkCWNBu3FCI3_4oNg.png" /></figure><p>Step 3: Run following command to add the hashicorp application<br>sudo yum-config-manager — add-repo <a href="https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo">https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*6AYqgHZn7YFaTYGi6QTuQw.png" /></figure><p>Step 4: Install terraform</p><p>sudo yum -y install terraform</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PB0w3wtg-bUI8IY1Ks6hig.png" /></figure><p>terraform init<br>terraform plan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*KqSnjumlri1JcTLy8jKaIw.png" /></figure><p>terraform apply</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*j4WQst4sMQc6w4F1ZrufqQ.png" /></figure><p>terraform apply continued</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*f9t1quR24TgMSFWEP5oAmw.png" /></figure><p>Step 5: Download and unzip Terraform test files<br>https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/terraform-mod5.zip</p><p>Step 6: Create SSH Key Pair<br> — name: sshkey1<br> — format: .pem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*ASVlYvK6xWukDiZCx7zLGQ.png" /></figure><p>Step 7: Edit Terraform main.tf file using the VSCode:<br> — Change the VPC_ID and SUBNET_ID according to the default VPC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxCpBjtS_hovIDjAK0hvmA.png" /></figure><p>Step 8: upload terraform-mod5.zip to AWS CloudShell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*UkgFS5YlYD4fgcHot4Fz7Q.png" /></figure><p><strong>Part 2 — AWS Systems Manager</strong></p><p>Step 1: Create an IAM role SystemsManagerToSNS</p><p>Policy: AmazonSNSFullAccess</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvN7HvfVD63a-vsOglvCzg.png" /></figure><p>Add permissions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZrhYNtyn7rHPaEdTLRPJ9g.png" /></figure><p>Give the name of the role and create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ktDTv2DJoRxsiA86WuUweg.png" /></figure><p>Role has been created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rA0LpZbmaXrzi6zjV9YhDQ.png" /></figure><p>Step 2: Create a topic under the SNS and copy-and-paste to a text editor the ARN number that will used later on :</p><p>ARN: arn:aws:sns:us-east-1:527354884128:DevOpsNotification</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I7zGqOEr8zhfqb-PAlhh0g.png" /></figure><p>Enter topic ARN, Protocal as email and the endpoint as <em>youremail</em>@gmail.com Create a subscription</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dVMAg4sQBHdYCFNrnAU7jQ.png" /></figure><p>Step 3: Create a subscription and copy-and-paste to a text editor the ARN number that will used later on :</p><p>ARN: arn:aws:sns:us-east-1:527354884128:DevOpsNotification:aa5a2dd0–2633–45d4-b4d1-e66becfa68a7</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwUC3HDzZ7WU7S1Yd1ep-Q.png" /></figure><p>Step 4: Check email to verify that confirmation email came through. If email is not in the inbox, check spam box</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wnnm3al9Q8YcE05JlBzWAA.png" /></figure><p>After confirmation the message below will be displayed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*bxp_pEzIV8bPcl69TGBNuA.png" /></figure><p>Step 5: Search for system manager on AWS console and create the host management configuration using the following options:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2SoAMglJicDRnBbv_t_BNw.png" /></figure><p>Configuration details are shown in screenshot below. Click on account and view details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q0ZgfHIagFvuOc4I4_wG7w.png" /></figure><p>Association details</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpYkS_s2Xj09UEVz7lMUIg.png" /></figure><p>Step 6: Initiate the session manager. It should show the instances running. If the instances are not running, simply go to EC2 and reboot the instances and they will show up in the session manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*laZW7qQlT4SXx67h_V8WzA.png" /></figure><p>Start a new session with the webserver1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8mq6SW__FDbJAv54REXDiA.png" /></figure><p>Step 7: On AWS Systems Manager, Run Command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5REjwW6bE6VW4Lh-DJLtWA.png" /></figure><p>In the command parameters enter the following command:<br>sudo wget -q <a href="https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/install_security_agent.sh">https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/install_security_agent.sh</a> -P /tmp<br>sudo chmod +x /tmp/install_security_agent.sh<br>sudo /tmp/install_security_agent.sh<br>ls -ltr /usr/bin/security_agent</p><p>The command will install the simulation agent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xOOf8gNW1k_ZrebLKk6rjA.png" /></figure><p>Before installation the following command shows that agent (simulation of an agent)is not installed.<br>ls -ltr /usr/bin/security_agent</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*raiRGod4MED6rGlPthsCWA.png" /></figure><p>Choose instances manually on targets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wXTGM1KOwPimhufN9Z4_w.png" /></figure><p>On Output options uncheck S3 bucket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*6c5881rBME5s6LB8rltvQA.png" /></figure><p>Step 8: On SNS notifications, Enable SNS notifications, Enter the role created earlier in the module, enter the SNS topic, for testing purposes choose all events (No need to turn on this option since we only have 2 instances to test)<br>Once all the options are selected, click on run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-fjKrzQfqiDq2xyFAe5Stw.png" /></figure><p>Command ID created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3pMn-HNiuD5kkymodtMGYQ.png" /></figure><p>Step 9: Email notification received</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lpY6XJLbwX8gpB4a5OlCxQ.png" /></figure><p>Step 10: Go to Systems Manager and check the output of the one of the instances</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u618d9Hx64RTRkKJrBqqKw.png" /></figure><p>The screenshot below shows that the agent was installed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*izF5NxPUjlF2xMBRMviG8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Ehiy7RjKR0yuZVPiq35SA.png" /></figure><p>Step 11: This is for training purposes, once done, run the terraform destroy to removed all resources created otherwise AWS will charge of running services. terraform destroy</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*6o6d1qknxI5gKa_co7Eu5A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb0ce8ad7aab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementation of a Scalable Web Application using the services of AWS Elastic Beanstalk, DynamoDB…]]></title>
            <link>https://medium.com/@gchingwe/implementation-of-a-scalable-web-application-using-the-services-of-aws-elastic-beanstalk-dynamodb-f14a7d40fd31?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/f14a7d40fd31</guid>
            <category><![CDATA[edge-location]]></category>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws-elastic-beanstalk]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Sun, 18 Dec 2022 00:37:56 GMT</pubDate>
            <atom:updated>2022-12-18T00:37:56.654Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Implementation of a Scalable Web Application using the services of AWS Elastic Beanstalk, DynamoDB, CloudFront and Edge Location</em></h4><p><strong>Project description:</strong></p><p>In this project based on a real-world scenario, I was responsible for implementing an application that needs to support the high demand of a large number of users accessing it simultaneously. This application has been used in a large conference that had more than 10,000 people, in-person and online, with participants from all over the world.</p><p>This event was broadcast online and in person and 10 vouchers were drawn for 3 Cloud certifications. At that moment, more than 10,000 people in the audience registered their e-mails to guarantee their participation in the raffle.</p><p>We used in AWS, Elastic Beanstalk services to deploy the web application, DynamoDB to store emails, CloudFront to cache static and dynamic files in an Edge Location close to the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fomkaNkDk3i6z-kiBfh4TQ.png" /></figure><p>Solution Architecture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9CyQP22KPfAUgpcqlqKdGw.png" /></figure><p>Step 1: Search for DynamoDB and create a users table as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*TVXZagGuTTtwc8UBtp1WUg.png" /></figure><p>Step 2: Search for Elastic Beanstalk on AWS console</p><p>Create an Elastic Beanstalk Web Application code as shown in screenshot<br>+ Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*hLvLzyl3m901LtCcBK-a_g.png" /></figure><p>Step 3: Modify the instances with the values stated<br>+ Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r3tWyaYLuSIFphxogjOxKQ.png" /></figure><p>Step 4: Modify the environment properties:<br>+ Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*UU_S81xu2YrjxomhQWLNHQ.png" /></figure><p>Step 5: On the public S3 URL enter value : <a href="https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/tcb-conf-app-EN.zip">https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/tcb-conf-app-EN.zip</a><br>+ Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7EucP6eTKJtIqQZWRxorVg.png" /></figure><p>Step 6: On instance types, select the t2.micro option (free tier) + Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sNVPyKfIF0SHbkr0CEfC8A.png" /></figure><p>Step 7: Modify capacity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QVA2TEkJqtHORll0MrU5A.png" /></figure><p>Step 8: Modify Scaling triggers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCQsjOfSMuzwGCOsD5kDDw.png" /></figure><p>Step 9: Modify security tab as shown in screenshot. The ssh-key is pair key that was saved in a different project. This can easily be recreated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KIXxPz_o8GnnhHT7EIxapw.png" /></figure><p>Step 10: Modify Network tab as shown in screenshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cuzv7FXPH7LJtrwep_qVvg.png" /></figure><p>Step 11: Modify instance settings as shown in screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ig7X4cLnvfiv7s88j150Q.png" /></figure><p>Step 12: Register an email to the website yields the following error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DRIOMtX4xomEGMY2Oi9aww.png" /></figure><p>Application throws an errors as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-9pZfhMcuo2Ua2p_56HZw.png" /></figure><p>Solution to this issue is to attach AmazonDynamoDBFullAccess:<br>Access Management &gt; Roles &gt; Permission Policies &gt; aws-elasticbeanstalk-ec2-role &gt;attach policy <a href="https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess">AmazonDynamoDBFullAccess</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYVmJxsqL0kW2SiFJHOe9A.png" /></figure><p>Successful addition of emails:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ksQBOj3O1muc9zsatJw8TA.png" /></figure><p>DynamoDB shows 2 emails added through the website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6vIvpojETz9kuhCFTNnQMw.png" /></figure><p>Part 2: Create CloudFront distribution<br>Allow HTTP methods: GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE</p><p>Step 1: AWS &gt; CloudFront &gt; Distribution &gt; Create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*zyNhL65uLSWXWdubPzwqfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*ZTfnd1qKphhWcUjepZEqRg.png" /></figure><p>Price Class</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*9r6jgbkCzNAagRdNneOInw.png" /></figure><p>Step 2: CloudFront website loads with the new domain name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0aZogRvDzhigIcCiOCUDNw.png" /></figure><p>Step 3: Website loads on the CloudFront domain name.<br>Test by registering a new email:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rfyUf209Z5dZWI7FEbmxhw.png" /></figure><p>Step 4: Email is registered on the DynamoDB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_srBw3tSfoPF9omNoAwBoA.png" /></figure><p>Part 3: Perform load testing</p><p>Step 1: Enter chmod 400 ssh-key.pem to secure the pair key<br>Navigate to one of the EC2 instances and copy the public IP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gg5yArkulgsPmofuxhBg3Q.png" /></figure><p>Step 2: Navigate to the EC2 instances and copy the public IP<br>Open AWS CloudShell<br>Enter: ssh ec2-user@34.236.192.245 -i -ssh-key.pem to login to the instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*f2lPe9iB536j4vjGSfkBgg.png" /></figure><p>Step 3: Install the stress tool to perform the load testing</p><p>sudo amazon-linux-extras install epel -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CIhXzdiZteNgjoJGBWPUqA.png" /></figure><p>Step 4: sudo yum install stress -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wOumNunSp_ENdmXv-ftDtQ.png" /></figure><p>Step 5: simulate multiple users login to the instances <br>stress -c 4</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jOQTuPwPChH-4S7KF4irw.png" /></figure><p>Step 6: Elastic Beanstalk &gt; Environments &gt; Tcbconference-env &gt; Health</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XuPH8L1k12BvmvCSR57Bkg.png" /></figure><p>Step 7: Check the events</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LakZK0vHC98Vd9rXhkDUjQ.png" /></figure><p>Step 8: One more instance created because of traffic by the autoscaling rule</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DL2kuruw4dNgyzqGPhXMow.png" /></figure><p>Step 9: Auto Scaling groups</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pernU_HsR_xNyuRz8XeRoQ.png" /></figure><p>Step 10: EC2 &gt; Auto Scaling groups &gt; Activity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E_jL-bxFY7vi97yECIu9UQ.png" /></figure><p>Step 11: Need to manually register the Target groups and register instances</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MM-wPU3yTQrevr_5GnH0nA.png" /></figure><p>Step 12: 2 instances registered</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7t3w8E5DSc2GIFEMQjVY0g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f14a7d40fd31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migration of a Workload running in a Corporate Data Center to AWS using the Amazon EC2 and RDS…]]></title>
            <link>https://medium.com/@gchingwe/migration-of-a-workload-running-in-a-corporate-data-center-to-aws-using-the-amazon-ec2-and-rds-a980d51ecfb?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/a980d51ecfb</guid>
            <category><![CDATA[aws-cloudshell]]></category>
            <category><![CDATA[rds]]></category>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[route-table]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 01:24:12 GMT</pubDate>
            <atom:updated>2022-12-13T01:24:12.092Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Migration of a Workload running in a Corporate Data Center to AWS using the Amazon EC2 and RDS service</em></h4><p><strong>Project description:</strong></p><p>In another project based in a real-world scenario, I acted as the Cloud Specialist responsible for migrating a workload running in a Corporate Data Center to AWS.<br> The application and database were migrated to AWS using the Lift &amp; Shift (rehost) model, moving both application and database data.</p><p>I followed some migration steps: Planning (sizing, prerequisites, resource naming), Execution (resource provisioning, best practices), Go-live (validation test — Dry-run, final migration — Cutover) and Post Go-live (ensure the operation of the application and user access).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lI7BI2j44WzrkMld9NlXXQ.png" /></figure><p>Prerequisites:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxKttDtl1mPY2r5exx4Akw.png" /></figure><p>A: Planning (sizing, prerequisites, resource naming)<br>In planning phase, I took an inventory of the existing application and database on the on-premise environment and map it to the AWS migration.<br>The excel below shows the planning path:</p><p>On-premise migration to AWS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uw6RPtIPjCnLJbQK8TrE-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4AzwWGf_MXRZLeWQ84s0EA.png" /></figure><p>Step 1: Create the VPC on AWS IAM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*V3dBIHT-_jsuRjwbB5gXGQ.png" /></figure><p>Step 2: Create subnets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*vQPvwmz7crhXjTyb4gs-gg.png" /></figure><p>Create the private subnets:</p><p>Private subnet 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*cvJ8lgSRIPhbr0vl_pMcjQ.png" /></figure><p>Private subnet 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*ETq808ks4BzhtiGfiWWi3g.png" /></figure><p>List of subnets created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*czUK0eF3PecU8Bv_9TnlMQ.png" /></figure><p>Step 3: Create the internet gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lr_aMlmVqXn4vNfo3twHjw.png" /></figure><p>Attach the VPC to the internet gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*6scwt7kbXTi-G85783Svgw.png" /></figure><p>Step 4: Edit Route tables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f8amDYuF2CAMEqVUMBkF2g.png" /></figure><p>Add routing for the internet gateway</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sPOFEZ0Db_AekLVvNyvAAw.png" /></figure><p>Step 5: Create and EC2 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*KrUBO8i1040wThJT5L0QOA.png" /></figure><p>click on Create new key pair</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*ocBiPCeynwW5YQfO2grwQQ.png" /></figure><p>Create key pair (login)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*q1x-ONVmBxUQvqFm4PUeLQ.png" /></figure><p>Sep 6: Edit Security Settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*CpoGvmHhETX_Cff-ibCFbg.png" /></figure><p>For demo purposes, the security group has been configured to be accessed over the internet, however in production environment, this group should never be open to the public.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAcb01ksbId68Io9k_PFDQ.png" /></figure><p>Step 7: RDS configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*qsQSNKluK64IEtHb4nnaag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*_BUNkOg-Qg-OWPk93K_vVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*Qx_c-Z3f0gPjDdinkZsBqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*TIef-PfwfGviMA_7rWJV4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*ox1GrjnGlKAZJbS_AYNjUw.png" /></figure><p>B: Login to EC2 using the AWS Cloud Shell</p><p>Step 1: Upload the pair key created in step 5 to the ~/desktop/aws folder</p><p>When you get an error permissions 0064 ‘ssh-key.pem’ are too open <br>enter the following command to make the pair key more secure<br>chmod 400 ssh-key.pem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*qLhy5hQ-SK_bT5TFJ_Y2wA.png" /></figure><p>Step 2: On login to the EC2 instance, run the sudo update command</p><p>sudo apt-get update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*9Zm_UnI2WlrYyH0_hKyqmg.png" /></figure><p>Step 3: Install python &amp; mysql client<br>sudo apt-get install python3-dev -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pB9rhNQs5UPKhezF0K52Wg.png" /></figure><p>Install mysql client<br>sudo apt-get install libmysqlclient-dev -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dkB8ttvnI7ePGj3rjETDyA.png" /></figure><p>Step 4: Install zipped files<br>sudo apt-get install unzip -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*wy4nRq4OtCu5rVi1gDllwQ.png" /></figure><p>Step 5: Install python’s library files<br>sudo apt-get install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*pjmjM29WUZOxCLPnEA7c7A.png" /></figure><p>sudo apt-get install libsasl2-dev libffi-dev -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Y9-ZemdF-r6SnGQH0_bKA.png" /></figure><p>Step 6: run curl to install pip setup tools<br>curl -O <a href="https://bootstrap.pypa.io/pip/3.6/get-pip.py">https://bootstrap.pypa.io/pip/3.6/get-pip.py</a> ; python3 get-pip.py — user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*55jkDUhQ5xDIoBFUce1fuA.png" /></figure><p>Step 7: Enter the following commands to finish installing python:</p><p>export PATH=$PATH:/home/ubuntu/.local/bin/<br>pip3 install flask</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_cScgUv8bW0C4DUKkbltw.png" /></figure><p>C: Install wtforms &amp; mysqldb</p><p>Step 1:</p><p>pip3 install wtforms<br>pip3 install flask_mysqldb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IbC_X0cWxG8ySEw-qa0Hpw.png" /></figure><p>Step 2: <br>pip3 install passlib<br>sudo apt install awscli -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nMPrPctvs2qDwpYv3L0K2g.png" /></figure><p>Step 3: install SQL client<br>sudo apt-get install mysql-client -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WERPUUQFuOjsPdPgR0Pufg.png" /></figure><p>Step 4: Go to Security &gt; Security groups &gt; Edit inbound rules</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5R49OhMkJ8iu4UmrP-ndEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X55kmB0vt9iE-UVioUxJbA.png" /></figure><p>For the purposes of this demo, change the IP address to to be available on the internet. This should never be done in a production environment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X55kmB0vt9iE-UVioUxJbA.png" /></figure><p>Ensure that source indicates 0.0.0.0/0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VnJxXrpu0Y3XwVG-MnoKfw.png" /></figure><h4>Step 5: Go to EC2 and copy and paste the public IP<br>ssh ubuntu@54.82.255.229 -i ssh-key.pem</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ug5utOXVseTvvZtSMZl6Ig.png" /></figure><p>Login to the EC2 terminal:<br>On the Cloudshell<br>cd desktop<br>cd aws<br>ssh ubuntu@54.82.255.229 -i ssh-key.pem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*gnGAON_QNtO8atyCIImEbw.png" /></figure><p>Step 6: Download provided sample zip files for application and database</p><p>wget <a href="https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/wikiapp-en.zip">https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/wikiapp-en.zip</a><br>wget <a href="https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/dump-en.sql">https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/dump-en.sql</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pB29w7w2VUldSfg73vlwNg.png" /></figure><p>Step 7: On the AWS console</p><p>Type in RDS &gt; Databases&gt; Cut and paste the end point<br>Endpoint</p><p>awsuse1db01.cr5dkir74ie6.us-east-1.rds.amazonaws.com</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Jv5J2kH6LhpR6zkC3OQ5g.png" /></figure><p>Step 8: Connect to MySQL running on AWS RDS</p><p>mysql -h awsuse1db01.cr5dkir74ie6.us-east-1.rds.amazonaws.com -P 3306 -u admin -p</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*u33pfx7B9B4AUC7B0hRDbw.png" /></figure><p>Step 9: Create the wiki DB and import data</p><p>create database wikidb;<br>use wikidb;<br>source dump-en.sql;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*BlMx8Nc7WMCF-ke2TpLuMA.png" /></figure><p>check if data is loaded</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbSQNU5Ws6K8pyahXQVYrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*NPs8EfDBV-kDbQ4PizFOUQ.png" /></figure><p>Step 10: Create the user wiki in the wikidb</p><p>CREATE USER wiki@’%’ IDENTIFIED BY ‘wiki123456’;<br>GRANT ALL PRIVILEGES ON wikidb.* TO wiki@’%’;<br>FLUSH PRIVILEGES;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*rFNUnJYz7_-rzugUEFx3RQ.png" /></figure><p>Step 11: Unzip the app files</p><p>unzip wikiapp-en.zip<br>cd wikiapp</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*HrkpQClLSPLiexDEhwxwqw.png" /></figure><p>Step 12: Edit the wiki.py file and change the MYSQL_HOST and use the RDS endpoint.</p><p>vi wiki.py<br>Replace MYSQL_HOST =<br> ‘awsuse1db01.cr5dkir74ie6.us-east-1.rds.amazonaws.com’<br>In the VI editor Esc colon : and x to save and exit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*hEZ7A7roe51wcolim2B5ug.png" /></figure><p>Step 13: Execute/Start the application<br>python3 wiki.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*QEjbhHKUs24eCV3f8AgG1w.png" /></figure><p>Step 14: Go Live session test: login to the application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpBPjoQR5kGuhoJd9xyUmA.png" /></figure><p>Step 15: Login to the application as an admin and add an article to test if application is working</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IrsGd3paJlpA8Rg8G26eLQ.png" /></figure><p>References<br>The images and technical information have been extracted and summarized based on the official AWS public documentation. All copyrights belong to their respective owners.</p><p><a href="https://aws.amazon.com/pt/ec2/instance-types/">https://aws.amazon.com/pt/ec2/instance-types/</a><br><a href="https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/ebs-volume-types.html">https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/ebs-volume-types.html</a><br><a href="https://aws.amazon.com/pt/s3/features/replication/">https://aws.amazon.com/pt/s3/features/replication/</a><br><a href="https://aws.amazon.com/pt/dynamodb/">https://aws.amazon.com/pt/dynamodb/</a><br><a href="https://docs.aws.amazon.com/pt_br/redshift/latest/mgmt/welcome.html">https://docs.aws.amazon.com/pt_br/redshift/latest/mgmt/welcome.html</a><br><a href="https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/AmazonEBS.html">https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/AmazonEBS.html</a><br><a href="https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/AmazonEBS.html">https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/AmazonEBS.html</a><br><a href="https://docs.aws.amazon.com/pt_br/AmazonS3/latest/userguide/GetStartedWithS3.html">https://docs.aws.amazon.com/pt_br/AmazonS3/latest/userguide/GetStartedWithS3.html</a><br><a href="https://docs.aws.amazon.com/pt_br/AmazonRDS/latest/UserGuide/Welcome.html">https://docs.aws.amazon.com/pt_br/AmazonRDS/latest/UserGuide/Welcome.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a980d51ecfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated user migration and management of AWS Identity and Access Management (IAM) resources]]></title>
            <link>https://medium.com/@gchingwe/automated-user-migration-and-management-of-aws-identity-and-access-management-iam-resources-7d7e1f9e0c94?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d7e1f9e0c94</guid>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[mfa]]></category>
            <category><![CDATA[aws-iam-policy]]></category>
            <category><![CDATA[user-migration]]></category>
            <category><![CDATA[aws-user-group]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Fri, 09 Dec 2022 02:01:29 GMT</pubDate>
            <atom:updated>2022-12-09T02:01:29.649Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Project description:</strong></p><p>In this project based on a real-world scenario, I acted as Cloud Specialist with the mission to migrate users in an automated way and manage AWS IAM (Identity and Access Management) resources.</p><p>There were 100 users that needed to be migrated and have MFA (Multi-factor authentication) enabled on their accounts, as this is a security best practice.</p><p>To avoid repetitive and manual tasks in the AWS console, I needed to think about automating the processes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xJSBB87Yz6VkiizgA_BMiw.png" /></figure><p>Solution Architecture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHfljx4Vp95tlBpUSP6vYg.png" /></figure><p>Step 1: Open the AWS Cloud Shell<br>Install dos2unix on AWS Cloud Shell (required by the script)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*682JJe90YcOEwxFgpWBbFw.png" /></figure><p>Step 2: Download the aws-iam-create-user.sh script command to the AWS CloudShell</p><p>wget <a href="https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/aws-iam-create-user.sh">https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/aws-iam-create-user.sh</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CJMb6zBTYH-pC2_slVtUBQ.png" /></figure><p>Step 3: Give the proper permission to aws-iam-create-user.sh script<br>chmod +x aws-iam-create-user.sh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*k7Bwa1sukUkJkBAH_Wz4Ew.png" /></figure><p>Step 4: From the shell click on Actions&gt; upload file &gt; Select file to be uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AiQq2wvMEi9SvGjAjdiWLQ.png" /></figure><p>Select file to be uploaded user2.csv</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*m3hJAprvPqV0Vr1pGL_x2Q.png" /></figure><p>Enter the ls -ltr command to list files in directory and verify that user2.csv has been uploaded</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V75InwqRAAW1L5gPwM960Q.png" /></figure><p>Step 5) Run the script aws-iam-create-user.sh to create the IAM users</p><p>./aws-iam-create-user.sh users2.csv</p><p>Screenshot below shows that the users have already been uploaded</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LQMkjHH5TxDCoBttzko3Tg.png" /></figure><p>Delete the users in the console and recreate again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*EOqplCM_WY0r_42a3PFDeg.png" /></figure><p>Step 6: Access the IAM and view the users:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KH-zsT179e6LPVD0aQ9ZtA.png" /></figure><p>Step 7: Allow users to change their passwords the first time they login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GAV4dSEZlmTHEN-nwEXEcA.png" /></figure><p>Check “Allow users to change their own passwords”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWI4YkLYLKGBN35SGO3C6A.png" /></figure><p>Step 8: Provide AWS URL for users to login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9guWDh-0HRxXT1kh9MRPrA.png" /></figure><p>Step 9: After the user enters their password, the first screen prompts for the password to be changed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JtSYkAD5FWAv_duTLfkzw.png" /></figure><p>Step 10: The screenshot below shows user Brian Garcia has been granted limited access to AWS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wlZ_oljSKdPy2YERiCAVqA.png" /></figure><p>Step 1: Adding the Multi Factor Authentication (MFA)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXj2rJ04a6-oS1gD6A1mGQ.png" /></figure><p>Step 2: Select Add MFA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kO2jJB0uR6JmYM9VRZs53A.png" /></figure><p>Step 3: Manage MFA device</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXBA8TawLOjJWso76LWQBw.png" /></figure><p>Step 4: Install and configure Google authenticator on the mobile phone, scan the QR code provided.<br>The next step will ask you to enter 2 authenticator unique numbers. After this the MFA is configured:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4CSphRi7xnsR4qIQ227qTA.png" /></figure><p>Step 5: Create a policy using the json file provide.<br>AWS Shell&gt; Policies &gt; Create Policy&gt; Paste the json text in the json tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8yO0embbK1YOtj4C85x1Q.png" /></figure><p>Step 6: Create MFA policy</p><p>Attached EnforceMFAPolicy to each user group:<br>IAM &gt; User Groups &gt; CloudAdmin &gt; Add Permissions &gt; Attach policy &gt; EnforceMFAPolicy<br>Repeat this process for all the groups</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eOZLwCygiyG5yROr5Y28lw.png" /></figure><p>Step 7: Test MFA for user Brian Garcia</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cVn02N4B-yus3WutspHfxg.png" /></figure><p>Step 8: Setup permissions failed — LinuxGroup needs to have the administrative access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2XwNbUySFtefp779R7_0g.png" /></figure><p>Step 9: Assign administrative Access to user Brian Garcia. Go through the MFA authentication setup. Log out and login back-in. Login screen will prompt for the MFA key. Type key provided on your phone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHDP7gi2UCKXtYr8G0KEEg.png" /></figure><p>Step 10: Go to IAM &gt; User Groups &gt; Permissions &gt; Permission policies to view the policy names:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j3NaU0DY_jUWnmfLjw5DsQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d7e1f9e0c94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deployment of a Web Application to automate talent onboarding using HTML / CSS / JS / BS…]]></title>
            <link>https://medium.com/@gchingwe/deployment-of-a-web-application-to-automate-talent-onboarding-using-html-css-js-bs-c7cc09a22c34?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7cc09a22c34</guid>
            <category><![CDATA[cloud-marketplace]]></category>
            <category><![CDATA[deployment-manager]]></category>
            <category><![CDATA[moodle]]></category>
            <category><![CDATA[cloud-functions]]></category>
            <category><![CDATA[cloud-buckets]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 03:32:14 GMT</pubDate>
            <atom:updated>2022-12-05T03:32:14.028Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Deployment of a Web Application to automate talent onboarding using HTML / CSS / JS / BS (Front-end) + Python Flask (Back-end) with Cloud Storage and Cloud Functions 100% Serverless — Part 2</em></h4><p><strong>Project description:</strong></p><p>In this project based on a real-world scenario, I acted as a Cloud Expert in the deployment of a Web Application to automate the HR onboarding process. By filling out a form, the user is created in the Training Portal in a fully automated way.</p><p>To deploy this solution, I used a Moodle image available on GCP Marketplace, where the REST API had been enabled, running on Compute Engine, front-end on Cloud Storage, and the back-end on Cloud Run.</p><p>I deployed the back-end using Python Flask using Cloud Functions, 100% Serverless. Then, I deployed the front-end using HTML/CSS/JS/BS on Cloud Storage to store the static files of the Web Application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2aRnf4W2RMu0cWmz4oo-ag.png" /></figure><p>Solution Architecture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AjvS3HuoTNZ1pUkEeRrPZA.png" /></figure><p>Step 1: Login to the moodle website created in the previous module.<br>Go to :<br>&gt;site administration<br>&gt;server <br>&gt;web services<br>&gt;enable web services <br>&gt;check the default option as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rN_lLmem0abdAW7ZMgghKQ.png" /></figure><p>Step 2: Go to site administration :<br>&gt;site administration<br>&gt;server <br>&gt;web services<br>&gt;Manage protocols<br>&gt;Enable REST protocol option as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HojmyqkMlTC_FAvPpRrqyQ.png" /></figure><p>Step 3: Web services and protocols are both enabled now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ztimk6v7gQsit9pQeH-Zig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HojmyqkMlTC_FAvPpRrqyQ.png" /></figure><p>Step 4: Enable External Service<br>Go to site administration :<br>&gt;site administration<br>&gt;server <br>&gt;web services<br>&gt;Select a service (Option 5)<br>&gt;Add &gt; External service as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ybIgpOIqAgWQdskksdBEKQ.png" /></figure><p>Step 5:Enable External Service<br>Go to site administration :<br>&gt;site administration<br>&gt;server <br>&gt;web services<br>&gt;External Services &gt; Click on functions<br>&gt;Add function <br>&gt;in the search box enter core_user_create_users <br>&gt;Click on add</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-Po2aCEaJYnQsiuQ1Wo_A.png" /></figure><p>function should be added as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MJKpajZpT7EfH6Svr8GwNQ.png" /></figure><p>Step 5: Add a user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGbbiHupJKSpKdvdd5nGbQ.png" /></figure><p>Step 6: Create Token<br>Go to site administration :<br>&gt;site administration<br>&gt;server <br>&gt;web services<br>&gt;click on create Token (option 8)<br>&gt;Create Token<br>&gt;User = Admin user <br>&gt;Service= webservice<br>&gt;Save changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*edNNUiQcWBPhyvh7-0zTGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzhbMO2d-Pp7r3AQQqKKCg.png" /></figure><p>Once the token is created cut-and-paste the token for later reference<br>356d426d265d64ac8202f9c22eba1502<br>Also take note of the external IP address of the Moodle website:<br><a href="http://35.196.152.33/admin/webservice/tokens.php">35.196.152.33</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YSCuXwviiVCJpSmWFl8-Xw.png" /></figure><p>Step 7: Open Google cloud shell and enter the following command to add a new user (Use the IP address and token from Step 6):<br><strong>curl -g “</strong><a href="http://35.196.152.33/webservice/rest/server.php?wstoken=356d426d265d64ac8202f9c22eba1502&amp;moodlewsrestformat=json&amp;wsfunction=core_user_create_users&amp;users[0][username]=929316&amp;users[0][email]=you39@yourhost.org&amp;users[0][lastname]=Test1&amp;users[0][firstname]=Moodle&amp;users[0][password]=P@40ssword123"><strong>http://35.196.152.33/webservice/rest/server.php?wstoken=356d426d265d64ac8202f9c22eba1502&amp;moodlewsrestformat=json&amp;wsfunction=core_user_create_users&amp;users[0][username]=929316&amp;users[0][email]=you39@yourhost.org&amp;users[0][lastname]=Test1&amp;users[0][firstname]=Moodle&amp;users[0][password]=P@40ssword123</strong></a><strong>&quot;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4J7ij0GJWQfWsnZMbWe9TQ.png" /></figure><p>New user created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tESyaa4gelUKGONdsoYQAA.png" /></figure><p><strong>Deploying a Cloud Function</strong></p><p>Step 1: <strong>Downloading the application code:</strong></p><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-final-project.zip">https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-final-project.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tgHPmBtQunFxmVlH-02kDg.png" /></figure><p>Step 2: Create a new cloud function<br>Click on <strong>Create Function</strong></p><ul><li>Section <strong>Basics<br>Function name: </strong>moodleUserCreate</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6fO1ac4mZwrmhXpCVd6GYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DP6lq1U_ALFiyGw1IV8pgQ.png" /></figure><p><strong>Step 3: Adding environment variables | RUNTIMIME, BUILD, CONNECTIONS AND SECURITY SETTINGS</strong></p><ul><li>From <strong>Runtime environment variables</strong>, add 02 Variables</li><li><strong>Name: </strong>MOODLE_TOKEN</li><li><strong>Value: </strong>insert the token generated</li></ul><p>Add Variable</p><ul><li><strong>Name: </strong>MOODLE_SERVER</li><li><strong>Value: </strong>insert the Moodle Public IP Server</li><li>Click on <strong>Next</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*MgGnICES3uqEJRjykYysyA.png" /></figure><p>Step 4: Copy the content of the main.py</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0xvblZP4xZWgOytPNZALNQ.png" /></figure><p>Step 5: Paste the content of main.py from step 4 in the cloud function below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TGk9R8ioEkp8Qc9azKZ4TA.png" /></figure><p>Step 6: Copy the content of the requirements.txt file from the backend unzipped file (Refer to step 4 for details).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4B20XGKbfMVuecrDxB5EFQ.png" /></figure><p>Click on deploy to create the function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hp7ksxHa2_zX92koghMjEQ.png" /></figure><p>Check that all the artifacts were created successfully</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9lx5vq06IOmWQqtHNz09A.png" /></figure><ul><li>From the <strong>Cloud Shell</strong>, check if the function is working:</li></ul><p>curl -X POST -F ‘inputName=Gregory’ -F ‘inputLastname=Chingwe’ -F ‘<a href="/service/mailto:inputEmail=gc.cloud221119@gmail.com">inputEmail=gc.cloud221119@gmail.com</a>’ <a href="https://us-central1-prod-moodle-ctp-20221203.cloudfunctions.net/moodleUserCreate">https://us-central1-prod-moodle-ctp-20221203.cloudfunctions.net/moodleUserCreate</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVhA8lasol_YtYAkmcWm-w.png" /></figure><p>Check the logs to make sure there are no errors. Initially, I had a space in front of the MOODLE_TOKEN variable and the test failed. I removed the space and it worked successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWQtBLhnM8Oj3SPGml4ozw.png" /></figure><p>Step 7: Go to the Moodle website and check if the user was created</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T9LCx3ut3uRmnXaxEffVdg.png" /></figure><p><strong>Setting up the Frontend</strong></p><ul><li>Step 1: Using the <strong>Cloud Editor</strong>, edit the file <strong>~/bootcamp-gcp-final-project/frontend/index.html</strong> <br>In the <strong>action</strong>, replace the info to the <strong>Trigger URL</strong>.<br>&lt;form id=”form-submit” class=”form-submit” <br>action=”<strong>https://us-central1-prod-moodle-ctp-20221203.cloudfunctions.net/moodleUserCreate</strong>&quot;</li><li>Save the file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VgFBjYzBW4e_LtecczhVRg.png" /></figure><p>Step 2: Let’s create a Bucket (Cloud Storage) using the <strong>Cloud Shell</strong></p><p>gsutil mb gs://tcb-gl-onb-<strong>gregorychingwe</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*1VPt0exSwljrRBsbisT8-g.png" /></figure><ul><li>Uploading the Frontend files to the bucket created:</li></ul><p>cd ~/bootcamp-gcp-final-project/frontend/</p><p>gsutil cp * gs://tcb-gl-onb-gregorychingwe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4KM9NMCz_hEhGwoanSrSMg.png" /></figure><ul><li>Setting up the Bucket<br>gsutil web set -m index.html -e 404.html gs://tcb-gl-onb-gregorychingwe</li><li>Change permissions on files to be public accessible <br>gsutil iam ch allUsers:objectViewer gs://tcb-gl-onb-gregorychingwe</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HD9hd7ywbNqNxqb-vrmj2w.png" /></figure><p>Step 3: Navigate to the Cloud bucket created in step 2<br><strong>Buckets &gt; tcb-onb-gregorychingwe &gt; index.html<br></strong>Copy the public URL and paste it in a new window</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6AsyGMFwfe3EkSQgTymMCg.png" /></figure><p>Step 4: Public URL -<a href="https://storage.googleapis.com/tcb-gl-onb-gregorychingwe/index.html">https://storage.googleapis.com/tcb-gl-onb-gregorychingwe/index.html</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1_GbrX-DglwYMcRgHBRQtQ.png" /></figure><p>Step 5: Enter a new user to verify if the process works</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZ0dRYtroJJiTV6kClBn6A.png" /></figure><p>Step 6: Verify that the new user is entered on the Moodle website:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtopS83QokmrbcQ78082LQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7cc09a22c34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deployment of Corporate Training Portal on Google Cloud Platform using Deployment Manager, Google…]]></title>
            <link>https://medium.com/@gchingwe/deployment-of-corporate-training-portal-on-google-cloud-platform-using-deployment-manager-google-ec54cb8f8b89?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec54cb8f8b89</guid>
            <category><![CDATA[cloud-deployment-manager]]></category>
            <category><![CDATA[moodle]]></category>
            <category><![CDATA[cloud-marketplace]]></category>
            <category><![CDATA[cloud-storage]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Sun, 04 Dec 2022 14:10:56 GMT</pubDate>
            <atom:updated>2022-12-04T14:10:56.411Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Deployment of Corporate Training Portal on Google Cloud Platform using Deployment Manager, Google Compute Engine &amp; Cloud Storage — Part 1</em></h4><p><strong>Project description:</strong></p><p>In another real-world based project, I acted as a Cloud Specialist to implement a corporate training portal for employees. Moodle was the platform chosen to provide the training, and it’s one of the most popular e-Learning platforms among companies and universities around the world.</p><p>We used the Deployment Manager and a Moodle image, available on GCP Marketplace, using the resources of a Compute Engine.</p><p>To store the training files, in order to comply with high availability (HA) issues, we used the Cloud Storage bucket service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQqj6Axk-7GHMv7czJFOtg.png" /></figure><p>Step 1: In Google Cloud Search for Deployment Manager and enable APIs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*5dou6hykVCSIkYJLoOvHzw.png" /></figure><p>Step 2: Go to Google Cloud Marketplace and search for Moodle as shown in screenshot below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HHh4s1nkRgrIK1rk8bIXuw.png" /></figure><p>Step 3: Click on launch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*bYdC8H2uJffUqGw811cMgg.png" /></figure><p>Step 4: Enbale additional required APIs as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1h8NBjk4-Rkd0FZdIFBNqA.png" /></figure><p>Step 5: Configure settings for a new Moodle deployments as shown in the screenshot and deploy the application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gH_54poQrQ_Ee9zUySQK4w.png" /></figure><p>Deploment options continued</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XAKhFeennnUZGD4iF-PcYw.png" /></figure><p>Step 6: Search for Cloud storage and create a new bucket with the options shown in the screen shot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1XbwHif9xXCTuYHkM2WOMQ.png" /></figure><p>Step 7: Upload iLearnPDF and iLearnVideo as shown in the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qxiQmWDi9vbErqYj7VAnSA.png" /></figure><p>Step 8: Edit permissions for mp4 file and grant public access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*9THy4eCr8BQC1rOLC594bw.png" /></figure><p>Public URL for the MP4 is available as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Ed0z4KAxJGQhkNfq3aObQ.png" /></figure><p>Step 9: Edit permissions for PDF file and grant public access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*wrrYjmZOsUg_HCBRL5lISw.png" /></figure><p>Public URL for the PDF is available as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nNM8QFEMpVRNw3S2yI05dw.png" /></figure><p>Step 10: Open the deployment manager and open moodle-1 as shown below: Take note of the user: admin and the password ######</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oh7UDJwReZQY0_Mq2vzosw.png" /></figure><p>Step 11: Go to compute engine and cut-and-paste the external IP for the application as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Os-esOqrasUY_oF_u3h_w.png" /></figure><p>Step 12: Login to the Moodle site as an admin (Use credentials from step 10) and start editing the site</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DfpnmA_lJJHGR2atDyYZZg.png" /></figure><p>Step 13: Dashboard-Site administration-appearance-logos<br>upload the logo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wd5tiqLZJuSe-MVLLdAzdA.png" /></figure><p>Step 14: Go to Site Administration-Front Page — and enter details as show below: Save the changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xRH8SWRwEoUf58FA0G-2gw.png" /></figure><p>Step 15: To view the changes logout and log back in</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G95ku3rMZ52nGjy5bEoQsg.png" /></figure><p>Step 16: Go to settings and enable Turn editing on:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LcpcU243CJeHBZp9Hx3ZYg.png" /></figure><p>Step 17: Add new page — Name: Welcome, Short Name : WLM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J8xlrm_GcRyZ4UUo3tXNFQ.png" /></figure><p>On Course description insert media as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*7OO2gcTezlsTR86xM8VesA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ws-oyoO9AQ_qTfux--UXzQ.png" /></figure><p>Step 18: Add link to the PDF right below the video</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2_MUaMY2qbcwY6F0S7K-w.png" /></figure><p>Step 19: Logout and log back in and go to Site home:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87Hu9lkcqX61DFnBXw75CQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec54cb8f8b89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migration of Standalone Application and Database from VM (Google Compute Engine) to a modern…]]></title>
            <link>https://medium.com/@gchingwe/migration-of-standalone-application-and-database-from-vm-google-compute-engine-to-a-modern-6ad4219c3e46?source=rss-b548df936349------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ad4219c3e46</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[google-compute-engine]]></category>
            <dc:creator><![CDATA[Gregory Chingwe]]></dc:creator>
            <pubDate>Sat, 03 Dec 2022 18:34:07 GMT</pubDate>
            <atom:updated>2022-12-03T18:34:07.755Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Migration of Standalone Application and Database from VM (Google Compute Engine) to a modern architecture, using Google Kubernetes Engine (APP) + Cloud SQL (DB) with HA</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GRsqh7qk9fYObyxShOM6vQ.png" /></figure><p><strong>Project description:</strong></p><p>In another amazing project based on a real-world scenario, I acted as a Cloud Specialist to migrate the Compute Engine (VM) application and database to the Australia region.</p><p>Once the region migration was completed, the task was to modernize the application. I had to migrate resources running on Google Compute Engine (VMs) to a modern and containerized architecture using Google Kubernetes Engine (GKE) managed services, and Cloud SQL for the database layer, including high availability (HA).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCzj51wm8lnml9GVXbr_Yw.png" /></figure><p><strong>Step 1: Creating the instances in the Australia region</strong></p><ul><li><strong>On the Cloud Shell create the GCE Application instance:</strong></li></ul><p>gcloud compute instances create aus-app01 — project=prod-project-89249 — zone=australia-southeast2-c <br> — machine-type=n1-standard-1 — image=debian-10-buster-v20220621 — image-project=debian-cloud — boot-disk-size=10GB <br> — boot-disk-type=pd-standard — boot-disk-device-name=aus-app01</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JMfy5W9UNekAPeVaxDdoiA.png" /></figure><ul><li><strong>On the Cloud Shell create the GCE Database instance:</strong></li></ul><p>gcloud compute instances create aus-db01 — project=prod-project-89249 — zone=australia-southeast2-c <br> — machine-type=n1-standard-1 — image=debian-10-buster-v20220621 — image-project=debian-cloud <br> — boot-disk-size=10GB — boot-disk-type=pd-standard — boot-disk-device-name=aus-db01</p><p><strong>Step 2: Installing, Setting up and Creating DB in the aus-db01 instance</strong></p><p><strong>Run these commands for OS update, repository and package installation:</strong></p><p>sudo apt update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Z5nVbRQU1cE-5MW8bu0Vw.png" /><figcaption>\</figcaption></figure><p>sudo apt-get -y install wget</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*Uqlfgrk6psMADTb-l3Z17Q.png" /></figure><p>wget <a href="http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb">http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gWwxS8e7TJodWGXnSX-HWQ.png" /></figure><p>sudo dpkg -i mysql-apt-config_0.8.13–1_all.deb<br>Select the option: <strong>OK</strong></p><p><strong>Step 3: Installing the MySQL Server</strong></p><p>sudo apt-key adv — keyserver keyserver.ubuntu.com — recv-keys 467B942D3A79BD29</p><p>sudo apt update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*twr2U7MxoXbHKGLavQuDBw.png" /></figure><p><strong>sudo apt install mysql-server -y</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tshm11YUVBRSp5nSDJ4NsA.png" /></figure><ul><li>Insert and repeat the password: <strong>welcome1<br></strong>Click on <strong>Ok</strong>.</li><li>Select <strong>default authentication plugin</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62N7Xyg_xRxHz_XkvRAnkw.png" /></figure><p>sudo mysql_secure_installation</p><ul><li>Inform the password: <strong>welcome1<br></strong>Answer <strong>N for all questions</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*zdGTt7lxy3v5Wil3tKgdew.png" /></figure><p><strong>Step 4: Downloading the .sql file:</strong></p><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-db-en.sql">https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-db-en.sql</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WPSBetrOQdYUQEUdlRYlVg.png" /></figure><p><strong>Connecting to DB</strong></p><p>mysql -u root -p<br>Type the password: WELCOME<strong>1<br>Creating the ‘db’ and ‘tables’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*IvsQNvDS6ciSygtTuS4B9g.png" /></figure><p>source bootcamp-gcp-storage-db-en.sql</p><p><strong>Step 5: Setting up the VM aus-app01 for the Application</strong></p><p><strong>Updating the OS and the packages</strong></p><p>sudo apt-get update<br>sudo apt-get install -y npm<br>sudo apt-get install -y zip<br>sudo apt-get install -y wget</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h23AklYdBbFyEZ3XdJ1WvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clCgeotnWijMDf8zCrirWA.png" /></figure><p>sudo apt-get install -y zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y-XXWebGn39Qp8alRDA-pw.png" /></figure><p>sudo apt-get install -y wget</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZSy_FEHu57qAtiuTa70Neg.png" /></figure><p><strong>Step 6: Creating and accessing the folder to download application files (Node.js)</strong></p><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-clinic-mid-app.zip">https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-clinic-mid-app.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdYkA3I9BZMjr_w1xONhVw.png" /></figure><p>unzip bootcamp-gcp-storage-clinic-mid-app.zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*Zsc7ZsnsigZ9lsmMes1D3w.png" /></figure><p>From the folder <strong>bootcamp-gcp-storage-clinic-mid-app,</strong> <br>run the following command to edit the file <strong>index.js</strong></p><p>nano src/index.js<br>host: to the Private IP address of the vm aus-db01.<br>user: to app,<br>password: to welcome1<br>database: to clinic</p><p>And <strong>save</strong> the file!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*b_YGyOksHZRuQYWcdSzXyA.png" /></figure><p>Run the npm install command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*Jabqf3T63v_DlfUHf92ccQ.png" /></figure><p><strong>Step 7: Migration of a Stand-Alone Application and Database from GCE (VM) to a Modern Architect using GKE (App) + Cloud SQL (DB) with HA</strong></p><p><strong>Creating the instances in the Australia region</strong></p><ul><li><strong>From the Cloud Shell:</strong></li></ul><p>gcloud compute instances create aus-app01 — project=$DEVSHELL_PROJECT_ID — zone=australia-southeast2-c — machine-type=n1-standard-1 — image=debian-10-buster-v20220621 — image-project=debian-cloud — boot-disk-size=10GB — boot-disk-type=pd-standard — boot-disk-device-name=aus-app01</p><p>gcloud compute instances create aus-db01 — project=$DEVSHELL_PROJECT_ID — zone=australia-southeast2-c — machine-type=n1-standard-1 — image=debian-10-buster-v20220621 — image-project=debian-cloud — boot-disk-size=10GB — boot-disk-type=pd-standard — boot-disk-device-name=aus-db01</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9az4Wfkd7c03UZJ7wVf61g.png" /></figure><p><strong>Step 8: Installing, Setting up and Creating DB in the aus-db01 instance</strong></p><p><strong>Run these commands for OS update, repository and package installation:</strong></p><p>sudo apt update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*10WGbOHwWOtZ6ahbeOK5Ug.png" /></figure><p>sudo apt-get -y install wget</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aS3lxSt-g2_x4PZUSkiiig.png" /></figure><p>wget <a href="http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb">http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLoBQJeYJViJWpzex9fJRQ.png" /></figure><p>sudo dpkg -i mysql-apt-config_0.8.13–1_all.deb<br>Select the option: <strong>OK</strong></p><p><strong>Step 9: Installing the MySQL Server</strong></p><p>sudo apt-key adv — keyserver keyserver.ubuntu.com — recv-keys 467B942D3A79BD29</p><p>sudo apt update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opMxom5OStqwikmjVcKdhw.png" /></figure><p>sudo apt install mysql-server -y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pW-2USPv5FKUjOiF1c_4Fg.png" /></figure><ul><li>Insert and repeat the password: <strong>welcome1</strong></li></ul><p>Click on <strong>Ok</strong>.</p><ul><li>Select <strong>default authentication plugin</strong></li></ul><p>Select <strong>Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)</strong></p><p><strong>Restarting the MySQL service:</strong></p><p>sudo systemctl restart mysql.service</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*lQ21ErVoLRYe65nQnRLzLg.png" /></figure><p>sudo mysql_secure_installation</p><ul><li>Inform the password: <strong>welcome1</strong></li><li>Answer <strong>N for all questions</strong></li></ul><p><strong>Downloading the .sql file:</strong></p><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-db-en.sql">https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-db-en.sql</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GfKMedFapLxjKulLlUfEXw.png" /></figure><p>mysql -u root -p</p><p>Type the password: <strong>welcome1</strong></p><p><strong>Creating the ‘db’ and ‘tables’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NgWioAxARpZdkZwToFODiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*TyXSNmBsLWo1m11i2uvGZA.png" /></figure><p>source bootcamp-gcp-storage-db-en.sql</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*HzDtlM9qyFHCc8Uvo2Q-ig.png" /></figure><p><strong>Step 10: Creating an user and changing the privileges</strong></p><p>CREATE USER app@’%’ IDENTIFIED BY ‘welcome1’;<br>GRANT ALL PRIVILEGES ON clinic.* TO app@’%’;<br>FLUSH PRIVILEGES;<br>exit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*OElCRBLt-3UfkZXIOyROZw.png" /></figure><p><strong>Setting up the VM aus-app01 for the Application</strong></p><p><strong>Updating the OS and the packages</strong></p><p>sudo apt-get update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zlxsFPMvMl-JMpEUHA3rAg.png" /></figure><p>sudo apt-get install -y npm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*19EWTm2iLzfEZe2FT6Ojgg.png" /></figure><p>sudo apt-get install -y zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wwd8TLo1HiLPPNhXyebL6g.png" /></figure><p>sudo apt-get install -y wget</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJYt9qmcBpB5r4tqC4qZmg.png" /></figure><p><strong>Step 11: Creating and accessing the folder to download application files (Node.js)</strong></p><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-clinic-mid-app.zip">https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-storage-clinic-mid-app.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YWO1H3GSNSNMBiNqZ53HSQ.png" /></figure><p>unzip bootcamp-gcp-storage-clinic-mid-app.zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*ATJFIUCGxiNeniEDag8G7Q.png" /></figure><p>From the folder <strong>bootcamp-gcp-storage-clinic-mid-app,</strong> <br>run the following command to edit the file <strong>index.js</strong></p><p>nano src/index.js</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jy_71Q3mnDGKHg1HI5sRhg.png" /></figure><p>Once inside of the file <strong>index.js</strong>, in the <strong>Middlewares</strong> section, replace:</p><p>host: to the Private IP address of the vm aus-db01.<br>user: to app,<br>password: to welcome1<br>database: to clinic</p><p>And <strong>save</strong> the file!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*COHCyYBFN4fVa8vMNfqBjg.png" /></figure><p><strong>Creating a firewall rule to allow the TCP access on 3000 port</strong></p><p>From <strong>Firewall</strong> services, click on <strong>Create Firewall Rule</strong>:</p><ul><li>Name: <strong>allow-app-port-3000</strong></li><li>Targets: <strong>All instances in the network</strong></li><li>Source IP ranges: <strong>0.0.0.0/0</strong></li><li>Select <strong>TCP</strong> and the port <strong>3000</strong></li><li>Click on <strong>Create</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vhZb89FdbWAgxtvAKjKLIw.png" /></figure><ul><li>Copy the <strong>public IP</strong> of the instance <strong>aus-app01</strong> and paste in the browser</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-g2klAjD_09jKaeZS0DKlg.png" /></figure><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-module-db.zip">https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-module-db.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U2VErf9yXYqB9xOOQxORBg.png" /></figure><p>sudo apt-get install unzip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H9EzIcV-N8i9CFNsdPTCUA.png" /></figure><p>unzip bootcamp-gcp-module-db.zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*YSvGDUCa1nLv8dx--P_E8A.png" /></figure><p>cd ~/bootcamp-gcp-module-db/database<br><br>mysql -u root -p</p><p>Password: <strong>welcome1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*u9xE64B6otwu1I1hhz8Jdg.png" /></figure><p>source load_clinic.sql</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*ZUHRK1ADIO-hT9JInqfCGA.png" /></figure><p>Step 12: Now, access the application via browser, and check if the records were loaded successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3mo23_JaL1bkhyifDfW2lQ.png" /></figure><ul><li>Creating Cloud SQL instance (Australia region)</li><li>Instance ID: tcb-gcp-aus-db01;</li><li>Password: welcome1;</li><li>Version: MySQL 5.7;</li><li>Region: (australia-southest1);</li><li>Enable HA: Multiple Zones;</li><li>Primary zone: australia-southest1-a</li><li>Secondary zone: australia-southest1-b</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*meeKicI29HK1dstRoOtE3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kax14yB754fnDcGtdLcYyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*kaQKfhL1U9sCOQyTTyw27g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZVafxdyM1o4kYQN3zKd4bw.png" /></figure><p><strong>Step 13: Containerizing (docker) the application</strong></p><ul><li>Open the Cloud Shell</li><li>Downloding the application files</li></ul><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-module-db.zip">https://storage.googleapis.com/bootcamp-gcp-en/bootcamp-gcp-module-db.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nO9E_N9h758nDPAHEm21BQ.png" /></figure><p>unzip bootcamp-gcp-module-db.zip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*q9v2OGvXbvg97wOLhTT-bw.png" /></figure><ul><li>Creating a new image:</li></ul><p>cd ~/bootcamp-gcp-module-db/app</p><p>docker build -t tcb-clinic-app .<br>If docker is not installed on your machine, follow the steps below:</p><p># Create User sudo adduser apps <br>sudo usermod -aG sudo app<br>su app<br>sudo ls <br>exit su — apps <br># Install Docker and Docker Compose sudo apt-get -y update curl -fsSL <a href="https://www.youtube.com/redirect?event=video_description&amp;redir_token=QUFFLUhqbGVYbTdhandQS1FLNEhEMEtYSGR1TXMyQTkyZ3xBQ3Jtc0tscTB0ajRUaFBjb2ZXNW1hQ1hFM3J5bFpJM0QxcXJSTUdodjNhemdaOGZqNE5INEdjekFITERtMlFlOU5zeTk5c2VRWGtzbk9QS0FYSWdvRF9ZUDNYZ3M1TDh1VERVdVQ0d3JlS1NRNmk3ZkN5SHVhbw&amp;q=https%3A%2F%2Fdownload.docker.com%2Flinux%2Fubuntu%2Fgpg&amp;v=4tG22Fn_dbI">https://download.docker.com/linux/ubu...</a> | sudo apt-key add — <br>sudo add-apt-repository “deb [arch=amd64] <a href="https://www.youtube.com/redirect?event=video_description&amp;redir_token=QUFFLUhqbGROV2dQMUxaelNJV1NIZnZLSnI1UktKQUtKUXxBQ3Jtc0ttMmdkbjh5ajFmRUJiYXdJT1U3Wm01VWRLMnlEQmVYNUZzRlFIUEw2aVdxeHdQQ3FxWm9FZG0yODE1YzRPX3BrVmVBb0NlVG5UYUpIUmlBSmhpZUpqaGVGdHlPeEtQdUNvMHpPT3c5OUw1ZFgzaE5YTQ&amp;q=https%3A%2F%2Fdownload.docker.com%2Flinux%2Fubuntu&amp;v=4tG22Fn_dbI">https://download.docker.com/linux/ubuntu</a> $(lsb_release -cs) stable” <br>sudo apt-get install -y docker-ce <br>sudo curl -L “<a href="https://www.youtube.com/redirect?event=video_description&amp;redir_token=QUFFLUhqa2ZFeklsMmJEODV2eE1CMXBJQkFXWEZXUmhzQXxBQ3Jtc0tuaUtpTktlZldEOXVkZ1REb3A0M1RJVk5DS2ZwQWxtZlJGa1RvQlUtLWZKd0JidTAxbjEzSE1OR0RZb3NBWFlhMl95MXZaY2FydWhBbVNqUFFVOGpBUHNNSy1DUXprcW5uRlpMQkVsVjN4N1ZlVnZ3SQ&amp;q=https%3A%2F%2Fgithub.com%2Fdocker%2Fcompose%2Freleases%2Fdownload%2F1.25.4%2Fdocker-compose-%24%28uname&amp;v=4tG22Fn_dbI">https://github.com/docker/compose/rel...</a> -s)-$(uname -m)” -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose sudo groupadd docker sudo usermod -aG docker $USER</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yzFMGsmt39asKs19wlxFxg.png" /></figure><ul><li><strong>Adding tag and uploading it to the Container Registry</strong></li></ul><p>docker tag tcb-clinic-app asia.gcr.io/MY_PROJECT_ID/tcb-clinic-app:latest</p><p>docker push asia.gcr.io/MY_PROJECT_ID/tcb-clinic-app:latest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owe1K28Jvr9KNThWR7WVpA.png" /></figure><p>Step 14: Creating the Kubernets Engine Service</p><ul><li>From the Kubernetes Engine services, click on [+] Create | Autopilot cluster | Configure</li><li>Name: autopilot-cluster-1</li><li>Region: australia-southeast1</li><li>Click on Create.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*gLy9kcpXtkrR-2FomUC8hQ.png" /></figure><ul><li>In the Cloud Shell, downloading the file tcb-clinic.yaml</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9F6Ufpmqu8M98YWRS0mL6g.png" /></figure><p><strong>Step 15: Adding tag and uploading it to the Container Registry</strong></p><p>docker tag tcb-clinic-app asia.gcr.io/MY_PROJECT_ID/tcb-clinic-app:latest</p><p>docker push asia.gcr.io/MY_PROJECT_ID/tcb-clinic-app:latest</p><ul><li>From the Kubernetes Engine services, click on [+] Create | Autopilor cluster | Configure</li><li>Name: autopilot-cluster-1</li><li>Region: australia-southeast1</li><li>Click on Create.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-5ngCzmgfXJt8p_iH82ruQ.png" /></figure><ul><li>In the Cloud Shell, downloading the file tcb-clinic.yaml</li></ul><p>wget <a href="https://storage.googleapis.com/bootcamp-gcp-en/tcb-clinic.yaml">https://storage.googleapis.com/bootcamp-gcp-en/tcb-clinic.yaml</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCe6tAE3SZneWmHLzG3LYw.png" /></figure><ul><li>Edit the file tcb-clinic.yaml using the Cloud Editor, change the Private IP (DBHOST) of the Cloud SQL:</li></ul><p>image path (image: asia.gcr.io/&lt;project-name&gt;/tcb-clinic-app:latest)</p><ul><li>Connecting to the Cluster (Console -&gt; GKE -&gt; the Cluster created -&gt; Connect)</li></ul><p>In the Command-line access, click on Run in Cloud Shell [ Enter ]</p><ul><li>Deploying the application from the yaml file:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H88Z8ckwLWCYgCQxHJtBKw.png" /></figure><p>kubectl apply -f tcb-clinic.yaml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6v5TAAgMD0rLQfTYZV0IwQ.png" /></figure><p>Check on workloads and ensure tcb-clinic is running</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2701KMFNiSm4aHLmtYxEDw.png" /></figure><p>Check services</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-tPL5RWVTV3rP_I_C8r3DA.png" /></figure><p>mysql -u root -p<br>Enter the welcome password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*vZCHT8vnkORAlFlcr3ihCQ.png" /></figure><p>source load_clinic.sql</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*prq-0diU_cFq2pO6Pz5hmQ.png" /></figure><p><strong>Step 16: Exporting the DB of the MySQL GCE</strong></p><ul><li>Access the <strong>aus-db01</strong> instance via ssh</li><li>Run this command to export the data:</li></ul><p>mysqldump — add-drop-table -u root -p clinic &gt; clinic.sql</p><p>mysqldump — add-drop-table -u root -p clinic &gt; clinic.sql</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YOEku0pW5cgvxPPGUTexag.png" /></figure><p>sed -e ‘s/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g’ -i clinic.sql</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zZs30mK8_vHpGCXeOZE-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D23noni8uHcCgZsK8Tqecw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*uyTydUqwFaxZu1RM6MiT_g.png" /></figure><p>Access to the Cloud SQL Database through the Kubernetes cluster</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MnP-prBzv1XJpSo3gDkJBg.png" /></figure><p>Cloud SQL before failover screenshot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7V8N4MGq4HJLOYk7yXPGuA.png" /></figure><p>Message after failover</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4T2Dm0j1L6fy4gbQBxDZcw.png" /></figure><p>Screenshot after failover — Location changes to Australia-southeast1-b</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4eiqJUgn2NLC2ThgJ9e4bA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ad4219c3e46" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>