<?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 Temesgen Meri on Medium]]></title>
        <description><![CDATA[Stories by Temesgen Meri on Medium]]></description>
        <link>https://medium.com/@teme_24?source=rss-c02b16606feb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pKzXHgU3KSk3jK-uGnGJ2Q.jpeg</url>
            <title>Stories by Temesgen Meri on Medium</title>
            <link>https://medium.com/@teme_24?source=rss-c02b16606feb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:25:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@teme_24/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[Deploying Amazon EC2 Web-Servers using Terraform in monolith structure]]></title>
            <link>https://medium.com/@teme_24/deploying-amazon-ec2-web-servers-using-terraform-in-monolith-structure-75bb0834c58c?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/75bb0834c58c</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[terraform-provider]]></category>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[user-data]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Sun, 08 Jan 2023 21:37:27 GMT</pubDate>
            <atom:updated>2023-01-08T21:37:27.421Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*twpjh2eFD_l-Rg2O_ejObw.jpeg" /><figcaption>Diagram used to write code below</figcaption></figure><p>Happy New Year friends:</p><p>I was assigned a project to deploy multiple Amazon EC2 servers using Terraform and here it goes:</p><p>Your team needs you to deploy a Web Server for your company that is fault tolerant. For the Foundational project you are allowed to have all your code in a single <a href="http://main.tf/">main.tf</a> file (known as a monolith) with hardcoded data.</p><ol><li>Deploy 3 EC2 Instances. Each in a different Availability Zone in the same Region using your Default VPC.</li><li>Bootstrap the EC2 instances using the webserver of your choice so a custom static web page appears.</li><li>Create and assign a Security Group to the Webservers that allows all traffic on port 80 &amp; SSH from your ip.</li></ol><p>First, I will explain what Terraform mean, how it works and what is the benefit using Terraform.</p><p><strong><em>What is Terraform?</em></strong></p><p>Terraform is an infrastructure as code tool that lets you build, change, and version cloud and on-prem resources safely and efficiently.</p><p>HashiCorp Terraform is an infrastructure as code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like compute, storage, and networking resources, as well as high-level components like DNS entries and SaaS features.</p><p><strong><em>How does Terraform work?</em></strong></p><p>Terraform creates and manages resources on cloud platforms and other services through their application programming interfaces (APIs). Providers enable Terraform to work with virtually any platform or service with an accessible API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ktdZyNjwjC1Pxo8u" /><figcaption>picture taken from <a href="https://developer.hashicorp.com/terraform/intro">https://developer.hashicorp.com/terraform/intro</a></figcaption></figure><p>HashiCorp and the Terraform community have already written thousands of providers to manage many different types of resources and services. You can find all publicly available providers on the <a href="https://registry.terraform.io/">Terraform Registry</a>, including Amazon Web Services (AWS), Azure, Google Cloud Platform (GCP), Kubernetes, Helm, GitHub, Splunk, DataDog, and many more.</p><p>The core Terraform workflow consists of three stages:</p><ul><li><strong>Write:</strong> You define resources, which may be across multiple cloud providers and services. For example, you might create a configuration to deploy an application on virtual machines in a Virtual Private Cloud (VPC) network with security groups and a load balancer.</li><li><strong>Plan:</strong> Terraform creates an execution plan describing the infrastructure it will create, update, or destroy based on the existing infrastructure and your configuration.</li><li><strong>Apply:</strong> On approval, Terraform performs the proposed operations in the correct order, respecting any resource dependencies. For example, if you update the properties of a VPC and change the number of virtual machines in that VPC, Terraform will recreate the VPC before scaling the virtual machines.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t0lZ1ZESlrcWsf6F" /><figcaption>picture taken from <a href="https://developer.hashicorp.com/terraform/intro">https://developer.hashicorp.com/terraform/intro</a></figcaption></figure><p><strong><em>Why Terraform?</em></strong></p><p>HashiCorp co-founder and CTO Armon Dadgar explains how Terraform solves infrastructure challenges.</p><p><strong>Manage any infrastructure</strong></p><p>Find providers for many of the platforms and services you already use in the <a href="https://registry.terraform.io/">Terraform Registry</a>. You can also <a href="https://developer.hashicorp.com/terraform/plugin">write your own</a>. Terraform takes an <a href="https://www.hashicorp.com/resources/what-is-mutable-vs-immutable-infrastructure">immutable approach to infrastructure</a>, reducing the complexity of upgrading or modifying your services and infrastructure.</p><p><strong>Track your infrastructure</strong></p><p>Terraform generates a plan and prompts you for your approval before modifying your infrastructure. It also keeps track of your real infrastructure in a <a href="https://developer.hashicorp.com/terraform/language/state">state file</a>, which acts as a source of truth for your environment. Terraform uses the state file to determine the changes to make to your infrastructure so that it will match your configuration.</p><p><strong>Automate changes</strong></p><p>Terraform configuration files are declarative, meaning that they describe the end state of your infrastructure. You do not need to write step-by-step instructions to create resources because Terraform handles the underlying logic. Terraform builds a resource graph to determine resource dependencies and creates or modifies non-dependent resources in parallel. This allows Terraform to provision resources efficiently.</p><p><strong>Standardize configurations</strong></p><p>Terraform supports reusable configuration components called <a href="https://developer.hashicorp.com/terraform/language/modules">modules</a> that define configurable collections of infrastructure, saving time and encouraging best practices. You can use publicly available modules from the Terraform Registry, or write your own.</p><p><strong>Collaborate</strong></p><p>Since your configuration is written in a file, you can commit it to a Version Control System (VCS) and use <a href="https://developer.hashicorp.com/terraform/intro/terraform-editions#terraform-cloud">Terraform Cloud</a> to efficiently manage Terraform workflows across teams. Terraform Cloud runs Terraform in a consistent, reliable environment and provides secure access to shared state and secret data, role-based access controls, a private registry for sharing both modules and providers, and more.</p><p>Source: <a href="https://developer.hashicorp.com/terraform/intro">https://developer.hashicorp.com/terraform/intro</a></p><p><strong>Pre-requisites:</strong></p><p>1, Amazon Management console, if you don’t have one you can sign up here: <a href="https://aws.amazon.com/">https://aws.amazon.com/</a></p><p>2, Use any IDE like Cloud9, VS code and others. I am using Cloud9.</p><p>3, Download Terraform to your IDE environment. Use <a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli">https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli</a></p><p>4, You need to have Git Hub account, if you don’t have one, please sign up here: <a href="https://github.com/">https://github.com/</a></p><p>First, we need to declare the provider that we are going to use like AWS Cloud, Microsoft Azure or Google Cloud. I’m using AWS Cloud.</p><p>Login to your AWS Management console and head to Cloud9:</p><p>After downloading Terraform then need to create a new directory to work for this project. Also it is recommended to start on a new directory.</p><p>Then create main.tf file where all the codes will be written, plan and apply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*zEiT-kUJNDjQL6B0j-_L0A.png" /><figcaption>Create a directory where you want to store your project</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*NLCSypRT05bV6MdrcyDb1A.png" /><figcaption>CD in to the directory</figcaption></figure><p>Initialize Terraform by the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*U8d8lQttt2v1vYoyyesITQ.png" /><figcaption>First command when initializing Terraform</figcaption></figure><p>We can see below that it successfully initialized:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*A9p85VJxrY5itOU8QGVR4g.png" /><figcaption>This message will confirm to us Terraform initialized successfully</figcaption></figure><p>We also can format our code which means Terraform will take of the way our code is written including indentation.</p><p>The outcome of the Terraform fmt will be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*Fo5EjcGgoQIo6wZcC8YWhA.png" /><figcaption>Terraform fmt will make sure our codes are written proper way of indentation and free of errors</figcaption></figure><p>We can also validate our code by a validate command as shown below, this will validate our code is written correctly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*DyGIawPqVrBFkdeBeVRgnA.png" /><figcaption>Terraform validate will validate that our code has no errors</figcaption></figure><p>The next command will be terraform apply, this command tells us what Terraform will build for us as per our code, it is like the blue print of our infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*qxKVGyMfxy7hiC2JW3k7mg.png" /><figcaption>Terraform blue print</figcaption></figure><p>After we type terraform plan terraform will display all the things that will build for us and it will be a lot of code lines depending on how many things we ask Terraform to build for us. We should see at the end how many resource will build for us:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHn8lazdX6lc-Q6rIbmAQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*cQZ-Cnm4w-Qyk5WygNwXWw.png" /></figure><p>Then the last but not the least command will be terraform apply, which will launch all recourses in AWS management console while we sit and have a cup of coffee, isn’t Terraform beautiful, Love Terraform!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*Sr7kYNyqgmZdqFJM1vLSmg.png" /><figcaption>the last command in Terraform</figcaption></figure><p>Next, Terraform will still ask us if we want to proceed with the launching of our resources and we either say Yes or No:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*gBeuIOnWzj3nPxL1pq7zOw.png" /></figure><p>This is how it looks like after terraform apply command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*AYNShyVS_aF88TZRIPyipw.png" /><figcaption>moment of Truth</figcaption></figure><p>We expect to see the following output after terraform apply command is done:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*AVHSdiAdN4SnY5pHTUpJSw.png" /></figure><p>Then if we flip back to our AWS management console it is TADAAAAA!</p><p>First I confirmed the my VPC was created as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvzWJcs_WPPzT7Y3vdHmbg.png" /></figure><p>Then followed by Internet Gateway:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K8ItosBas6N0SYcI1Qv-Tg.png" /></figure><p>After that Route Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4Vedd-XUxEpFtS0F7_Nlg.png" /></figure><p>Next 3 Subnets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jGri_92E97iHgqLmOZCr3A.png" /></figure><p>Then Route Table association:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AOkvSDaInt7SgsPPE87dsQ.png" /></figure><p>Finally We can see 3 Web Servers instances created below, note the 4th EC2 is my Cloud9 EC2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pQnZNGcPs8sVf3ghnjIVJw.png" /></figure><p>The last task to do is to SSH to our Web-Server:</p><p>The challenge you may face is getting error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).</p><p>You can resolve it by chmod command as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*AcoMsq2Yw5yrqHuCbiUoIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UOfMvqGezQuyiJGzLApBuQ.png" /></figure><p>Also I was able to access the Web-Server using its Public IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9XLoXND-V7nQpoErF-kWQ.png" /></figure><p>Always let’s not forgot to turn of the switch of AWS otherwise our bill will rack up:). We do this by a command terraform destroy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*SBEEMDQn9lenuSdfp36H3Q.png" /><figcaption>time to demolish our building</figcaption></figure><p>Terraform will still warn us if we are we want to do this, enter YES:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*utgkBEasmrLBgxuHVUvi9Q.png" /><figcaption>there is no turning back</figcaption></figure><p>This is the complete code for this project and can be found at my git hub repo: <a href="https://github.com/tmeri/Terraform-Projects">https://github.com/tmeri/Terraform-Projects</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ef1029b47f2c2e88d1ab9aa6cee71f0/href">https://medium.com/media/5ef1029b47f2c2e88d1ab9aa6cee71f0/href</a></iframe><p><strong>Conclusion:</strong></p><p>This project was fun in away it tested my patience and all I got out of this was the desire to learn and know how to fix line of codes and simplifies my work instead of going to AWS management console and creating all these recourses which is time consuming and may commit some errors too. The beauty of this is these line of codes can be reused to deploy other resources too with a little change and most of all Terraform is cloud agnostic which means can be used with any Cloud environment.</p><p>Thank you for dropping by :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75bb0834c58c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customizing NGINX HTML file using Kubernetes ConfigMap]]></title>
            <link>https://medium.com/@teme_24/customizing-nginx-html-file-using-kubernetes-configmap-64c715f7512a?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/64c715f7512a</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[configmap]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Thu, 15 Dec 2022 03:17:16 GMT</pubDate>
            <atom:updated>2022-12-15T03:19:42.621Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*4knSotVVr7u_q6Rw_-RAqg.png" /></figure><p>Hello friends:</p><p>This article is about a project I was assigned to customize NGINX html file using Kubernetes ConfigMap.</p><p><strong><em>Scenario:</em></strong></p><p><strong><em>FOUNDATIONAL</em></strong><br>1, Create two deployments. The first deployment contains 5 pods all running some NGINX. The second deployment contains 4 pods that use the nginx:alpine image.</p><p>2, Create a ConfigMap that points to a custom index.html page that contains the line “This web page is housed on a Pod running Nginx”.</p><p>3, Ensure you can reach the service from the internet, which means you should be able to reach the service IP address and port from any computer with internet access.</p><p><strong>What is Config Map?</strong></p><p>A ConfigMap is an API object used to store non-confidential data in key-value pairs. <a href="https://kubernetes.io/docs/concepts/workloads/pods/">Pods</a> can consume ConfigMaps as environment variables, command-line arguments, or as configuration files in a <a href="https://kubernetes.io/docs/concepts/storage/volumes/">volume</a>.</p><p>A ConfigMap allows you to decouple environment-specific configuration from your <a href="https://kubernetes.io/docs/reference/glossary/?all=true#term-image">container images</a>, so that your applications are easily portable.</p><p>Source: <a href="https://kubernetes.io/docs/concepts/configuration/configmap/">https://kubernetes.io/docs/concepts/configuration/configmap/</a></p><p><strong><em>Requirements:</em></strong></p><ul><li>Access to any IDE like VS code (this helps for indentation purposes, otherwise you can code it on vi)</li><li>You should have your Kubernetes set up -&gt; here : <a href="https://kubernetes.io/docs/setup/production-environment/tools/">https://kubernetes.io/docs/setup/production-environment/tools/</a></li><li>You need to have a Docker Hub account -&gt; here : <a href="https://hub.docker.com/">https://hub.docker.com/</a></li></ul><p>To accomplish that first we will code the ConfigMap code in YAML as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*NQfQbZSII8VMEFyMSJiyyQ.png" /></figure><p>Before we can use the configmap we have to reference it in the cluster:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*let6ynfSDdYAcvdr--JB_w.png" /></figure><p>Then we will code the deployment file in YAML as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*Z56kJBqAgayvWX9xz44DRA.png" /></figure><p>To create the deployment file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*kxJLSKimhH7bS0LvgTWNdQ.png" /></figure><p>To verify the pods:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*MzUQZ7lIzFeYCj9G1eZXAA.png" /></figure><p>Then we will create a service file in YAML that will help us to open a port to access to the Internet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*NTyYCSPwPBgZBtMdxfbQCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*f_CEvQxgi6y-sMz-Npd0-w.png" /></figure><p>Next we will createthe service as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*BSsi1BiqAtSkdYQ4yRV3CA.png" /></figure><p>First we need to expose port 80 to access from the internet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*do-V-AI9Dxm1MeuIJftTBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*HNXQkoHYUigyZokU_xtCjQ.png" /></figure><p>After the command above it will launch the default browser. I am using minikube flavor of Kubernetes set up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*PXVbr8FzVKsVmdF7cll8sA.png" /></figure><p>The second deployment contains 4 pods with nginx alpine image.</p><p>To deploy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PNkhrVXCJOn_0-ig20957A.png" /></figure><p>To verify the deployment:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*wAXwRJZ8zxL_ylIBKzdAfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*_azHauO3dj7uM3wtabxfcA.png" /></figure><p>To accomplish that first we will code the ConfigMap code in YAML as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*R2sHdSD-LgUYH5izZEot6g.png" /></figure><p>Copy and past the above code in vim :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*umNhKUiFJbYl5_4c-MRGdw.png" /></figure><p>Create the configmap as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*hGFnlfDrZ31JafEeK_UUFQ.png" /></figure><p>Then we will code the deployment file in YAML as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*4UgU9g5nwUhJoPVmE6D65Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*le6KlUPNxC7XpkddwaeKEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OXb43RGS4RpYVxZv_Aok9w.png" /></figure><p>I was able to curl my IP below to display the NGINX site:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*rykXmOsJ5zXZF_VOKZRQJg.png" /></figure><p><strong><em>Conclusion:</em></strong></p><p>This project was about how to create a Config Map file which is very helpful when we deploy different applications at run time. This will help to use the information on the Config Map easily as it is readily available. If you have any suggestions and feedback to improve my project, please send them.</p><p>Thank you visiting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64c715f7512a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to be a Pirate for a day with Kubernetes]]></title>
            <link>https://medium.com/@teme_24/how-to-be-a-pirate-for-a-day-with-kubernetes-ffb08e27f1d6?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffb08e27f1d6</guid>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[cluster]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Wed, 07 Dec 2022 01:34:18 GMT</pubDate>
            <atom:updated>2022-12-07T01:34:18.114Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*SuVPrn9QJVXlPzmcogs6XA.png" /></figure><p>Greetings:</p><p>This will mark my 17th week at my program in LUIT. We just learned Kubernetes and it means a lot to understand it and work on it. It actually is a concept where it works with Docker containers and orchestrate deployment of different containers faster and reliable. The diagram below will explain what Kubernetes is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*UW5laz_AB7r_Xwu1Zf9Oww.png" /></figure><h3>What is Kubernetes?</h3><p>Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.</p><p>The name Kubernetes originates from Greek, meaning helmsman or pilot. K8s as an abbreviation results from counting the eight letters between the “K” and the “s”. Google open-sourced the Kubernetes project in 2014. Kubernetes combines <a href="https://kubernetes.io/blog/2015/04/borg-predecessor-to-kubernetes/">over 15 years of Google’s experience</a> running production workloads at scale with best-of-breed ideas and practices from the community.</p><h3>Why you need Kubernetes and what it can do?</h3><p>Containers are a good way to bundle and run your applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if a container goes down, another container needs to start. Wouldn’t it be easier if this behavior was handled by a system?</p><p>That’s how Kubernetes comes to the rescue! Kubernetes provides you with a framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more. For example: Kubernetes can easily manage a canary deployment for your system.</p><h3>What Kubernetes is not?</h3><p>Kubernetes is not a traditional, all-inclusive PaaS (Platform as a Service) system. Since Kubernetes operates at the container level rather than at the hardware level, it provides some generally applicable features common to PaaS offerings, such as deployment, scaling, load balancing, and lets users integrate their logging, monitoring, and alerting solutions. However, Kubernetes is not monolithic, and these default solutions are optional and pluggable. Kubernetes provides the building blocks for building developer platforms, but preserves user choice and flexibility where it is important.</p><p>Kubernetes:</p><ul><li>Does not limit the types of applications supported. Kubernetes aims to support an extremely diverse variety of workloads, including stateless, stateful, and data-processing workloads. If an application can run in a container, it should run great on Kubernetes.</li><li>Does not deploy source code and does not build your application. Continuous Integration, Delivery, and Deployment (CI/CD) workflows are determined by organization cultures and preferences as well as technical requirements.</li><li>Does not provide application-level services, such as middleware (for example, message buses), data-processing frameworks (for example, Spark), databases (for example, MySQL), caches, nor cluster storage systems (for example, Ceph) as built-in services. Such components can run on Kubernetes, and/or can be accessed by applications running on Kubernetes through portable mechanisms, such as the <a href="https://openservicebrokerapi.org/">Open Service Broker</a>.</li><li>Does not dictate logging, monitoring, or alerting solutions. It provides some integrations as proof of concept, and mechanisms to collect and export metrics.</li><li>Does not provide nor mandate a configuration language/system (for example, Jsonnet). It provides a declarative API that may be targeted by arbitrary forms of declarative specifications.</li><li>Does not provide nor adopt any comprehensive machine configuration, maintenance, management, or self-healing systems.</li><li>Additionally, Kubernetes is not a mere orchestration system. In fact, it eliminates the need for orchestration. The technical definition of orchestration is execution of a defined workflow: first do A, then B, then C. In contrast, Kubernetes comprises a set of independent, composable control processes that continuously drive the current state towards the provided desired state. It shouldn’t matter how you get from A to C. Centralized control is also not required. This results in a system that is easier to use and more powerful, robust, resilient, and extensible</li></ul><p>Source: <a href="https://kubernetes.io/docs/concepts/overview/"><strong><em>https://kubernetes.io/docs/concepts/overview/</em></strong></a></p><p><strong>Objectives:</strong></p><p><strong><em>FOUNDATIONAL</em></strong></p><p>1| Using the command line, create a deployment that runs the NGINX image.<br>2| Display the details of this deployment.<br>3| Check the event logs from the deployment.<br>4| Delete the deployment.</p><p><strong><em>ADVANCED</em></strong></p><p>1| Create the same deployment using a yaml file.<br>2| Display the details of this deployment via the command line.<br>3| Update the yaml file to scale the deployment to 4 NGINXcontainers.<br>4| Verify the change via the command line.</p><p><strong><em>Requirements:</em></strong></p><p>1| We need to have a Docker account at <a href="https://www.docker.com/"><strong><em>https://www.docker.com/</em></strong></a>.</p><p>2| We need to have access to either Linux command line or Windows Power Shell or Command Line.</p><p>3| We need to have access to a text editor Vim or Nano, at <a href="https://www.vim.org/"><strong><em>https://www.vim.org/</em></strong></a>.</p><p>4| If we want to save our codes to Git repo then we need to have GitHub account at <a href="https://github.com/"><strong><em>https://github.com/</em></strong></a>.</p><p>3| We also have to first download Kubernetes in our system from <a href="https://kubernetes.io/releases/download/"><strong><em>https://kubernetes.io/releases/download/</em></strong></a>.</p><p><strong>Task — 1: Create a deployment that runs NGINX image</strong></p><p>Let’s first create the deployment with the NGINX image.</p><p>Command: <strong><em>kubectl create deployment &lt;deployment name&gt; — image=nginx</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*NU4TaBn8Af__siqkZHFuHA.png" /></figure><p><strong>Task-2: Display the details of this deployment</strong></p><p>To verify our deployment we can use the following commad:</p><p>Command: <strong><em>kubectl get deployments</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*almlH1EAB4grHYSM0GXR6w.png" /></figure><p><strong>Task-3: Check the event logs from the deployment</strong></p><p>The following command will help us to display event logs about our deployment:</p><p>Command: <strong><em>kubectl logs deployment/&lt;deployment name&gt;</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*lehdkZZ3YPeJnxL26I10_A.png" /></figure><p>We can also find out more about our deployment below which also helps to trouleshoot if we encounter any issues with our deployment.</p><p>Command: <strong><em>kubectl describe deployment &lt;deployment name&gt;</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iYkW8cfRS1npM-TfXdXucQ.png" /></figure><p><strong>Task-4: Delete the deployment</strong></p><p>After we are done working on it, we can destroy it by the following command:</p><p>Command: <strong><em>kubectl delete deployment &lt;deployment name&gt;</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*8TI78mOLwY0GN05SdulXaA.png" /></figure><p>To verify that it was deleted:</p><p>Command: <strong><em>kubectl get deployments</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*YpZXRZBNr_ARbQdo6vK3fg.png" /></figure><p><strong><em>ADVANCED</em></strong></p><p>1| Create the same deployment using a yaml file.<br>2| Display the details of this deployment via the command line.<br>3| Update the yaml file to scale the deployment to 4 nginx containers.<br>4| Verify the change via the command line.</p><blockquote><strong>Task-1- Create the same deployment using a yaml file</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*mO1cfSNmJDqBnRGvNDP_VQ.png" /></figure><p>Command: <strong><em>kubectl apply -f &lt;yaml filename&gt;</em></strong></p><p><strong>kubectl apply -f k8s-deploy-file.yml</strong></p><p>I had to install vim on my command prompt from <a href="https://www.vim.org/"><strong><em>https://www.vim.org/</em></strong></a> and had to change the path where it was saved on my windows variable environment as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*cC6B6HVbv2LNCKa_cSOcXw.png" /></figure><p>Search for edit the system environment and add location of Vim to the path under system variables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N13Pf_tGJ4f4sxPDKJ4Vng.png" /></figure><p>Finally we can deploy it using Yaml.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*kty9PAVyJO9uTKIoIOobVw.png" /></figure><blockquote><strong>Task-2 — Display the details of this deployment via the command line</strong></blockquote><p>Let’s verify it we just deployed:</p><p>Command: <strong><em>kubectl get deployments.apps -o wide</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TUPol7J6Pbgrc6Q8dm0k1w.png" /></figure><blockquote><strong>Task-3 — Update the yaml file to scale the deployment to 4 NGINX containers</strong></blockquote><p>Now modify on vim k8s-deploy-file and change the replicas to 4.</p><p>-&gt;&gt;update number of replicas to 4:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*OYoLBuMxKF2CZXFU1X698w.png" /></figure><p>We can see now we have 4 replicas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xQASsrYnxPytdCJelKSRzA.png" /></figure><p>Now we can see all pods are ready and running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*FF21WmKWCmsXGCqtmUwiHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9I0N1rGq2ualtlP3p6hg_Q.png" /></figure><h3>Conclusion:</h3><p>This project taught me how to deal with Kubernetes as it can really get scary if it is a bit complicated. I will definitely learn more about it in the process. The road block was that I wasn’t able to curl the IP as port 80 was blocked and found out based on my research that I can open my firewall for now, however I didn’t just for security reasons and will research more and find out how to do that later.</p><p>Please provide your feedback or suggestions that may help to improve my project.</p><p>Thank you for visiting!</p><p>Finished.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffb08e27f1d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a custom made NGINX Docker image and push it to AWS ECR repository]]></title>
            <link>https://medium.com/@teme_24/deploying-a-custom-made-nginx-docker-image-and-push-it-to-aws-ecr-repository-e2b508ce0eba?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2b508ce0eba</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[aws-ecr]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Mon, 28 Nov 2022 04:40:49 GMT</pubDate>
            <atom:updated>2022-11-28T04:54:43.023Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*k--BSCPIF6XRbcq70bgLZA.png" /></figure><p>Hello friends,</p><p>I was tasked to deploy a custom NGINX image and write a script in a file to accomplish a task.</p><p><strong><em>What is Docker?</em></strong></p><p>Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called <a href="https://aws.amazon.com/containers/">containers</a> that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.</p><p>Running Docker on AWS provides developers and admins a highly reliable, low-cost way to build, ship, and run distributed applications at any scale.</p><p><strong><em>How Docker works?</em></strong></p><p>Docker works by providing a standard way to run your code. Docker is an operating system for containers. Similar to how a <a href="https://aws.amazon.com/ec2/">virtual machine</a> virtualizes (removes the need to directly manage) server hardware, containers virtualize the operating system of a server. Docker is installed on each server and provides simple commands you can use to build, start, or stop containers.</p><p>AWS services such as <a href="https://aws.amazon.com/fargate/">AWS Fargate</a>, <a href="https://aws.amazon.com/ecs/">Amazon ECS</a>, <a href="https://aws.amazon.com/eks/">Amazon EKS</a>, and <a href="https://aws.amazon.com/batch/">AWS Batch</a> make it easy to run and manage Docker containers at scale.</p><p>Source: <a href="https://aws.amazon.com/docker/">https://aws.amazon.com/docker/</a></p><p><a href="https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/">https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/</a></p><blockquote><strong>Scenario:</strong></blockquote><p>Our team needs to deploy a custom image quickly and write a quick script in a file to accomplish a task.</p><ol><li>Create an image using NGINX and add a file that will tell you the date the container has been deployed</li><li>Deploy the container with port 8080 open</li><li>Save the container data to the AWS Elastic Container Registry (ECR)</li></ol><blockquote><strong>Requirements:</strong></blockquote><p>1|Docker Hub account</p><p>2|HTML code</p><p>3|AWS Management Console (Cloud9 IDE)</p><p>My Git Hub to access both files below: Dockerfile and Index.html</p><p>Dockerfile: <a href="https://github.com/tmeri/green_cloud9_boto3/blob/tmeri-221127n/Dockerfile">https://github.com/tmeri/green_cloud9_boto3/blob/tmeri-221127n/Dockerfile</a></p><p>Index.html: <a href="https://github.com/tmeri/green_cloud9_boto3/blob/tmeri-221127n/index.html">https://github.com/tmeri/green_cloud9_boto3/blob/tmeri-221127n/index.html</a></p><p>In this project, I am going to demonstrate how to create a <strong>c</strong>ustom Docker<strong> </strong>image with a Docker file that<strong> </strong>will display the date and time the container has been deployed using NGINX and save that data to the AWS ECR (Elastic Container Registry).</p><p>→&gt;First create a Directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*Gha5SsaEll8L-w6HS0OJoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*OQZTy1T7EvU1jEODP1Z--Q.png" /></figure><p>→&gt;Next, pull latest NGINX from Docker Hub:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*gI6IqNR--Ydhs19kaocxew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*2_NLwPykLbjMnz0Tc6NhPA.png" /></figure><p>→&gt;To verify check Docker images as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*g1CziHcPX8McoSgbdicaPQ.png" /></figure><p>→&gt;Head to vim or nano and modify the<em> Dockerfile </em>to make it run our script on start-up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*FojydnYJJKSQJEcYqkjTYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*7ovuZDfjXEBVLJmoXuym0A.png" /></figure><p>Create Index.html and save it with the following code, this code will be the modified docker image we will have at the end of the process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*kV-uKX0sgNj39x1RYxht1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*6w626gUjV558FmiyHfXCtw.png" /></figure><p>Next, We will build our docker image as from Docker file follows:</p><p>The build command will tell Docker to execute the commands located in our <em>Dockerfile</em>. You will see a similar output in your terminal as below:</p><p><strong>docker build -t &lt;name of the image — create your own&gt;</strong><br><strong>docker build -t nginxrev .</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*rFEAffIAtsQuT5sbwchaDA.png" /></figure><p>The “.” period after the container name is very important.<br>This will ensure that we look for files in the current working directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*zJfW5FgVrEFQbQRML445rQ.png" /></figure><p>To verify let’s check our docker images as follows:</p><p><strong>$docker images</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*aR1rpmySUKXGMhd7ZQXZgg.png" /></figure><p><strong><em>Create and Deploy Docker Container</em></strong></p><p>Let’s run a basic web server using the official NGINX image. Run the following command to start the container.</p><p>With the above command, you started running the container as a daemon (-d) and published port 8080 on the host network. You also named the container web using the --name option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*7iVdTeY4DJKa4I9w1hXUsw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*M_L3aGZaRbl7tNk7nszpzA.png" /></figure><p>→&gt; Run the following command to see that the new container has been created and deployed.</p><p><strong>$docker ps -a</strong></p><p>We will deploy the container with port 8080 open:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*JW-TKEJ8vKKtdbXHCuKEbQ.png" /></figure><p>Now it is time to test the code.</p><p>→&gt;Run the command to check the container can go to the Internet:</p><p><strong>curl localhost:8080</strong></p><p>It executes the index.html as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*SoWhuQel-KfhccJeAnnc-Q.png" /></figure><p>To verify, can be seen as follows that we have modified the NGINX Docker image to our custom made NGINX image.</p><p>Don’t forget the modify the inbound security group of your Cloud9 EC2 and add All Traffic for the HTTP traffic to come in as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fkyq4OqPR6YzZQe2hyTxgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*TqK0XhvCW-mSyxqwDSEkVQ.png" /></figure><blockquote><strong>Create New Image from Container</strong></blockquote><ul><li>Run the following to copy the <strong><em>index.html</em></strong> file to the Container volume</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*8YqYXyC3y7Ld2oiNmoLGqw.png" /></figure><p>Next, commit the changes:</p><p><strong>docker commit &lt;container_name&gt;</strong></p><p><strong>docker commit my-container</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*GuZzSaW3JWrn8CbhKkI7LQ.png" /></figure><p>-&gt;View the new image created as follows:</p><p><strong>docker images</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*-XrGkVN2kHcyIz4PEDv1kQ.png" /></figure><p>-&gt;Now tag the image with a name as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*sy3KJENLOO8WAmifPTmCkQ.png" /></figure><p>We will save our container data to AWS ECR:</p><p>-&gt;Login to <em>AWS management console</em>/<em>Elastic Container Registry</em>/<em>Get Started</em></p><p><em>-&gt;Repository name</em> →give a name →nginxnewver2</p><p>-&gt;Leave default settings</p><p>-&gt;Click on <em>Create Repository</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*vBeFDE1oioJTpHnI0Svc1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57r0uklSGJrIXdHQ2lVNFg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3t-FALdOgUWbG8LUYhykYw.png" /></figure><p>Click on view push commands as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rFsKL4Hb-n2HanvsA_QrQ.png" /></figure><p>Login succeeded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qd-kidqm4cZqhAlB82UJbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0nS4r-JVCj88B7960wgIww.png" /></figure><p>Lets push the newly created image to our AWS ECR repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FtfWPiX8EXEOmEO_umOCOA.png" /></figure><blockquote><strong>Remove the Docker Container and images</strong></blockquote><p>Run the following commands to delete the containers:</p><p><strong>→&gt; To remove containers<br>docker rm -f $(docker ps -a -q)</strong></p><p><strong>→&gt;To remove images<br>docker rmi -f $(docker images -a -q)</strong></p><p>Also we can go to AWS ECR and select our image and delete it as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*j6z6ySoLeqBq-FMxUffZcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*GiZw4GwanRpwwoJMM-T_Rw.png" /></figure><p><strong>Conclusion:</strong></p><p>This is another chapter on the program that will introduces to Docker and how it works with containers and that we can access the Docker Hub to different images and even to make one of our own and save it in our repository on AWS. I was fascinated how Docker can be very fast when running different images and next I can’t wait to taste the waters on Kubernetes, let’s go.</p><p>If you have any suggestions and feedback, please feel free to send them.</p><p>Thank you for stopping by:)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2b508ce0eba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending Messages via AWS SQS triggering Lambda using Python]]></title>
            <link>https://awstip.com/sending-messages-via-aws-sqs-triggering-lambda-using-python-8d22070545fa?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d22070545fa</guid>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[sqs]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Tue, 22 Nov 2022 16:57:02 GMT</pubDate>
            <atom:updated>2022-11-29T15:57:16.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*n9syRsEY1wqdvbuMzzKDmQ.png" /></figure><p>Greetings,</p><p>I came back again to show you another project on my 15th week at LUIT. This time I was tasked to work on a project with AWS SQS using Python and Lambda.</p><p><strong><em>What is SQS?</em></strong></p><p>Amazon Simple Queue Service (Amazon SQS) offers a secure, durable, and available hosted queue that lets you integrate and decouple distributed software systems and components. Amazon SQS offers common constructs such as <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html">dead-letter queues</a> and <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-queue-tags.html">cost allocation tags</a>. It provides a generic web services API that you can access using any programming language that the AWS SDK supports.</p><p>Source: <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html">https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/welcome.html</a></p><p><strong><em>What is Lambda?</em></strong></p><p>Lambda is a compute service that lets you run code without provisioning or managing servers. Lambda runs your code on a high-availability compute infrastructure and performs all of the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, and logging. With Lambda, you can run code for virtually any type of application or backend service. All you need to do is supply your code in one of the <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html">languages that Lambda supports</a>.</p><p>You organize your code into <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-concepts.html#gettingstarted-concepts-function">Lambda functions</a>. Lambda runs your function only when needed and scales automatically, from a few requests per day to thousands per second. You pay only for the compute time that you consume — there is no charge when your code is not running.</p><p>You can invoke your Lambda functions using the Lambda API, or Lambda can run your functions in response to events from other AWS services. For example, you can use Lambda to:</p><ul><li>Build data-processing triggers for AWS services such as Amazon Simple Storage Service (Amazon S3) and Amazon DynamoDB.</li><li>Process streaming data stored in Amazon Kinesis.</li><li>Create your own backend that operates at AWS scale, performance, and security.</li></ul><p>Lambda is a highly available service. For more information, see the <a href="http://aws.amazon.com/lambda/sla/">AWS Lambda Service Level Agreement</a></p><p>Source: <a href="https://docs.aws.amazon.com/lambda/latest/dg/welcome.html">https://docs.aws.amazon.com/lambda/latest/dg/welcome.html</a></p><p><strong><em>Scenario:</em></strong></p><ol><li>Create a Standard SQS Queue using Python.</li><li>Create a Lambda function in the console with a Python 3.7 or higher runtime.</li><li>Modify the Lambda to send a message to the SQS queue. The message should contain either the current time or a random number, can use the built-in test function for testing.</li><li>Create an API gateway HTTP API type trigger.</li><li>Test the trigger to verify the message was sent.</li></ol><p><strong><em>Requirements:</em></strong></p><ol><li>Access to AWS Management Console (preferably free tier).</li><li>Access to an IDE space to execute the code.</li><li>Git Hub account if required for later access.</li></ol><p>For starters login to AWS Management and Launch Cloud9 to go to my IDE and enter the following code and run to create SQS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*PlhwOo86NRAarJYEvagCkQ.png" /></figure><p>To verify login to AWS Management Console and can see the SQS was created successfully as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p22DhTyXzVUD_6NkieffDA.png" /></figure><p>Next, We need to create an IAM role that will allow Lambda function to be triggered when receiving message from SQS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GLMTlEWCuhQ1mN4psbcG1A.png" /></figure><p>Next, created a Lambda function from AWS Management Console as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K6NEZZ1tPD1l3-DgGeyK3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6hB7MePeTmseDsFTI69Plw.png" /></figure><p>As shown below the function is created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DpMfvpNQC9MGThJwtOalKw.png" /></figure><p>When I try to set up Lambda Trigger under SQS notice I got an error :</p><p><strong>Couldn’t configure trigger for queue.</strong></p><p>Error code: InvalidParameterValueException. Error message: The provided execution role does not have permissions to call ReceiveMessage on SQS.</p><p>This is because the Lambda function created doesn’t have permission to receive SQS messages.</p><p>In order to grant permission, we need to create a role:</p><p>We need to create an In-line Policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*MuwIC2w6_Sq47vEeiVn1yg.png" /></figure><p>Create policy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8MjNQifvSXjGUIRJYhIw6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*tNC4eUOFk60k4Lme9wN7-w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpBlrXqHtM_K0Z5vC3dnaQ.png" /></figure><p>Then we will replace the code in Lambda with the policy I just created for SQS as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAMzYbRmG9GrNhsL7zFHPA.png" /></figure><p>Then I modified Lambda code above with the code below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*7EjT2nXVla3_bx9ZTC-Hgw.png" /><figcaption>code we need to replace the original code by AWS</figcaption></figure><p>This will test the code and create a test event name:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_lJaAD_yLh_9-wZKY_NCw.png" /></figure><p>We can see Lambda function is now successfully created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Maw18dzSslW5CL48_rBQuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7A-fW_DSstlT7JOaOJ1LVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cCws7jvpPJC-ucM6XueZJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*29OeHCdRTEK3pOkPAnaasQ.png" /><figcaption>JSON code for the message ID above</figcaption></figure><p>Below shows the time when the message was sent:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Me6BpjF5x1r9A7TssDCSg.png" /></figure><p>Next task, I will create an API Gateway that will trigger Lambda function when a user invokes API-URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6mc8kO5XLkJzISBeHQqLyw.png" /><figcaption>creating API-Gateway</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gtnq-LL20TlaGf9W2D6w6Q.png" /><figcaption>API-URL</figcaption></figure><p>As can be see above created API Gateway endpoint, however got error below because I forgot to give permission to Lambda to work with API Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*baE5aL8G0fxEImgbFcBn6A.png" /><figcaption>error before assigning API Gateway a role</figcaption></figure><p>Again head back to IAM role to assign AmazoneAPIGateWayAdministrator role. All I can say it all services I have worked so far need permission from IAM (What an Important service) 👌</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTrsgYOm9N-xpP5iVV-tyQ.png" /><figcaption>granting Lambda API-Gateway role</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9NlRKNDD7DYK0GAzV0-9Mw.png" /><figcaption>message sent</figcaption></figure><p>Sent a message as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ft69KYM88Sq-wAB0hi7HWg.png" /><figcaption>message sent</figcaption></figure><p>MessageId shown in JSON, which shows the message was sent successfully.</p><pre>{<br>  &quot;MD5OfMessageBody&quot;: &quot;864800be51f96bc1f958cd96dea36b7d&quot;,<br>  &quot;MessageId&quot;: &quot;9e829b2a-8277-4718-9bae-4309a853b2c2&quot;,<br>  &quot;ResponseMetadata&quot;: {<br>    &quot;RequestId&quot;: &quot;83a3c0a2-4e94-5bac-a5e9-9b513d90a890&quot;,<br>    &quot;HTTPStatusCode&quot;: 200,<br>    &quot;HTTPHeaders&quot;: {<br>      &quot;x-amzn-requestid&quot;: &quot;83a3c0a2-4e94-5bac-a5e9-9b513d90a890&quot;,<br>      &quot;date&quot;: &quot;Sun, 20 Nov 2022 00:11:48 GMT&quot;,<br>      &quot;content-type&quot;: &quot;text/xml&quot;,<br>      &quot;content-length&quot;: &quot;378&quot;<br>    },<br>    &quot;RetryAttempts&quot;: 0<br>  }<br>}</pre><p>At last , the message sent can be seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQa3HiZ1vRctID6ZLyHxgw.png" /></figure><p><strong><em>Conclusion:</em></strong></p><p>This was real world project which gave me a good understanding Lambda can be automated to do a lot of tasks using Python, it also thought me not to forget to assign a permission before I even start triggering Lambda. Please provide your feedback and suggestions.</p><p>Thank you,</p><p>Completed!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d22070545fa" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/sending-messages-via-aws-sqs-triggering-lambda-using-python-8d22070545fa">Sending Messages via AWS SQS triggering Lambda using Python</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with Boto3 in AWS IDE(Integrated Development Environment) using Python to create a DynamoDB…]]></title>
            <link>https://awstip.com/working-with-boto3-in-aws-ide-integrated-development-environment-using-python-to-create-a-dynamodb-196f2eed4d6f?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/196f2eed4d6f</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[aws-cloud9]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[boto3-python]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Sun, 13 Nov 2022 23:17:17 GMT</pubDate>
            <atom:updated>2022-11-21T17:24:02.536Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Working with Boto3 in AWS IDE(Integrated Development Environment) using Python to create a DynamoDB table, Insert and Scan items</strong></h3><p>Hello Folks,</p><p>I was tasked to do a Project on my Week-14 using Python in Boto3 which is Amazon’s SDK (Software Development Kit). I have used AWS Cloud9 for coding.</p><p>Boto3 makes it easy to integrate your Python application, library, or script with AWS services including Amazon S3, Amazon EC2, Amazon DynamoDB, and more.</p><p>Boto3 has two distinct levels of APIs. Client (or “low-level”) APIs provide one-to-one mappings to the underlying HTTP API operations. <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html">Resource APIs</a> hide explicit network calls but instead provide resource objects and collections to access attributes and perform actions.</p><p><strong>Resource</strong>:</p><p><a href="https://aws.amazon.com/sdk-for-python/#:~:text=Boto3%20makes%20it%20easy%20to,%2C%20Amazon%20DynamoDB%2C%20and%20more">https://aws.amazon.com/sdk-for-python/#:~:text=Boto3%20makes%20it%20easy%20to,%2C%20Amazon%20DynamoDB%2C%20and%20more</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*xrc2LrjQRM4Rsl0iOfyczQ.png" /></figure><h3><strong>Project Requirements:</strong></h3><p>1, Create a DynamoDB table.</p><p>2, Using Boto3 and Python Insert 10 items to the table.</p><p>3, Using Boto3 and Python Scan the table.</p><p>In order to make your coding experience better, I have attached the complete documentation of boto3 below:</p><p><a href="https://boto3.amazonaws.com/v1/documentation/api/latest/index.html">https://boto3.amazonaws.com/v1/documentation/api/latest/index.html</a></p><h3><strong>Pre-requisites:</strong></h3><p>1, Assuming you have an account and access to AWS Management Console.</p><p>2, We need Boto3 SDK (Software Development Kit) installed in our coding environment first.</p><p>3, Also a Git Hub account is required in order to push all our coding for later accessibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ViLDQipREHb0UtE1aOFQjw.png" /><figcaption>Installing pip command for boto3</figcaption></figure><p>It is possible to use the command : <strong>pip install boto3</strong> or <strong>pip3 install boto3</strong>.</p><p>Notice it says requirement already satisfied which confirms pip has been installed successfully.</p><p>For this project and going forward We can use any IDE (Integrated Development Environment) including Visual Studio Code, PyCharm or Cloud9. I am using AWS Cloud9 for my project.</p><p>The following screen shot shows the code to create a DynamoDB Table. The first line “import boto3” is a must when we code using boto3 as that will bring all the libraries it needs to execute the code. For the remaining line of codes, I have inline commented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*Ij2xMprTaQ5GzNZDG0_-Yg.png" /><figcaption>Creating DynamoDB table using Python in AWS SDK boto3</figcaption></figure><p>To verify I went ahead and checked it in AWS Management Console as follows and it feels great whendone with the first step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*HGlDw3IYftGGQWuJX06wbA.gif" /><figcaption>time to celebrate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h7irAG8pBr_ThF_Paw2aCQ.png" /></figure><p>Next, I inserted 10 Items to the table as follows. If we have to insert more than 1 item we can use a function called <strong>batch_writer()</strong> which will take all the items at once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*NzUOmHHu08g-Eu1u_gAQag.png" /><figcaption>Inserting items to a DynamoDB table</figcaption></figure><p>To verify I checked it in my AWS Management Console as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SZBlrh0h-fHVZCrGOzVw9Q.png" /><figcaption>some of the great movies listed above</figcaption></figure><p>Last but not least, I was able to scan a my table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*MFRDC-G40hBmoCVYT3sIGg.png" /><figcaption>scanning the table</figcaption></figure><p>The output of the scan above is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*3GE4sp_sUk6q_ElhNMAfuw.png" /><figcaption>this is the outcome from scanning the table</figcaption></figure><h3>Here is the <strong>Advanced</strong> section of my project:</h3><ol><li>Using boto3 and Python to query a table, remove an item from a table, create a table, and delete a table.</li></ol><p>Let’s delete Goodfellas from the item list as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*JJp1Rc_tzlv54VShA8RUyQ.png" /><figcaption>deleted one of the movies GoodFellas</figcaption></figure><p>To verify go to AWS Management Console and refresh the item list and can be shown Goodfellas is deleted from the list and has only 9 items in the list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfVBS3gdka7rpcdD2Nt6rg.png" /><figcaption>This is to verify 1 item was deleted form the list</figcaption></figure><p>I have come to the last part of my project where we destroy the table from DynamoDB which means wouldn’t have access to all my work I just did above 😒 but let’s do it since it is part of the project as this can be done again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*kilZs3KiQ-f2RZIg9qWxWw.png" /><figcaption>table deleted</figcaption></figure><h3><strong>Let’s pull the trigger and attempt my Complex section of my project</strong>:</h3><p>This task was to :</p><ol><li>Create a Lambda function using boto3 and Python to query a table, return an item from a table and delete an item from a table.</li><li>Run a test of the Lambda function to verify you were able to do all of the previous actions.</li></ol><p>First create a role for Lambda to get access to DynamoDB service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ykuFVj0ErmqbQ-_4NmXqnQ.png" /><figcaption>create a role for Lambda to get access to DynamoDB</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJaE0tqZQKtXPZT1P88L3A.png" /></figure><p>Choose Full Access to DynamoDB as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-kQRrfWfgaBDWHoRM_Y3Gg.png" /></figure><p>Give a name to the role:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m50gPdXGEg5rw2qeMlvzlA.png" /><figcaption>giving a name to the role</figcaption></figure><p>Next, create the role:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usuMe0kHPRT6e1MAjc51rA.png" /></figure><p>After that create a Lambda function which will be accessing my DynamoDB table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zF3z98nfttKpUaIUPk-bEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7D9U0IFdks8pjTtLahC1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0n_XKECYXbC7KH8hnchQHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ZTsMYMswbVqglYOWkapEA.png" /><figcaption>Lambda function created</figcaption></figure><p>Create file name to the test event:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*l0qroCHXWh5WSxZVVy-jDw.png" /><figcaption>create test event</figcaption></figure><p>Next, modify the test code to the one below and will get the result of scanning the table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*RsuMfeRpc6kujmkvjio-uw.png" /></figure><p>Notice you should see “Succeeded” status at the top right :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AayBdbPebGWm6MrXDNZhsw.png" /><figcaption>deploying and testing the code</figcaption></figure><p>Also it can be seen on CloudWatch service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xwlea2Ks3lmyJRyA_Q2ZNQ.png" /><figcaption>log events in CloudWatch</figcaption></figure><p>Then will delete 1 item from the list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*Tiz-Uz1Tje52e-LZfDEZFA.png" /><figcaption>delete an item from the table</figcaption></figure><h3>Conclusion:</h3><p>This was the most immersive project so far to DynamoDB and Lambda using boto3 SDK (Software Development Kit) with Python and I enjoyed working on it.</p><p>If you have any suggestions or feedback, please feel free to send them.</p><p>Thank you for going through with my project.</p><p><em>Finished</em>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=196f2eed4d6f" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/working-with-boto3-in-aws-ide-integrated-development-environment-using-python-to-create-a-dynamodb-196f2eed4d6f">Working with Boto3 in AWS IDE(Integrated Development Environment) using Python to create a DynamoDB…</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Three-Three-Architecture]]></title>
            <link>https://awstip.com/aws-three-tier-architecture-1b6c8cb3869b?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b6c8cb3869b</guid>
            <category><![CDATA[aws-database]]></category>
            <category><![CDATA[3-tier-architecture]]></category>
            <category><![CDATA[aws-nat-gateway]]></category>
            <category><![CDATA[aws-elastic-ip]]></category>
            <category><![CDATA[amazon-rds]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Sun, 09 Oct 2022 07:09:37 GMT</pubDate>
            <atom:updated>2023-01-16T18:31:28.547Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*chCt3qpRkHRof6HNBwDvUg.jpeg" /></figure><p>Another Project to show case on AWS Three Tier Architecture, this Project is interesting as it is commonly used in different industries when it comes to computing. It is gives a better understanding when reflecting it using a diagram and in AWS.</p><p>In today’s computing era in order to be a high performer business a company should have a very fast and agile web site in order to compete in the Market and to achieve that it would be very important most of the company’s transaction to migrate to Cloud.</p><p>The reason of this Project is to present how a user browser visits any web site and how the request travels and retrieves the information the user is looking for.</p><p><strong>Pre-requisites:</strong></p><ul><li>We need to have an access to AWS Management console with the right permission</li><li>We need to have access to AWS CLI</li></ul><p>To start: We I have created a new VPC CIDR : 10.0.0.0/16</p><p>After logging to AWS Management console create your VPC as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*e-lySijNspoH6UpyIJ65-Q.png" /></figure><p>Then I created 2 Public Subnets as follows for Web Tier:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*ns7j7NB_ONaJtk9Z5KVjgw.png" /></figure><p>Next, I created a Public Route and will associate it with the Public Subnets created above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*vvyigz2eSo-_oswsMax_1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NMui4wkdFjEJDtpV5K327w.png" /></figure><p>This will be followed by creating an Internet Gateway and will attach it to my VPC. Also I will add a route to the Internet 0.0.0.0/0 and attach it to our Internet Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*2hnwsb053MhjDYFxC6sIGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*06zhmC75Z4CE981T_p0v0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q3WWG6_d-NncAXeKOS-b6Q.png" /></figure><p>Then I created an Auto-Scaling Group to launch at least 2 EC2 instances to display Apache Web Server.</p><p>But first I will have to create a launch template:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*X3C986JN7s_yPuXiFsQNbA.png" /></figure><p>I can choose any OS from the selection below, in this case it will be Amazon Linux AMI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*MDezbmp36NplhYP0X6JMcQ.png" /></figure><p>Then I selected Instance type t2.micro and Key Pair:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*E_yu2NkEl28-Mg9NLBDPfg.png" /></figure><p>In the Network Settings I have selected my existing Security Group and I have enabled the Auto-Assign-Public IP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*KzT7sV3bahhd5keY2x4P1Q.png" /></figure><p>To the bottom of the page, I have entered the user data which will launch an Apache EC2 Web-Server and this will create a launch template:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sui6SnyPWluGSiKl8M_Obw.png" /></figure><p>This will be followed by creating an Auto-Scaling Group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YjMmJMTVHgQpyeo8_-QoGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OvD9jWGMk98eCNxEotVHBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nsl6m-EQL7Cg1SCE-ZN-eQ.png" /></figure><p>Then I have created an Application Load Balancer, the same steps taken above will create a Target Group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6mQGzJ6S7izOYFAFhEPng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFkB6qrBd57Y-fNmnrdFcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EzAGtTExOAAxxKCSNnpGWQ.png" /></figure><p>Next, I have set up how many EC2 instances is needed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S8ExMBfhPxJoSCJYC-oqXA.png" /></figure><p>This will create Auto Scaling Group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W4F9q799Lpv7awwx_4BnCQ.png" /></figure><p>It is updating its capacity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FxPm4LPXX8ER0ZoBGERp7g.png" /></figure><p>Finally was able to launch an Apache Web Server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3cWSyh6RxCtmK02C6Ewxrg.png" /></figure><p>The second part of this Project will be to create 2 Private Subnets in the App-Tier. This will be followed by creating a Private Route Table, Nat Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CDNQ3IwJLWYpOPJM07uw_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*12HN3H_PIrJ-7Y6JyBygYg.png" /></figure><p>After that I associate the Private Route Table to both Private Subnets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K0kPNXX8vpDyfyt7_4IJbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*71lhq6lX4RayI5K172tywA.png" /></figure><p>I have allocated an Elastic IP address for my Nat Gateway. It is suggested to release it after completing the project as it has charges if it is kept for long.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*duGNeydl9MRb16Nz_NPQyg.png" /></figure><p>Then I attached the Nat Gateway to the Private Route Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LSXfOtScIi9vfWYSJVebGQ.png" /></figure><p>After this , I created launch template for the App-Tier, the only changes to that will be setting up Security Group where need to allow ICMP traffic to ping the Private IP of the instance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*c_azzCJkTgORJPonfXsFHw.png" /></figure><p>After having the launch template ready, then I created an Auto Scaling Group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q2YPWL0j0dm1Dsh3eVKCWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uoYbOD7OJjCBhxFEtWxzDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hy5bEz0_I6QhBA9vZH0IAg.png" /></figure><p>I was able to SSH to my App tier instance as follows :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*Sec4oc1rZVgX3uHr7nIWSQ.png" /></figure><p>So in my case I used the one of the instances in the Public Subnets as a Bastion host in order to access my instance in my Private Subnet and then was able to ping it via ICMP traffic as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*7Eri90YSHzxdNz4cjo5_eA.png" /></figure><p>The next part will be the last part of the project which reflects the Database tier:</p><p>First, I created 2 Private Subnets and will associate both with the Private Route Table and Nat Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3mstSttYcQUQEFqoELqPAA.png" /></figure><p>Next, I have created Database using MySQL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*vtNwvowjkls3sLYprbS2aw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*cKbo2f6lLtbVk0AeWg-nJw.png" /></figure><p>I have created credentials with username and password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*yyPmWaoeoXrdXlsXeUFCzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*x3dlUayQRe_fuYYP0tT_Rg.png" /></figure><p>Then entered my Security Group name:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*T5J49qAx4n3kGCSyT2rlvQ.png" /></figure><p>Set up Security Group port 3306 will be open to connect to from App tier to Database tier:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*f3XKbnjzlAuwVIQKPnhDgg.png" /></figure><p>I have disabled back-up and encryption for this project purposes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*CKE3x4Eh5kkHUREpQzywiw.png" /></figure><p>Then the database will be created as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*7Xv97PywE3iYTfscY-MVOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OOAgubyLpQC13HJCVw_n0A.png" /></figure><p>I went ahead to CLI to access my Database:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YswQjMK9_XHPSeLje3GPWg.png" /></figure><p>This will bring me to the end of my Project. These steps were followed based on my Project tasked, however it is possible to download MySQL on Windows/MacOs/Linux and get access to MySQL from CLI.</p><p>Thank you for your time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b6c8cb3869b" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/aws-three-tier-architecture-1b6c8cb3869b">AWS Three-Three-Architecture</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating DynamoDB Table, Adding Items, Launching Amazon EC2 with Read only permission]]></title>
            <link>https://medium.com/@teme_24/creating-dynamodb-table-adding-items-launching-amazon-ec2-with-read-only-permission-7a0b7323c6b4?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a0b7323c6b4</guid>
            <category><![CDATA[aws-dynamodb]]></category>
            <category><![CDATA[dynamodb-stream]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[dynamodb-local]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Sun, 02 Oct 2022 02:00:36 GMT</pubDate>
            <atom:updated>2022-10-02T02:00:36.374Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*gxCohikMFsOe9ILheo1n2g.png" /></figure><p>Hello Friends, I just finished Week 8 at LUIT and here is what I was assigned to work on my project. This Project talks about how to create a DynamoDB table, add items to the table and have an Amazon EC2 scan it by assigning a Read only permission.</p><p><strong><em>Objectives:</em></strong></p><p>1, To create a DynamoDB Table and add items to it.</p><p>2, Launch an Amazon EC2 and give a Read only permission.</p><p>3, Demonstrate to perform a Write request and it should respond with an error that Writing isn’t allowed to the EC2 as its current permission is set to Read.</p><p><strong><em>What is DynamoDB?</em></strong></p><p>Amazon DynamoDB is a fully managed proprietary NoSQL database service that supports key–value and document data structures and is offered by Amazon as part of the Amazon Web Services portfolio.</p><p><strong><em>Pre-requisites</em></strong><em>:</em></p><p>1, Access to AWS Console Management to create DynamoDB Table.</p><p>2, Access to AWS CLI from the EC2 we created.</p><p><strong><em>Step taken:</em></strong></p><p>This will be the first step to create our DynamoDB Table and will add items to it:</p><p>Search for DynamoDB at the search bar as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JGsYxzvbDR4pbnPieruEVA.png" /></figure><p>Once we get DynamoDB click on it and will take us to next screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9K5J2ctWeUnfLw76iM597A.png" /></figure><p>Click on Create table and then will take us to next screen to create the table, We need to enter Table name and Partition Key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*woroNakVS9hpOrOTLtoeyg.png" /></figure><p>Then We will select to customize our settings and select DynamoDB Standard as our table class:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t8sEm1LHhuklDLBXZamcRQ.png" /></figure><p>Then click on Create and that will create our table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*avTI5fI9dfpGy4JrEUFElQ.png" /></figure><p>As We can see below the table is being created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_EfmUAlVcDAYQ50xXfKHnA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Uga4yG45lKpFmenYIJrLg.png" /></figure><p>Next, We will insert some items to our table by clicking on explore items on the left:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmrxhX6DhKvF8AFGLde1ig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LaLmCziTYo8cGOuvReFDtQ.png" /></figure><p>We will create the items one by one as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GxooZZcBV40iPQO_G8d6sw.png" /></figure><p>Next We will create Amazon EC2 which has a permission to access our table as Read only:</p><p>After that we will launch our EC2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*9xnoKoDtQMxzX6Q7lHDPhA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*0VUNesItd2tCDoSSAcwJAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*R8LGAAhW4e3Eis-mA9E6LQ.png" /></figure><p>Above We will have to select our instance type as t2.micro, also need to select our Key Pair.</p><p>We will create our Security Group by giving access to SSH from my IP and from any where from HTTP, on this project We actually don’t use the HTTP protocol to access from the web:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*zdIP35q5xGwmkX5mWcDTrA.png" /></figure><p>Then will launch our EC2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8zb1ZOBo1r2k8nfLvKUfWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iN_Hje7Q6XdO4ukjdbZBZg.png" /></figure><p>Next, We will create an IAM Role that only gives permission to read a DynamoDB table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WXQv1wkqeQ6g13MGDXgyGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QoY2QG-2_t57P5h5d6_PGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owJWIgiBbWeL8l-Ft_bl1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_KHMs4P9ebVXrF3Epr1Nmw.png" /></figure><p>Right click on the EC2 and select Modify IAM Role:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*gpPziGwFP3eRy-Vt3nORZA.png" /></figure><p>Then select the Role just created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrOeu4hEuJqnrZzPuH-zdQ.png" /></figure><p>Next we will access our EC2 via SSH:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*SLwHdQliB8Z1Fuu-mrICdg.png" /></figure><p>As seen below it is possible to scan (read) our DynamoDB table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*4sKYZvWK2dScjcbPmFOfMw.png" /></figure><p>To verify that Writing wouldn’t be allowed as follows and that will confirm our permission worked as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*A8qAgMAneBCrduqOuKcZhg.png" /></figure><p>Thank you for going through with me on this project.</p><p>I have attached links from Amazon web site for further information:</p><p><a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SampleData.CreateTables.html">https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SampleData.CreateTables.html</a></p><p><a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html">https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a0b7323c6b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Launch EC2 using Auto Scaling Group]]></title>
            <link>https://medium.com/@teme_24/how-to-launch-ec2-using-auto-scaling-group-1244471bf72d?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/1244471bf72d</guid>
            <category><![CDATA[target-group]]></category>
            <category><![CDATA[auto-scaling-groups]]></category>
            <category><![CDATA[application-load-balancer]]></category>
            <category><![CDATA[apache-server]]></category>
            <category><![CDATA[cpu-utilization]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Sun, 25 Sep 2022 14:02:21 GMT</pubDate>
            <atom:updated>2022-09-26T02:19:49.706Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, this week I will be demonstrating how to launch an Amazon EC2 using an Auto Scaling Group as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*iQkme2UY7NBjzDSiFK0TaA.png" /></figure><h3>Pre-requisites</h3><p>We need to have access to an AWS console management:</p><p>First we will create our VPC as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kM1oUw9MJM2ujCL0k0hQ3w.png" /></figure><p>Then will continue to create a Launch Template as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rcP665qPR6RRAzg0x4O-3w.png" /></figure><p>We will select t2.micro as instance type and select our Key Pair:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*ogzFfGAFgJ5PLsciReOzPQ.png" /></figure><p>We will set the Auto Scaling instance on Public Subnet 2 and select our Security Group as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*RYnI8E6rY9HqkTMccfPOBA.png" /></figure><p>Next, we will go to Advanced Details at the bottom of the page and include our user data as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*UCR4IDXQT8FbjT1nqctb0w.png" /></figure><p>Then we will create the Launch Template.</p><p>We will continue to create our Auto Scaling Group as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BteSDPtJHRpFmv63cb64LA.png" /></figure><p>We will name it and we will select our Launch Template as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zGn48C4vu2TxRzB-ZiVUeg.png" /></figure><p>On next page, we will select our VPC and Subnets as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4H6n23AveU-dsSv5UF9QZA.png" /></figure><p>Then we will continue to next page and we have an option to create a Load Balance now or we will skip it and create it later. In my case I skipped it now and I will create it later:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7x6br-bN7iDpnetPSRxv1g.png" /></figure><p>Then on next page we will set number or EC2 we would like to be launched minimum, desired and maximum as per our requirement:</p><p>In my case I have selected 2 minimum, 2 desired and 5 maximum EC2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0tRSAUtBUcq9L3ysN9uVw.png" /></figure><p>Then we continue next until the last page and we launch our Auto Scaling Group as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDOs9XC8jSiopWhd4z6eCA.png" /></figure><p>We can see our Auto Scaling Group being created for us, and we go to our EC2 being created as effect of this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yE4XQuEvXruKIKoI4zSiJg.png" /></figure><p>Our EC2 is now on initializing state, however that will change to ready state as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jGOrJTLUUaaWOVDELPIwuQ.png" /></figure><p>Then we will continue to create our Target Group as follows:</p><p>We need to set it as instance type:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nEIArGIrUav3XdewodwcEA.png" /></figure><p>We need to give it a name and set its protocol HTTP on port 80 and select our VPC:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5VzvcMHZVfOPjKv61RbTw.png" /></figure><p>We have an option to register our EC2 to our Target Group as follows, however I have skipped it at this time and I will connect them later and I will create my Target Group now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hfF3JSCYl5hbXXCzQcnhPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqx_kbogAPqajZaGutWrTQ.png" /></figure><p>As we can see our Target Group isn’t associated with an EC2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nvgeSO3kf91EvphFMc4O5A.png" /></figure><p>Next, we will create our Application Load Balancer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*ojdRrjhPVia89pHGKTFT0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*R6-V-7dPwhkzbuXAl7pTZw.png" /></figure><p>We will give it a name, facing to the internet and IPV4 and we will select our VPC:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_S3MlLWbmiDPFNqA4VMAA.png" /></figure><p>And we will select our Subnets as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HWk2FLF1cn2rOfqUTmrw4w.png" /></figure><p>Next, we will select our Security Group set our Listener to HTTP protocol on port 80 and forward it to our Target Group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dZAVd26hEtsHhVrnabUa2A.png" /></figure><p>Next, we will create our Load Balancer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V8Oz1l2_QyW_H83MuwZtKQ.png" /></figure><p>We will wait for our Load Balancer to be provisioned as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ypIArZnMgFjkHpFoi8Bhhw.png" /></figure><p>Then we will connect our Load Balancer to our Auto Scaling Group as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEos_Mms4S-Z6VxO9bPZww.png" /></figure><p>Next, we will go to our Target Groups and check our instances which will be on initial health state as the target registration is in progress:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pjsUnZXoxguQVPZsYeXQMw.png" /></figure><p>Then the moment of Truth comes when we test our Public IP and we get our desired result as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2yI_w9QSci-HY1zJZD3KcQ.png" /></figure><p>Thank you for visiting my site.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1244471bf72d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Launch Amazon EC2 instance with Nginx Web-Server using AWS CLI]]></title>
            <link>https://medium.com/@teme_24/how-to-launch-amazon-ec2-instance-with-nginx-web-server-using-aws-cli-4d5d406d1d1c?source=rss-c02b16606feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d5d406d1d1c</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[aws-ec2-instance]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[aws-cli]]></category>
            <dc:creator><![CDATA[Temesgen Meri]]></dc:creator>
            <pubDate>Mon, 19 Sep 2022 01:18:57 GMT</pubDate>
            <atom:updated>2022-09-19T01:18:57.269Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*UkxkeGdkotex8P7jtt6-kQ.png" /></figure><p>Hello Friends, this is a continuity to my Project few days ago, however this time I will be illustrating it using AWS CLI.</p><p><strong>Objectives:</strong></p><p>I was assigned to launch Amazon EC2 instance with Nginx Web-Server using AWS CLI.</p><p><strong>Pre-requisites</strong></p><ol><li>AWS CLI</li><li>Amazon AWS console</li><li>Access to Linux based Operating System</li></ol><p>First, I logged in to my Linux Virtual Box using AWS configure:</p><p>I will need to provide Access Key and Secret Access Key created from a specific user on AWS console from Security Credentials as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/1*4y3pDwQ7kZ-_ZyAVncUlxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*fcQgbp-BonfK3lx7AgN1bA.png" /></figure><p>This will create a folder in your local hard drive two files config and credential files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*HBhdpFNW2VVM5JD8MGQG_Q.png" /></figure><p>Then enter your Access Key and Secret Access Key, Default region name and Default out as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*ZPj7JxWuHgmE6FHvx4xHew.png" /></figure><p>First check if there is an existing Key-Pair created using command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*iP6ti88uK4nlYrNoJyEt_A.png" /></figure><p>I created new Key Pair using the command below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5belhrJQe2xaJ4mamcCNVA.png" /></figure><p>This can be verified by going to AWS console under EC2-Key Pairs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vvb-pIAQCmIQZwJjc1toWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*VzYcNi818cuEO0I045-jeA.png" /></figure><p>As we can see below the new Key Pair was created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*A1qAWBzuXIWPU2AoB1HsAA.png" /></figure><p>Then next will be to create a Security Group:</p><p>We can also check if we have an existing Security Group previously created as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*cs1KvpqNzT_3QNyhJgBzfg.png" /></figure><p>However I decided to create a new Security Group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYk_QhVB9O9EUEOPp08WXg.png" /></figure><p>To verify we can go to AWS console as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ERifCVlRvMkx-XjZ2cyV_w.png" /></figure><p>Next edit the Inbound Rules to allow SSH and HTTP traffic by adding SSH and HTTP protocols for the Security Group I just created as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f4RrhtGL2mbC8p7k5BMPLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XxydDi5nqKW4z_jDD2npow.png" /></figure><p>We will need to find our Public Address to use it in the following command as our CIDR shown below:</p><p>We can browse <a href="https://checkip.amazonaws.com/">https://checkip.amazonaws.com/</a> to find our Public IP address:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kh5lSaUnMtHkqcAas6i4mQ.png" /></figure><p>To verify head to AWS console as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbxUiLSyw9DcQSvckpyREw.png" /></figure><p>This will be the time to launch EC2 instance and we need the following:</p><p>AWS Image ID, Instance Type, Key Pair name, Security Group and Subnet ID:</p><p>We can locate AWS Image ID as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*2rh2BVnuPEsK6tKr_RGqCQ.png" /></figure><p>To locate Security Group we can head to EC2 under Security Group in AWS Console or we can use the command below on AWS CLI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*cs1KvpqNzT_3QNyhJgBzfg.png" /></figure><p>To locate Subnet we can head to AWS console under VPC then Subnet section or using the following command on AWS CLI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*vlGckYCq7gL6UmQtNSU6vg.png" /></figure><p>To locate VPC ID we can head to AWS console in VPC section under details or by using the following command on AWS CLI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*O6Y8L0ADUASNxhv-VyhBzA.png" /></figure><p>To locate Key Pair we can head to AWs console under EC2 then Key Pairs or by using the following command on AWS CLI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*nTtW1YIABxfeZnzIB0ckzA.png" /></figure><p>After we collect all the information we need to launch EC2 instance we can use the following command on the CLI to create it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXeQKXgsFXFA3i06QcESNA.png" /></figure><p>To verify head to AWS console and as we can see it will be on n Initialize state as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*osq_PAniIGkmJvR5dPxEVQ.png" /></figure><p>Then will SSH to the instance as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*SHwH096MgX2r4ZZfem0MPw.png" /></figure><p>As we can see below we are inside the instance as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*csGBB5qysgIbjkING3mazg.png" /></figure><p>To install Nginx first will check if we have Nginx in the server by the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*oLRweEaduZE8-fUrGrKk8A.png" /></figure><p>As we can see above there was no Nginx Server installed, then used the following commands to update the server and install Nginx as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*eT6dNy-UR6TCfDbYcmPU9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*AwW8MUjQR6eid-jkoqEgtA.png" /></figure><p>As we can see below Nginx was installed successfully:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*LWoCBQXnmLhODWmT2R2G3A.png" /></figure><p>To start the Nginx server enter the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*s4UgxxbB76vXxCLUdTZmHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*iKBD49NAJUCBtzsbRDQyEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKv6f7K9K1OpirDvbrFvDA.png" /></figure><p>This was the final step of my Project and was able to get the site of Nginx which shows the Server was successfully installed.</p><p>Thank you for taking your time to visit my site.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d5d406d1d1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>