<?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 Mohammad Shakhawat Hossain on Medium]]></title>
        <description><![CDATA[Stories by Mohammad Shakhawat Hossain on Medium]]></description>
        <link>https://medium.com/@ramimhossain67?source=rss-c139c4227e97------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*h3Lm9vYwzWooyDZm3L8cXg.jpeg</url>
            <title>Stories by Mohammad Shakhawat Hossain on Medium</title>
            <link>https://medium.com/@ramimhossain67?source=rss-c139c4227e97------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 06:13:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ramimhossain67/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[HumanGov: Implementation Of Git Repositories For Application And Infrastructure Code Using Amazon…]]></title>
            <link>https://medium.com/@ramimhossain67/humangov-implementation-of-git-repositories-for-application-and-infrastructure-code-using-amazon-0050096d4924?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/0050096d4924</guid>
            <category><![CDATA[codecatalyst]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[iam-roles]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Fri, 25 Oct 2024 07:04:33 GMT</pubDate>
            <atom:updated>2024-10-25T07:04:33.525Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>HumanGov: Implementation Of Git Repositories For Application And Infrastructure Code Using Amazon CodeCatalyst + Proof Of Concept (POC) Process Of Commit, Push And Revert Code Changes</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*XJ3dzW-4Y87ysxBF6cGxQw.png" /></figure><p><strong>Project description:</strong></p><p>In this project based on a real-world scenario, I implemented Git repositories for application and infrastructure code using Amazon CodeCatalyst, and got hands-on experience with the Proof of Concept (PoC) process of commit, push, and revert code changes.</p><p>My mission was to set up a Git repository using Amazon CodeCatalyst for HumanGov, a hypothetical Software as a Service for government organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*sRXg8RqWOCunMQaWuSUqJg.png" /></figure><p>I successfully completed this project using Amazon CodeCatalyst, Git, and Visual Studio Code in two parts.</p><p><strong>Part-1</strong>: Accessing the Amazon CodeCatalyst Platform and Creating the Project with Two Repositories</p><p><strong>Part-2: </strong>Adding the Dev Environments and Performing the Process of Commit, Push, and Revert Code Changes</p><p><strong>Part 1:</strong></p><p>The first step was to access the Amazon CodeCatalyst platform. To do this, I needed to create an AWS Builder ID, which serves as an individual identity, separate from any credentials or data associated with existing AWS accounts. Once logged in, I was able to create a space and my project in Amazon CodeCatalyst. Additionally, I had the option to create a space in the AWS Management Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMIFK1EnNAGMi7dVAPIjYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Y11EVJ9X2_98UwWGmRp8Q.png" /></figure><p>In <strong>AWS CodeCatalyst</strong>, projects are organized under a <strong>space</strong>. A space is like a container or workspace that holds one or more projects. Each space typically represents a team, organization, or logical grouping, and inside a space, you can have multiple projects. This structure helps in organizing and managing related projects more effectively.</p><p>In <strong>CodeCatalyst</strong>, a space can have:</p><ul><li><strong>Multiple Projects</strong>: Each project can have its own repositories, workflows, and other resources.</li><li><strong>Shared Resources</strong>: Members of the space can share resources, such as roles, permissions, and settings across projects.</li></ul><p>Amazon CodeCatalyst spaces in the AWS management console are authorized to use that AWS account as a billing account, an account with IAM roles for deployments, or both.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9gOZgR6vDGwM5vaTcbaSXw.png" /></figure><p>Next, I created a project named “HumanGov.” Within this project, I set up two repositories: one to store the application source code and the other to manage the infrastructure source code. Repositories can be created in the following way:</p><p>code &gt; source repositories &gt; add repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erKf9Ay5Y0TFAoeq-7ONhQ.png" /></figure><p><strong>Part-2:</strong></p><p>I had to connect my Amazon CodeCatalyst platform with Visual Studio Code IDE. To install VS Code on windows you can visit the <a href="https://code.visualstudio.com/download">official Visual Studio Code download page</a>.</p><p>After installing VS Code I had to download and install some extensions for VS Code(AWS Toolkit, Remote-SSH etc.). Extensions in Visual Studio Code (VS Code) are tools that enhance and extend the core functionality of the IDE, allowing the user to customize it according to their development needs. They can add new features, support for additional programming languages, or tools that streamline specific workflows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1APSjrjz7VmsyWMM_8KOVg.png" /></figure><p>The <strong>AWS Toolkit</strong> extension for Visual Studio Code is a powerful tool designed to enhance the integration between AWS services and the VS Code IDE. It provides developers with an easier way to work with various AWS resources and services directly from within their code editor.</p><p>To install the AWS Toolkit extension:</p><ol><li>Open <strong>Visual Studio Code</strong>.</li><li>Navigate to the <strong>Extensions</strong> tab (or use Ctrl+Shift+X).</li><li>Search for <strong>AWS Toolkit</strong> in the marketplace.</li><li>Click <strong>Install</strong> to add the extension.</li><li>Once installed, we’ll see an AWS icon in the Activity Bar on the left side, where we can access and manage our AWS resources.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*bAt-Di3mZZz2NKfI3_8HZw.png" /></figure><p><strong>Inspect AWS CLI Version</strong>:</p><ul><li>Make sure you are using a compatible version of the AWS CLI that supports SSO (version 2.x). You can check your AWS CLI version with:</li></ul><pre>aws --version</pre><p>The aws configure command is used to quickly set up our AWS CLI (Command Line Interface) credentials, region, and output format. This command allows us to interact with AWS services through the CLI by providing our <strong>AWS Access Key</strong>, <strong>Secret Access Key</strong>, and <strong>default region</strong> settings.</p><pre>aws configure</pre><p>I connected with my CodeCatalyst account using the SSO(Single-Sign-On) method. When we use this method we don’t need to use <strong>AWS Access Key</strong>, <strong>Secret Access Key to </strong>authenticate<strong>. </strong>In order to login using the command:</p><pre>aws sso login --profile codecatalyst</pre><p>To configure the profile:</p><pre>aws configure --profile codecatalyst</pre><p>To see the configuration:</p><pre>cat ~/.aws/config<br>git config --list<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*r5WC3rQkrFtSM6Jd1JhKaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*hrgOz1mi-2ktjNwWXE_b7w.png" /></figure><p>I chose <strong><em>skip to sign-in</em></strong> option and it took me to my <strong><em>AWS Builder ID</em></strong> login page where upon inserting the credentials I was able to connect to my Amazon CodeCatalyst account.</p><p>Now, I created three dev environments in my CodeCatalyst platform. Dev environments can be created this way:</p><p>Project &gt; Code &gt; Dev Environments &gt; Create Dev Environments</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*77RdjyDA3uejkA8cdRm8EQ.png" /></figure><p>One project was named <strong>HumanGov</strong>, and I created two additional repositories for the two developers. When setting up the development environments, I selected the option for VS Code to facilitate access within the IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QlbkimcVhpUm8le03zCVvg.png" /></figure><p>Since my environments were up and running I could start the Proof Of Concept (POC) process Of Commit, Push And Revert Code Changes.</p><p>By choosing the option “Open Dev Environment” , we can connect to a dev environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*OiW7ZhxnViAF4jbYSgqJFw.png" /></figure><p>I have logged into <strong>HumanGov</strong> dev environment and copied the source repositories using the git clone command. By using the personal access token that was generated for the repository, I could be able to execute the git commands.</p><p>Next, I logged into the Software Developer 1 dev environment as software developer 1. I had to run these below commands first before cloning the repository:</p><pre>git config --global user.name &quot;Software Developer 1&quot;<br>git config --global user.email dev1@humangov.com</pre><p>I cloned the “Human-Gov-Application repository in this machine using the same process. I have added a index.html file and pushed to CodeCatalyst.</p><p>To clone the repository:</p><pre>git clone &lt;url&gt;</pre><p>To add the changes:</p><pre>git add .<br>git commit -m &quot;commit message&quot;</pre><p>Push changes to remote repository:</p><pre><br>git status<br>git push -u origin master</pre><p>index.html file:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;My Website&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;header&gt;<br>        &lt;h1&gt;Welcome to HumanGov!&lt;/h1&gt;<br>          &lt;nav&gt;<br>            &lt;ul&gt;<br>              &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;<br>              &lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;/a&gt;&lt;/li&gt;<br>              &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;<br>            &lt;/ul&gt;<br>          &lt;/nav&gt;<br>    &lt;/header&gt;<br>    &lt;main&gt;<br>      &lt;p&gt;This is a PoC for HumanGov Git Repository.&lt;/p&gt;<br>    &lt;/main&gt;<br>    &lt;footer&gt;<br>      &lt;p&gt;© My Website. All rights reserved.&lt;/p&gt;<br>    &lt;/footer&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cSCbMm09p0pSQxC0PfBesg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wFGa19TwVe8DFXJlL2LQLA.png" /></figure><p>Now, Developer 1 made a mistake while updating the code in the <strong>index.html</strong> file. Since Developer 1 was on vacation, Developer 2 stepped in to correct the mistake. After logging into the development environment as Software Developer 2, I as a Developer 2 reverted the last commit.</p><pre>git config --global user.name &quot;Software Developer 2&quot;<br>git config --global user.email dev2@humangov.com</pre><p>To revert the last commit using the Hash #:</p><pre>git log<br>git revert &lt;hash&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U5ulA0PUY6Iwyvv7LWDwzw.png" /></figure><p>Lastly, Developer 2 changed the header size to <strong>h2</strong>, then committed and pushed the changes to the repository. I was able to view and verify the commits for the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ziskG2hsSrMJUT3K1p6ZvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*qvzrPFHSEEVm7exf_47awg.png" /></figure><p>Thus, I successfully completed the project of setting up a Git repository using Amazon CodeCatalyst for <strong>HumanGov</strong>, a hypothetical Software as a Service (SaaS) solution for government organizations. I created separate Git repositories for both the application and infrastructure code, gaining hands-on experience in the Proof of Concept (PoC) process, which included committing, pushing, and reverting code changes.</p><p><strong>Conclusion:</strong></p><p>Thank you, everyone, for taking the time to review this project. I hope you find it valuable and useful for learning purposes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0050096d4924" 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/@ramimhossain67/implementation-of-an-e-commerce-system-on-aws-in-an-automated-way-using-terraform-and-ansible-583385711c88?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/583385711c88</guid>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[adobe-magento-commerce]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Sun, 20 Oct 2024 22:42:00 GMT</pubDate>
            <atom:updated>2024-10-20T22:43:12.975Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c42Po6Sq_9iP_uAJ_-l6Xw.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*maPof0YhnzOd4K1M8kIS2Q.png" /></figure><p>I completed this project in three steps:</p><ol><li><strong>Retrieved Access keys in Adobe Magento</strong></li><li><strong>Provisioned the infrastructure in an automated way using Terraform</strong></li><li><strong>Configuration management with Ansible</strong></li></ol><p><strong>Step-1: Retrieved Access keys in Adobe Magento</strong></p><p>First, I obtained the access keys for Adobe Magento, a widely used open-source e-commerce platform designed to help businesses create and manage online stores with extensive flexibility and scalability. The access keys consist of a public key and a private key, both of which are required to run the Ansible playbook.</p><p>The public and private keys authenticate my access to Adobe Magento’s resources, allowing Ansible to connect securely to the Magento repository. The keys enable Ansible to download necessary packages, modules, or dependencies required for the Magento installation. This ensures that the correct versions are retrieved from the repository.</p><p>To get the keys, I visited the following URL: <a href="https://account.magento.com/customer/account/login/">https://account.magento.com/customer/account/login/</a>. I logged in using my Gmail account, navigated to ‘My Profile,’ retrieved the access keys, and saved them in notepad for later use.</p><p><strong>Step-2: Provisioned the infrastructure in an automated way using Terraform</strong></p><p>After that, I created the infrastructure using Terraform on AWS. I used AWS CloudShell to install Terraform. In CloudShell, I executed these commands:</p><pre>sudo yum install -y yum-utils<br>sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo<br>sudo yum -y install terraform</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9RkfMD12gjZu0x2GP4TM8Q.png" /></figure><p>Then I downloaded the Terraform files on AWS Cloud Shell.</p><pre>mkdir final_project<br>cd final_project<br>wget https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/final-project-terraform.zip<br>unzip final-project-terraform.zip<br>cd terraform</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zoo2qY0qfNS6_eCXQTM9Kg.png" /></figure><p>Then I updated the main.tf file according to my default VPC-ID, key-pair name, instance type and saved the file. These below commands were executed later on:</p><pre>terraform init<br>terraform plan<br>terraform apply<br>ls | a new file was created: &#39;terraform.tfstate&#39;</pre><p>I verified that the infrastructure was created and saw the ecommerce1 server was up and running. Terraform created an EC2 instance in my default VPC and a security group to manage the inbound and outbound rules of the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k02SeXfdEE0omi1Zyd4Vag.png" /></figure><p><strong>Step-3:</strong> <strong>Configuration management with Ansible</strong></p><p>Next step was about the configuration management of the ecommerce1 server in an automated way using Ansible. I logged into the server using ssh and installed Ansible.</p><pre>ssh -i sshkey1.pem ec2-user@ec2-public-ip<br>sudo yum-config-manager --enable epel<br>sudo yum install ansible -y</pre><p>After that, I downloaded the <strong>Ansible</strong> Playbooks</p><pre>wget https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/final-project-ansible-magento2.zip<br>unzip final-project-ansible-magento2.zip</pre><p>Next, I needed to modify the <strong>all.yml</strong> file located inside the <strong>group-vars</strong> directory. I updated the access keys and the <strong>ecommerce1</strong> server’s public IP, then saved the file with the following changes:</p><pre>magento_domain: ec2-public-ip<br>server_hostname: ec2-public-ip<br>repo_api_key: b2041f02509880fbbb96312b29995cb6  # (insert your public key)<br>repo_secret_key: 7be7c69e79bd798a2a8a6b00988a5b72  # (insert your private key)</pre><p>I executed below command to run the playbook.</p><pre>ansible-playbook -i hosts.yml ansible-magento2.yml -k -vvv --become</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6xOX8r2_OnA52HSvDuYWiw.png" /></figure><p>The image above shows that all packages and applications were successfully installed. By using the public IP of my <strong>ecommerce1</strong> server, I was able to access the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CN0ZsB6e4bebNpyyCoyppw.png" /></figure><p>Afterward, I verified that the website, database, and cache were all functioning as expected. To do this, I first logged in using my credentials to ensure everything was set up correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qYsQKoRWdNGOo6GxLgSybg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xniF8ECZ-JXvQ5bM_whKmQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zDU8TTmNl9P6oPMbHj24Sg.png" /></figure><p>I updated the home page with a picture and description and it was successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvAo8qP9mVoNzM882vQRyQ.png" /></figure><p>I tried to add a product with price and images. It was successfully added to the products list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YdRKMn47yAmZ1TXx6BHWGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5u_EzHXe4xMGFfrrJDswow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_oH3QZhb24UsEP_oZAFVg.png" /></figure><p>Then I tried to add a widget where new products will be shown in the home page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sA49c3VhWQJyj1uo_QFNIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qou-OXl0ICclg5hJ9qHAQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g3TQEmQe3yvek8MYrgYB0A.png" /></figure><p>Lastly, I tried to add the product in my shopping cart and it was successfully added to the cart as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M2F76fXt1Mli_XHcH0mHzA.png" /></figure><p>Thus, I successfully created and implemented an e-Commerce MVP (Minimum Viable Product) on <strong>AWS</strong> in under 2 hours, fully automated using <strong>Terraform</strong> and <strong>Ansible</strong> for Infrastructure as Code (IaC), with <strong>Adobe Magento</strong> as the core platform.</p><p><strong>Conclusion:</strong></p><p>Thank you, everyone, for taking the time to review this project. I hope you find it valuable and useful for learning purposes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=583385711c88" 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/@ramimhossain67/elaboration-of-executive-presentation-of-infrastructure-costs-for-an-sap-migration-project-from-0300c2b37bd3?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/0300c2b37bd3</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-pricing-calculator]]></category>
            <category><![CDATA[microsoft-office]]></category>
            <category><![CDATA[microsoft-excel]]></category>
            <category><![CDATA[project-cost-estimation]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Sat, 19 Oct 2024 03:22:01 GMT</pubDate>
            <atom:updated>2024-10-19T03:22:01.974Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>Elaboration of Executive Presentation of Infrastructure costs for an SAP Migration project from On-Premises to AWS</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMSfjs3oRtaM-isZHBrPzw.png" /></figure><p><strong>Project description:</strong></p><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/Stage 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*YAWiEB6UsU4Npr2a7D_c8w.png" /></figure><p>At first I made cost estimation for the Production servers. The specifications Include:</p><ul><li>5 Application servers (vCPU- 8 / Memory-16 GiB)</li><li>Total EBS(Elastic Block Store) volume = 2 TB</li></ul><p>I went to this link <a href="https://calculator.aws/#/">https://calculator.aws/#/</a> where we can estimate the cost for our architecture solution.</p><p>Chosen instance: c6g.2xlarge | Family: c6g | 8vCPU | 16 GiB Memory</p><p>Chosen EBS Volume for each instance = 2TB/5 = 400GB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qh2WGgckz-XcKq0NWdePUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZeuw05MrvGeWTJmyPnT4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y5Eggn8z1zxyRTAyjTPcmA.png" /></figure><p><strong>Compute Savings Plans</strong> provide the most flexibility and prices that are up to 66 percent off of On-Demand rates. These plans automatically apply to your EC2 instance usage, regardless of instance family (for example, m5, c5, etc.), instance sizes (for example, c5.large, c5.xlarge, etc.), Region (for example, us-east-1, us-east-2, etc.), operating system (for example, Windows, Linux, etc.), or tenancy (for example, Dedicated, default, Dedicated Host). They also apply to your Fargate and Lambda usage. With Compute Savings Plans, you can move a workload from C5 to M5, shift your usage from EU (Ireland) to EU (London), or migrate your application from Amazon EC2 to Amazon ECS using Fargate at any time. You can continue to benefit from the low prices provided by Compute Savings Plans as you make these changes.</p><p>Next, I estimated the cost for Stage and Development servers.The specifications Include:</p><ul><li>5 Application servers (vCPU- 4/ Memory-8 GiB)</li><li>Total EBS volume = 1500 GB</li></ul><p>Chosen instance: c6g.xlarge | Family: c6g | 4vCPU | 8 GiB Memory</p><p>Chosen EBS Volume for each instance = 1500 GB /5 = 300GB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JHO05ruMLdTD_GQsGTm7oQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cAmfIeHcxOOLOk7h85Kmxg.png" /></figure><p>After that I estimated the cost for 3 Elastic Load balancers.The specifications Include:</p><ul><li>Number of total Application Load Balancers = 3</li></ul><p>These are the values I chose while making the cost estimation:</p><p>Processed bytes (EC2 Instances and IP addresses as targets) = 2 GB/hour</p><p>Average number of requests per second per ALB = 100</p><p>Average number of rule evaluations per request = 100</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xhd6D1GlFgfS4aa_uwSF2A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k-pb15wlgXzBP_J3ufL6iQ.png" /></figure><p>So, we got our cost estimation for the load balancers. Next, I made the estimation for Elastic File Storage.The specifications Include:</p><ul><li>Total storage for Production,Stage and Development = 1000 GB + 500 GB + 250 GB = 1750 GB/ per month</li></ul><p>I chose Infrequent Access storage — Percentage of data that is accessed multiple times within a few months = 80% to save some money on this portion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-KB8e9JjSgpdSwBQaqXAQ.png" /></figure><p>Later, I made cost estimation for the database instances.I chose the service “Amazon RDS for Oracle” .For Production environment,The specifications Include:</p><ul><li>2 Oracle DBs (vCPU- 38 / Memory-156 GiB)</li><li>Storage for each RDS instance = 3TB</li></ul><p>Selected Instance: db.m4.10xlarge | vCPU: 38| Memory: 156 GiB</p><p>Deployment option : Multi-AZ (Since Production servers are critical for business)</p><p>Pricing model : OnDemand ( Since Reserved option was not available. Otherwise, Choose Reserved as we need the servers for three years.That way I could reduce the expenses)</p><p>Storage = 3TB</p><p>Backup storage = 3.5 TB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_FS4wNkxOt_TNtF9AvJZcg.png" /></figure><p>For Stage environment,The specifications Include:</p><ul><li>2 Oracle DBs (vCPU- 16 / Memory-64 GiB)</li><li>Storage for each RDS instance = 3TB</li></ul><p>Selected Instance: db.m4.4xlarge | vCPU: 16 | Memory: 64 GiB</p><p>Deployment option : Single-AZ</p><p>Pricing model : OnDemand ( Since Reserved option was not available. Otherwise, Choose Reserved as we need the servers for three years.That way I could reduce the expenses)</p><p>Storage = 3TB</p><p>Backup storage = 3.5 TB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rOhVcT6mwSZxNSABKQ-NLg.png" /></figure><p>For Development/Testing environment,The specifications Include:</p><ul><li>2 Oracle DBs (vCPU- 8 / Memory-30 GiB)</li><li>Storage for each RDS instance = 1TB</li></ul><p>Selected Instance: db.m4.2xlarge | vCPU: 8 | Memory: 32 GiB</p><p>Deployment option : Single-AZ</p><p>Pricing model : OnDemand ( Since Reserved option was not available. Otherwise, Choose Reserved as we need the servers for three years.That way I could reduce the expenses)</p><p>Storage = 1TB</p><p>Backup storage = 1.5 TB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHCUQ2btbh2vYL3dGGu5vQ.png" /></figure><p>Finally, I got my total estimation of infrastructure costs for the SAP migration project from On-Premises to AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HtqbFn2Dp_UUGOF986Ms2g.png" /></figure><p>Now, It’s time to create an executive presentation of infrastructure costs. I exported the values to a csv file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YlObvoIOO3P3AitOGFBjEg.png" /></figure><p>Then I added the data for different services in the chart design section to get the intended result for the cost estimation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zoweESLqt3VvUqmC4vNOqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wxh_sCPRlkSXBsluhCUYpQ.png" /><figcaption>Monthly Cost</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bMxyBvqish4QwSJB7rFKVA.png" /><figcaption>Yearly Cost</figcaption></figure><p><strong>Conclusion:</strong></p><p>Thank you, everyone, for taking the time to review this project. I hope you find it valuable and useful for learning purposes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0300c2b37bd3" 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…]]></title>
            <link>https://medium.com/@ramimhossain67/implementation-of-a-set-of-ec2-instances-using-terraform-and-aws-systems-manager-configuration-50f53a8c20c5?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/50f53a8c20c5</guid>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws-system-manager]]></category>
            <category><![CDATA[aws-sns]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Wed, 16 Oct 2024 04:24:35 GMT</pubDate>
            <atom:updated>2024-10-16T18:07:03.177Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong><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 agent</em></strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKdof7cu7jfz9EzF6PRNpw.png" /></figure><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>Once I provisioned the infrastructure, 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 an email informing the whole process status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l5nIFDSszczl4WNhBGpnYA.png" /></figure><p>I used Terraform to create EC2 instances and security groups. First, I modified the Terraform file main.tf to match my default VPC and selected one of the default subnets in my AWS account. After making these adjustments, I saved the file and compressed it into a ZIP file. Additionally, I generated a new key-pair named &quot;sshkey1&quot; (in .pem format) to use for SSH access.</p><p>For more detailed resources on how to create EC2 instances using Terraform, please refer to the link below.</p><p><a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started">https://developer.hashicorp.com/terraform/tutorials/aws-get-started</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6rBR1Y9-nTCbFMKGQ9FrKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*pcVcKuwA7HsP4giTbGWSKg.png" /></figure><p>I installed Terraform in CloudShell using these set of commands:</p><pre>sudo yum install -y yum-utils<br>sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo<br>sudo yum -y install terraform<br>terraform -v</pre><p>Then I uploaded the zip file in AWS Cloudshell and extracted the file using the below command:</p><pre>unzip project-m5.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3L7pGNqhzHeoN983jaYRQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NX5ptt53px_9-Y-xBz7vmg.png" /></figure><p>Then I used these below commands to apply my Terraform code to create the infrastructures.</p><pre>terraform init<br>terraform plan<br>terraform apply<br>ls  | a new file was created: &#39;terraform.tfstate&#39;</pre><p>After that, I confirmed that my infrastructure was successfully created. I was able to see that two EC2 instances were up and running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*QV-SBNJnZqA4N-h5JdoeYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUay3aPVe2peYKovZCmKQw.png" /></figure><p>Then I created a role in IAM section of AWS management console to add a SNS topic.Amazon SNS (Simple Notification Service) Topic is a powerful messaging service that allows you to send notifications to multiple recipients or endpoints at once. SNS Topics act as a “communication channel” where messages are published, and multiple subscribers can receive those messages via various protocols like SMS, email, HTTP/S, or even other AWS services like Lambda or SQS. I have added a subscriber where I put my email address so that I can get the update on all actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4y-LQlfNg40ngS2tb3kfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwAgKbnuo_WqAjyX9-CEng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-OHOurRpWY_A0Ehl8MRxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a3re9DPdN-zink2y2o9MXw.png" /></figure><p>After that I got an email to confirm my subscription and I was successfully subscribed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*nezNvJOUudGuKh8t9GAH8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*5rrH6VlNATaDGN-_C1KoHg.png" /></figure><p>Later on, I moved to AWS Systems Manager. AWS Systems Manager (SSM) is a powerful service provided by Amazon Web Services that helps you manage and operate your infrastructure at scale in a secure and efficient manner. It acts as a central hub for viewing and managing your AWS resources, including EC2 instances, RDS databases, on-premises servers, and other services. It integrates with a wide range of AWS services and simplifies tasks like configuration management, application patching, system monitoring, automation, and compliance management. I have selected Host Management and create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15Vj-95wrUaA2HWhEWajhA.png" /></figure><p>Choose how you want to target instances and here I chose Manual. I could see my web servers and selected both of them and created the configuration.It’s going to take some time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P6AdZBWoxOhCy_x6TJ9YwA.png" /></figure><p>We can see it was successful after a while.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8l9U8itcOkBbBnhx4PCsPQ.png" /></figure><p>Then I have selected Node Management and then chose ‘Start Session’.I started a session in one of the EC2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NkKVnCeSUH48SVRIaxDd3A.png" /></figure><p>The next step was to use the Run Command feature. This was used for automation of operations across servers.</p><p>I executed “Run Command” to deploy the “security agent installation”.</p><p>The flow in AWS Systems Manager: Access Quick Setup &gt;Node Management &gt; Run Command &gt; AWS-RunShellScript . Used the below set of commands in the ‘Commands’ section.</p><pre><br>sudo wget -q https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/install_security_agent.sh -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</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PgcJB7ZoSLmLhmCQdn3Heg.png" /></figure><p>Then I selected my web servers where I wanted to run the commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqmIhwXcAB3eBWryjRsJOQ.png" /></figure><p>Since the SNS notifications option was enabled, I used the ARN(Amazon Resource Name) for the IAM role and SNS topic that I had created earlier. For events notifications I chose all events and command status on each instance changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PtT77qLffkGpwhv0rhZzhA.png" /></figure><p>After running the commands I got email notifications which meant my SNS topic is working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jATMWqTIM7ayGzyeTImqig.png" /></figure><p>It showed success in the end, which means we can verify the output for each server and confirm everything by reviewing the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jSdYfbvyyby4eLwt2JPgvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bB_vvdILaFCc2LhCJghbqw.png" /><figcaption>webserver2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8Zxh-dNGkU3hrR6GiASIA.png" /><figcaption>webserver1</figcaption></figure><p>With this, I successfully completed the project involving the implementation of a set of EC2 instances using Terraform and AWS Systems Manager, configured with Amazon Simple Notification Service (SNS) for the automated installation of a security agent.</p><p>To destroy the infrastructure, you need to open the CloudShell terminal and run the command terraform destroy. If this command doesn’t work, you may need to reinstall Terraform and try running the command again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*TC6TRWEBVqV_hBJ7IJckzQ.png" /></figure><p><strong>Conclusion:</strong></p><p>Thank you, everyone, for taking the time to review this project. I hope you find it valuable and useful for learning purposes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50f53a8c20c5" 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/@ramimhossain67/implementation-of-a-scalable-web-application-using-the-services-of-aws-elastic-beanstalk-dynamodb-0b8d8197e895?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b8d8197e895</guid>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws-beanstalk]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloudfront]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Fri, 21 Jun 2024 05:41:14 GMT</pubDate>
            <atom:updated>2024-06-21T05:42:24.021Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>Implementation of a Scalable Web Application using the services of AWS Elastic Beanstalk, DynamoDB, CloudFront and Edge Location</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vyyUmMJxKPSGow2Ns1FIsw.png" /></figure><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*Fh-2rrUNSN2eMAFC2HaBsQ.png" /></figure><p>We will accomplish this project in this four Steps:</p><ol><li><strong>Create a table in DynamoDB</strong></li><li><strong>Configure and run Elastic Beanstalk environment</strong></li><li><strong>Create a CloudFront distribution</strong></li><li><strong>Stress test of the application</strong></li></ol><p><strong>Step-1: Create a table in DynamoDB</strong></p><p>Initially, we created a table named “users” in Amazon DynamoDB to store email addresses inserted by the users. DynamoDB offers single-digit millisecond response times, making it ideal for high-performance applications. Additionally, it can automatically scale up and down based on traffic, ensuring consistent performance and cost-efficiency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UukgdrgC6WzG41cA3hTZUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*8JBP9ab9kny6FjfhQ4dWGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*no41baQXBI6QtKAMloRAxg.png" /><figcaption>users table</figcaption></figure><p><strong>Step-2</strong>:<strong>Configure and run Elastic Beanstalk environment</strong></p><p>In next step, we created a web server environment in Elastic Beanstalk. We named our application as “tcb-conference”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kcFlCK2hLyE80IFnvllLew.png" /></figure><p>We chose a public S3 URL as the source for our application. The web application is written in Python, and we selected the appropriate Python version as the platform. To ensure proper service access for our application, we created two roles.</p><ol><li>Role name: <strong>aws-elasticbeanstalk-service-role</strong></li></ol><p>use cases: Elastic Beanstalk</p><p>Permissions:</p><p>AWSElasticBeanstalkEnhancedHealth</p><p>AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy</p><p>2. Role name:<strong>aws-elasticbeanstalk-ec2-role(</strong>EC2 instance profile)</p><p>use cases: EC2</p><p>Permissions:</p><p>AWSElasticBeanstalkWebTier</p><p>AWSElasticBeanstalkWorkerTier</p><p>AWSElasticBeanstalkMulticontainerDocker</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nwAum4c7_anqm1thsho_sQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zEcYV7gkdO7IJ7XyrTRj4g.png" /></figure><p>We chose default VPC as our desired VPC and selected all the availability zones. We checked the box public ip address as “activated”.</p><p><strong>Now we Configure instance traffic and scaling as below:</strong></p><p><strong>Instances</strong></p><p>Root volume type: <strong>General Purpose (SSD)</strong></p><p>Size: <strong>10 GB</strong></p><p><strong>Capacity</strong></p><p>Auto scaling group</p><p>Load balanced</p><p>Min: <strong>2</strong></p><p>Max: <strong>4</strong></p><p>Fleet composition: <strong>(*) On-Demand instances</strong></p><p>Instance types: <strong>t2.micro</strong></p><p><strong>Now for scaling triggers we chose as below:</strong></p><p>Metric: <strong>CPUUtilization</strong></p><p>Unit: <strong>Percent</strong></p><p>Min: 1</p><p>Min: 1</p><p>Upper: 50</p><p>Scale up: 1</p><p>Lower: 40</p><p>Scale down: -1</p><p>Load balancer network settings for visibility should be <strong>Public.</strong></p><p>Lastly, we add an environment property:</p><p>Name:</p><p><strong>AWS_REGION</strong></p><p>Value:</p><p><strong>us-east-1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jdAWH2ZM9ubGJygpmpvKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PAW8S6uED3nD44K9rgpfqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GC7JkvmL7opAjNOjnAPcKA.png" /></figure><p>While attempting to add a new email address, we encountered an error because our application running on EC2 instances did not have access to DynamoDB. To resolve this, we granted full DynamoDB access permissions. After doing so, we successfully added our first email address, “abc@abc.com.” This can be verified by checking the users table in DynamoDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VUZz9-jleV19y9L1GCfsGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AIPD4UMr8K7M7mLfSF6Wpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8JPbWVy3qJu6Epzq59k9Q.png" /></figure><p><strong>Step-3</strong>:<strong>Create a CloudFront distribution</strong></p><p>Given that our users are distributed across various locations, we need to create a CloudFront distribution to cache the application at CloudFront edge locations. This will reduce latency and provide quick and efficient responses.</p><p>Followed the below configurations:</p><p>We selected the ‘<strong>Elastic Load Balancer</strong>’ created by <em>Elastic Beanstalk.</em></p><p>Protocol: <strong>HTTP and HTTPS</strong></p><p>Allowed HTTP methods: <strong>GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE</strong></p><p><strong>Cache key and origin requests:</strong></p><p><strong>Cache policy and origin request policy (recommended)</strong></p><p>-Cache policy: <strong>CachingOptimized</strong></p><p><strong>Web Application Firewall (WAF)</strong></p><p>-Enable security protections</p><p>We tried to register another email address after creating the CloudFront distribution. We used <strong>Distribution Domain Name</strong> to open the web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LY8w2jrlrONFin1fz5Ssjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24l_YPOPnSDUlOB4XuT4wQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7qNtGADinarpNIZw0T9pQg.png" /></figure><p><strong>Step-4:Stress test of the application</strong></p><p>We now need to verify if our application is auto-scaling properly under heavy traffic. To do this, we conducted a stress test. First, we connected to one of the EC2 instances using its public IP address. Then, we installed the “stress” program and ran it to ensure 100% CPU utilization, thereby overloading the instance. In response, our auto-scaling group should add another instance to counter this issue and provide a smooth user experience.</p><pre>ssh -i new-key-1.pem ec2-user@ec2-public-ip<br>sudo yum install stress -y<br>stress -c 4<br></pre><p>Now we can open a new SSH connection and check the process running in the EC2 instance:</p><pre>ps aux<br>ps aux --sort=-pcpu<br>top</pre><p>Afterward, I checked the Elastic Beanstalk status, which showed a ‘Warning.’ One of the instances was unhealthy due to the stress program, which caused high CPU utilization (over 50 percent).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Th8yg6k7esENX0k4LEe8aA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQfWcTmPTMYyEnfyhYGugg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zJEkyHhO-zb0nVjUQoz_vQ.png" /><figcaption>Events</figcaption></figure><p>Auto-scaling group was triggered and added one ec-2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KNgmLS81WuhaHSZo_B7j1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bv_ZTDCuq7ZXZmjXOTP46g.png" /></figure><p>After the overload condition was removed from the instance, it turned back to an “Ok” state. The extra ec-2 instance was terminated as it was no longer required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZv3_Rp9RIpBbeR6R85tUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGobtD5tb-r_vl0OP4fKMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P7u-YvXYyyIgYoHPQZY0OQ.png" /></figure><p>Now we checked again to register a user email address and was successful. We opened the application using Distribution Domain Name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbzVzjlaBJgZvrLuouLZcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0VnyF484cbKKnKHMomk94A.png" /></figure><p><strong>Conclusion:</strong></p><p>In this project, we successfully implemented an application capable of supporting high demand from a large number of simultaneous users by utilizing various AWS services. I hope you find this project useful for learning purposes. Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b8d8197e895" 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/@ramimhossain67/migration-of-a-workload-running-in-a-corporate-data-center-to-aws-using-the-amazon-ec2-and-rds-f983918aff28?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/f983918aff28</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[rds]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 01:09:19 GMT</pubDate>
            <atom:updated>2024-03-25T01:09:19.655Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong><em>Migration of a Workload running in a Corporate Data Center to AWS using the Amazon EC2 and RDS service</em></strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MYrkt1lvCnZ1olMs3npi1w.png" /></figure><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 (re-host) model, moving both application and database data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Y_jNDDOvBs6UwkMYSFa2g.png" /></figure><p>I followed some migration steps: Planning (sizing, prerequisites, resource naming), Execution (resource provisioning, best practices), Go-live (validation test — Dry-run, final migration — Cut-over) 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*7jTjwmPadR0oLyTFb01Uag.png" /></figure><p><strong>Step-1(Planning):</strong></p><p>To migrate our application and database from an on-prem datacenter to AWS, I first reviewed the information stored in a Microsoft Excel Worksheet. From this worksheet, I determined the appropriate instance type and size for our EC2 instances on AWS. According to our hardware resource requirements, it was determined that the instance size of “t2.micro” would be suitable for both the application and database instances.</p><p>Additionally, I identified the necessary AWS resources such as VPC (Virtual Private Cloud), Availability Zones, Subnets, and Region for hosting these instances. These details were determined based on factors such as network configuration, geographic location, and redundancy requirements.</p><p>In summary, the migration plan involved selecting “t2.micro” instances for our application and database, their names and setting up the corresponding AWS infrastructure including VPC, Availability Zones, Subnets, and Region to support our application’s requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vSCbKAg4PhdDoC1i_iMfEA.png" /></figure><p>Next, I compiled a list of prerequisites necessary to ensure the seamless operation of our application on AWS post-migration. This step was crucial to preemptively address any potential conflicts or issues that might arise between our on-premises application and its AWS counterpart. By identifying and addressing these prerequisites upfront, we aimed to guarantee the smooth transition of our application to AWS while maintaining optimal performance and functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYndR1IpFhRDYQ-JGorv7g.png" /></figure><p><strong>Step-2(Implementation):</strong></p><p><strong>VPC:</strong></p><p>To begin with, I established a Virtual Private Cloud (VPC) in AWS, denoted as “vpc-production-1”. A VPC enables us to securely manage our virtual networking environment, encompassing IP addresses, subnets, and network gateways. For instance, it allows us to isolate a database within a private-facing subnet, disconnected from the internet, ensuring enhanced security.</p><p>As part of the VPC creation process, a crucial step involved selecting an IPv4 CIDR block for IP addresses. Adhering to security best practices, it was imperative to ensure that these IP addresses did not overlap with existing ones. Therefore, I opted for the IPv4 CIDR block “10.0.0.0/16”.</p><p>Subsequently, three subnets were established within this VPC. Among them, one was designated as a public subnet (“10.0.0.0/24”) intended for the application server, while the other two were configured as private subnets (“10.0.1.0/24” and “10.0.2.0/24”) dedicated to housing our database instances. To enhance reliability and ensure high availability, distinct availability zones within the same region were selected for these private subnets. This strategic decision provides us with the flexibility to maintain robust database operations even in the event of zone failures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4gHT_o0riPRkghHUQWtrSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGCapKgm1hQaQMU8GYWRqg.png" /></figure><p>Subsequently, an internet gateway, labeled “igw-mod3”, was established to facilitate external connectivity for our VPC. Once created, it was seamlessly attached to our VPC, “vpc-production-1”. This integration enables our VPC to establish communication with the internet, allowing inbound and outbound traffic flow as necessary for our application and its associated services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6s1eMD8vMjYoQMWtoYX3xQ.png" /></figure><p>Following the establishment of the internet gateway and its attachment to our VPC, the next step was to configure a route within the route table. This route was designed to enable our EC2 instances to communicate with the outside internet seamlessly. Specifically, a route entry for destination “0.0.0.0/0” was added to the route table, directing all traffic destined for the internet to traverse through the attached internet gateway. This configuration ensures that our EC2 instances have the necessary connectivity to interact with external services and resources across the internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zXJyA0kKqP60OPpbL01klg.png" /></figure><p><strong>EC2- For Hosting Application:</strong></p><p>Following that, I created an EC2 instance for hosting our application on AWS. During the setup process, I associated the instance with the VPC “vpc-production-1”. Additionally, I designated the public subnet specifically configured for the application server as the chosen subnet for this EC2 instance. This ensures that the instance is deployed within the appropriate network environment, allowing it to securely interact with external resources while serving our application to users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aZJgEC-30Kr8XSmGrZnzLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ad84-k9KgKTR1-mdnS2Y2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*WNcX1vOX1lrgiGh9IeWdPg.png" /></figure><p>I created a security group named “app-sg01” for our application server where custom TCP port 8080 was added to access our application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYyjeZk3TQifZwAjXP5cwg.png" /></figure><p>From the picture above we can see the information of our ec2 instance where our application will be hosted.</p><p>Afterwards, I securely accessed the EC2 instance using SSH, utilizing the private key for authentication. Once connected, I proceeded to install all the required prerequisites on the application server. These prerequisites encompassed essential packages, libraries, and applications necessary for running our application smoothly, as well as managing the associated database. This involved installing and configuring software components to ensure that the application server is fully equipped to handle the operational requirements of our application and its underlying database infrastructure.</p><pre>ssh -i ssh-key.pem ubuntu@18.205.236.186<br>sudo apt-get update<br>sudo apt-get install python3<br>sudo apt-get install python3-dev<br>sudo apt-get install libmysqlclient-dev<br>sudo apt-get install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev<br>sudo apt-get install python3-dev default-libmysqlclient-dev build-essential<br>sudo apt-get install pkg-config<br>curl -O https://bootstrap.pypa.io/get-pip.py ; python3 get-pip.py --user<br>export PATH=$PATH:/home/ubuntu/.local/bin/<br>pip3 install flask<br>pip3 install wtforms<br>pip3 install flask_mysqldb<br>pip3 install passlib<br>sudo apt-get install mysql-client -y</pre><p><strong>Database Instance:</strong></p><p>Using AWS RDS service I created a MySQL database instance for our application and the steps are given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*597iOv1vja2wEoi2yA0_Cg.png" /></figure><p>At first, I chose the Standard create option and selected MySQL. Here I chose MySQL engine version 5.7.44</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*UmrzgLGMUufNmWXGEyDLEA.png" /></figure><p>Since this project was undertaken for practice purposes, I opted for the “Free Tier” to prevent any unexpected costs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZT_LxVh0v9blFsd7R_Kb3Q.png" /></figure><p>Then I had to set up a username and password to log into the database instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kkzGO1I8AlH2LKtQ4-FENg.png" /></figure><p>I named the security group as “sec-group-db-01” and chose availability zone “us-east-1a”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ULzb7IPKcNlTTsimb_D0w.png" /></figure><p>The database instance is up and running. Now, I logged into the application server via SSH and downloaded both the application and the ‘Dump’ files from the on-premises database.</p><pre>ssh -i ssh-key.pem ubuntu@18.205.236.186<br>mkdir App-files<br>cd App-files<br>wget https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/wikiapp-en.zip<br>wget https://tcb-bootcamps.s3.amazonaws.com/bootcamp-aws/en/module3/dump-en.sql</pre><p>Unzipped the application files using the below commands:</p><pre>sudo apt-get install unzip<br>unzip wikiapp-en.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*AzX6korvaXFMnCkRiJIYzQ.png" /></figure><p>I updated the file wiki.py with the database endpoint on AWS, ensuring that wiki.py directs to the correct MYSQL_HOST.</p><pre>cd wikiapp/<br>vi wiki.py<br>session &#39;# Config MySQL&#39;<br>&#39;MYSQL_HOST&#39; = &#39;awsuse1db01.cjmk200k04id.us-east-1.rds.amazonaws.com&#39;<br>&#39;MYSQL_USER&#39; = &#39;wiki&#39;</pre><p>Then I logged into the MySQL server using the credentials and database endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_chWs5FDlzGrPqOrKH3mTQ.png" /></figure><pre>mysql -h awsuse1db01.cjmk200k04id.us-east-1.rds.amazonaws.com -P 3306 -u admin -p<br>password:***********</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3UnuXRrc4VN0-gPXs-_qQg.png" /></figure><p>Subsequently, I created a database named “wikidb” and a user named “wiki” while importing the dump files from the on-premises database. This involved executing SQL commands to establish the database structure and import the data from the dump files into the newly created database.</p><pre>show databases;<br>create database wikidb;<br>show databases;<br>use wikidb;<br>show tables;<br>source dump.sql;<br>show tables;<br>select * from articles;<br><br>CREATE USER wiki@&#39;%&#39; IDENTIFIED BY &#39;wiki123456&#39;;<br>GRANT ALL PRIVILEGES ON wikidb.* TO wiki@&#39;%&#39;;<br>FLUSH PRIVILEGES;<br>EXIT;</pre><p><strong>Step-3(Go-Live):</strong></p><p>For this project, I adjusted the security groups for the database instance to allow communication from any IP address. However, it’s essential to note that exposing your database instance to the outside world poses security risks, such as potential brute-force attacks. Therefore, adhering to security best practices, it is recommended not to expose your database instance to the public internet unnecessarily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*Mk5Q_QhFzr5gEBgKUcoKyA.png" /></figure><p>Next, I executed the file wiki.py using the following command. After executing the command, the webpage of ABC Company Wiki became live. We can verify this by accessing the webpage through the IP address and port 8080 on the browser.</p><pre>python3 wiki.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q2CORXXrPPTRWVMRDTJ2Cg.png" /></figure><p>As we can see our application is live and running.I tried to see the articles and i could see them present in the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RCYK4ymGC5n01kGBEiTbaA.png" /></figure><p>Using the credentials “admin” for the username and “admin” for the password, I successfully logged into the account. I then added a new article to ensure that everything was functioning correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zhTRWWLASC_E45T_pFCOZw.png" /></figure><p>And I was able to see my new added article.</p><p>In this step, I migrated the on-premises database files into the database instance on AWS. Following this, I validated that the database is functioning correctly and responding appropriately to queries.I could write and add new articles to the database.</p><p><strong>Step-4(Post Go-Live):</strong></p><p>With the migration process completed, the next step involved providing post Go-Live support. This primarily entailed monitoring the application server and database instance to ensure they were functioning properly. Additionally, any problems or issues that arose would be promptly addressed and supported to maintain the smooth operation of the system.</p><p><strong>Conclusion:</strong></p><p>We have reached the conclusion of this project. Throughout the process, I utilized Git-Bash as the terminal for accessing and working on the application server EC2 instance. Successfully, I migrated on-premises data to the AWS cloud, covering both the application server and its database server. I hope you found this project informative. Thank you for your attention and collaboration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f983918aff28" 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/@ramimhossain67/automated-user-migration-and-management-of-aws-identity-and-access-management-iam-resources-e4dcb03ba9c9?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4dcb03ba9c9</guid>
            <category><![CDATA[shell-script]]></category>
            <category><![CDATA[git-bash]]></category>
            <category><![CDATA[aws-iam]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-cloudshell]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Sat, 24 Feb 2024 01:27:29 GMT</pubDate>
            <atom:updated>2024-02-26T07:53:56.042Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdK6qaygPGSPH-ajQu82ow.png" /></figure><h3><strong>Project Description:</strong></h3><p>In this project based on a real-world scenario, I acted as a 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*AE_ZAX_PBZlbp9eByk9L8g.png" /></figure><h3><strong>Step-1:</strong></h3><p>As a security best practice, instead of utilizing the root account for this project, I have created an IAM user with administrative access, which incorporates Multi-factor Authentication (MFA) as an additional layer of security. My IAM user is associated with the “Admin” group, which includes three attached policies. Among these, the “EnforceMFAPolicy” is a custom policy designed to mandate MFA activation for IAM users as a security best practice. Failure to enable MFA would deny access to services due to security concerns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mRe9WAheiJ7aLE0KykKqlA.png" /><figcaption>IAM User</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Be2psA1rcnaspZaUOIFe8g.png" /><figcaption>Attached Policies of Admin Group</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ib7Vcf5r3flr4XyJmO2NQ.png" /><figcaption>MFA Enabled for IAM User and Root User</figcaption></figure><h3>Step-2:</h3><p>Based on the Microsoft Excel worksheet provided to me, I have created five groups and attached policies to each group accordingly. The groups are as follows:</p><p>1. <em>CloudAdmin</em></p><p>2. <em>DBA</em></p><p>3. <em>LinuxAdmin</em></p><p>4. <em>NetworkAdmin</em></p><p>5. <em>Trainees</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JV96YlQFLlwhIItuxcTIEw.png" /><figcaption>Groups</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLZcV8K1RIiz85oUV_Rr7Q.png" /><figcaption>Policies Attached to DBA</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HT1t3vjHoqt8Uj3M4Iusew.png" /><figcaption>Policies Attached to CloudAdmin</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwp1xu_8fadHkiTfO_R15A.png" /><figcaption>Policies Attached to LinuxAdmin</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*rTlURCss_dbr8k7v-1gZzQ.png" /><figcaption>Policies Attached to NetworkAdmin</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GtRRSwJaki-4Qb1-SZLWZw.png" /><figcaption>Policies Attached to Trainees</figcaption></figure><p>This is the custom policy for enforcing MFA(Multi-factor Authentication) on every user account.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;AllowViewAccountInfo&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;iam:ListVirtualMFADevices&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;AllowManageOwnVirtualMFADevice&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;iam:CreateVirtualMFADevice&quot;,<br>                &quot;iam:DeleteVirtualMFADevice&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:iam::*:mfa/${aws:username}&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;AllowManageOwnUserMFA&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;iam:DeactivateMFADevice&quot;,<br>                &quot;iam:EnableMFADevice&quot;,<br>                &quot;iam:GetUser&quot;,<br>                &quot;iam:ListMFADevices&quot;,<br>                &quot;iam:ResyncMFADevice&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:aws:iam::*:user/${aws:username}&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;DenyAllExceptListedIfNoMFA&quot;,<br>            &quot;Effect&quot;: &quot;Deny&quot;,<br>            &quot;NotAction&quot;: [<br>                &quot;iam:ListUsers&quot;,<br>                &quot;iam:CreateVirtualMFADevice&quot;,<br>                &quot;iam:EnableMFADevice&quot;,<br>                &quot;iam:GetUser&quot;,<br>                &quot;iam:ListMFADevices&quot;,<br>                &quot;iam:ListVirtualMFADevices&quot;,<br>                &quot;iam:ResyncMFADevice&quot;,<br>                &quot;iam:ChangePassword&quot;,<br>                &quot;iam:CreateUser&quot;,<br>                &quot;iam:CreateLoginProfile&quot;,<br>                &quot;iam:AddUserToGroup&quot;,<br>                &quot;sts:GetSessionToken&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;BoolIfExists&quot;: {<br>                    &quot;aws:MultiFactorAuthPresent&quot;: &quot;false&quot;<br>                }<br>            }<br>        }<br>    ]</pre><h3>Step-3:</h3><p>I have modified the Excel worksheet to include three columns: user, group, and password. These columns contain information about the usernames, associated groups, and custom passwords set by me. The purpose of this modification is to facilitate the creation of users using a shell script as part of an automation process. This project aims to automate the user creation process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3CAuLiKcNjwFi-UHuPDyDA.png" /><figcaption>List of 100 users</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*e2C707dP-QJMIr5xoQ8puQ.png" /><figcaption>Modified Excel</figcaption></figure><p>We need to save the Excel worksheet as a ‘CSV (comma delimited) (*.csv)’ file format to ensure compatibility with our shell script when used as an input argument in AWS CloudShell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcevYXitBdCkmCMCWFU0gw.png" /><figcaption>Saved As .csv</figcaption></figure><h3>Step-4:</h3><p>Now, we have to go to AWS CloudShell to run the shell script using our file users.csv as the first argument. First, we need to install dos2unix in CloudShell. unix2dos is a tool to convert line breaks in a text file from Unix format to DOS format and vice versa. When invoked as unix2dos the program will convert a Unix text file to DOS format, when invoked as dos2unix it will convert a DOS text file to Unix format.</p><pre>sudo yum install dos2unix -y</pre><p>When executing the script in AWS CloudShell, we first need to download the shell script from GitHub and upload the “users.csv” file from our local directory. There is a demo users.csv file can be found in GitHub repository as well.The script will then utilize “users.csv” as the first argument to create IAM users, set passwords, and add them to their respective groups. We need to ensure to adjust the script’s permissions by using the “chmod +x &lt;file&gt;” command to allow execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L3TRh_4B9ialgS6Y5e1kPA.png" /><figcaption>Uploading <strong>users.csv</strong> File in AWS CloudShell From Local Directory</figcaption></figure><p><strong>Run these commands:</strong></p><pre>git clone https://github.com/msh-r/AWS-IAM-Project.git</pre><pre>chmod +x aws-iam-create-user.sh</pre><pre>./aws-iam-create-user.sh users.csv</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6BWhYfhukB4etxvR8YJuRA.png" /><figcaption>Script is Running</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pq-R2fI4WV2tCP23v457UQ.png" /><figcaption>Created Users</figcaption></figure><h3><strong>Step-5:</strong></h3><p>Now that our users are created, we can verify if our policies for the users are functioning correctly. Users can attempt to log in, and as a security best practice, they will be prompted to change their passwords.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*ZXNL5XAwlB7ORXa3pbXrqA.png" /></figure><p>Upon logging in, we may observe that our users are still encountering an issue as they have not yet set up Multi-factor Authentication (MFA).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JoO3G0JWgcbju2akuW0RNg.png" /></figure><p>Now, we will proceed to set up MFA for this user and then verify if they can access the services properly. As illustrated below, after configuring MFA, the user gains access to the assigned services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kM078odD95lt9TDgRaEFEw.png" /></figure><p>We can distribute the credentials to all users, and thereafter, it becomes their responsibility to set up a new password and enable MFA(Multi-factor Authentication) for their accounts to access their designated services.</p><p>We used Git-Bash as source Control management tool.The script and a demo .csv file can be found in GitHub repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtYpP0NA_TsWpASLONeEvg.png" /></figure><h3><strong>Conclusion:</strong></h3><p>With this, our project of automating the user creation process in AWS concludes. I hope you found this project informative. Thank you!</p><p>GitHub Repo URL: <a href="https://github.com/msh-r/AWS-IAM-Project.git">https://github.com/msh-r/AWS-IAM-Project.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4dcb03ba9c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps Project: Created a CI/CD Pipeline On Jenkins To Deploy A Web Application On Tomcat]]></title>
            <link>https://medium.com/@ramimhossain67/devops-project-created-a-ci-cd-pipeline-on-jenkins-to-deploy-a-web-application-on-tomcat-8ce41d2f0e3e?source=rss-c139c4227e97------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ce41d2f0e3e</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[jenkins]]></category>
            <dc:creator><![CDATA[Mohammad Shakhawat Hossain]]></dc:creator>
            <pubDate>Thu, 15 Feb 2024 07:11:37 GMT</pubDate>
            <atom:updated>2024-02-15T07:11:37.491Z</atom:updated>
            <content:encoded><![CDATA[<p>In this DevOps project, I showcased the seamless integration of changes made on GitHub through webhook triggers and their continuous deployment onto a Tomcat server hosted on an AWS EC2 instance. Similarly, our Jenkins service operates on a separate EC2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*410ZG7t6QGcZpgAVQkGqmw.png" /><figcaption>CI/CD flow</figcaption></figure><h3><strong><em>Step 1:</em></strong> Provision EC2 Instances on AWS</h3><ul><li>I have created two EC2 instances on AWS: one for running Jenkins and another for running Tomcat.</li><li>Named the instance running Jenkins as “Jenkins”.</li><li>Configured the security group for the Jenkins server to allow access to port 8080, which is the default port for accessing Jenkins.</li><li>Similarly, configured the security group for the Tomcat server to allow access to port 8080 for accessing the deployed application.</li></ul><p>This setup ensures that both Jenkins and Tomcat instances can communicate over port 8080, enabling Jenkins to deploy applications to Tomcat. I used “Termius” which is a client to login and access the ec-2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcp3IUBe2Wuq4v6ogT2LXA.png" /><figcaption>AWS — EC-2 Instances</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3vrtjYgL_TAPCYCVO_jadQ.png" /><figcaption>Termius Client</figcaption></figure><h3><strong><em>Step-2:</em> Writing pipeline for CI/CD flow of the project</strong></h3><p>Next steps in my setup involve configuring Jenkins to pull code from GitHub repositories, setting up build jobs or pipelines to compile and package my application using Maven, and configuring deployment jobs to deploy the built artifacts to the Tomcat server. I had to make sure the servers are communicating over SSH using private key.I had to set up a webhook in GitHub to trigger Jenkins builds automatically whenever changes are pushed to the repository. Additionally, I configured authentication and permissions to ensure secure SSH access to both Jenkins and Tomcat instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*tBaqp2pcpXHTt30suyO0FA.png" /><figcaption>Jenkins Pipeline</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ziMxExiPR3UJAXBwWQ0tqw.png" /><figcaption>Running Pipeline On Jenkins</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LlLYiySwLW-4jySpTsy8ww.png" /><figcaption>Github Webhook to trigger Pipeline</figcaption></figure><h3><strong><em>Step-3: Creating a Dockerfile and A shell script to build and run Tomcat Container</em></strong></h3><p>Subsequently, I crafted a Dockerfile aimed at generating a Docker image of Tomcat, built upon the Ubuntu base. This Dockerfile, along with our WebAPP.war file, which had been packaged using Maven, were transmitted to the Tomcat server. Following this, I devised a concise shell script to establish a secure connection with the Tomcat server. This script facilitated the construction of the Docker image directly on the Tomcat server, incorporating Tomcat, and relocating the WebApp.war file to a designated location within the image, ensuring its availability for executing our application upon activation as a container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*_zjCkl2NcS4DO4Q-DQZrpA.png" /><figcaption>Dockerfile for Tomcat</figcaption></figure><h3><strong><em>Step-4:</em></strong><em> </em><strong><em>Verify the image is built and container is running properly</em></strong></h3><p>In the final phase of this project, we verified the successful construction of the Docker image. Subsequently, we observed the container’s execution on our Tomcat EC2 instance. As a result, our Tomcat server is operational, allowing us to utilize the host’s IP address along with the port number exposed in the Dockerfile to establish a connection with the container. By using this address: Host-IP:Port/WebAPP we can access our application. Here WebAPP is the name of the war file that was set in pom.xml file during the build process by Maven.</p><pre>REMOTE_USER=&quot;ubuntu&quot;                        # Username on the remote EC2 instance<br>REMOTE_HOST=&quot;34.229.151.248&quot;    # IP address or DNS name of the remote EC2 instance<br>DOCKERFILE_PATH=&quot;/home/ubuntu/webapp&quot;  # Path to your Dockerfile on the remote EC2 instance<br><br>#docker run -d --name tomcat-container -p 8081:8090 tomcat-image<br># SSH into the remote EC2 instance and execute Docker build<br>#docker build -t tomcat_image $(basename $DOCKERFILE_PATH)<br>#docker stop $(docker ps -aq) &amp;&amp; docker rm $(docker ps -aq)<br>#docker rmi $(docker images -q)<br><br>sudo -u ubuntu ssh -i /home/ubuntu/.ssh/id_rsa $REMOTE_USER@$REMOTE_HOST &lt;&lt; EOF<br>  echo &quot;Connected to remote instance.&quot;<br>  cd $(dirname $DOCKERFILE_PATH)<br>  docker stop tomcat-container &amp;&amp; docker rm tomcat-container<br>  docker rmi mytomcat  <br>  docker build -t mytomcat $(basename $DOCKERFILE_PATH)<br>  docker images -a<br>  sudo -u ubuntu docker run -d --name tomcat-container -p 8080:8080 mytomcat<br>  docker ps -a<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s8ULUQxQoPyCSVGRnYxmmw.png" /><figcaption>Tomcat</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABGU9MJdglfJOXnSvvZSlw.png" /><figcaption>This is our web application</figcaption></figure><p>I have added the Github Repository link here:</p><p><a href="https://github.com/msh-r/webapp.git">https://github.com/msh-r/webapp.git</a></p><p>I hope you like this project and try this yourself. Thank you! Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ce41d2f0e3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>