<?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 Anthony Giles on Medium]]></title>
        <description><![CDATA[Stories by Anthony Giles on Medium]]></description>
        <link>https://medium.com/@anthonylgiles?source=rss-5e7c796e80d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bFfhz9TB0rxe2TsEFy2cyA.jpeg</url>
            <title>Stories by Anthony Giles on Medium</title>
            <link>https://medium.com/@anthonylgiles?source=rss-5e7c796e80d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:58:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anthonylgiles/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[How to Create Custom Nginx Docker Image]]></title>
            <link>https://aws.plainenglish.io/how-to-create-custom-nginx-docker-image-cd02242a2478?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd02242a2478</guid>
            <category><![CDATA[dockerhub]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-ecr]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Mon, 30 Jan 2023 13:16:32 GMT</pubDate>
            <atom:updated>2024-08-02T06:20:47.438Z</atom:updated>
            <content:encoded><![CDATA[<h4>Creating Nginx Docker image with a custom index.html page</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y1Tka4FSJebNVzEWB1etiw.jpeg" /></figure><h4>What is Docker?</h4><p>Docker is a platform for developing applications that use containers, which are small and lightweight execution environments that share the kernel but otherwise run independently of one another. Docker is an open-source project launched in 2013 that helped popularize containers by making it easier than ever for developers to package their software so that it can be run anywhere, regardless of the underlying operating system.</p><h4>Objectives:</h4><ul><li>Create your own image using Nginx. Include a customized index.html file that can be viewed from a local browser.</li><li>Deploy your container with port 8080 open</li><li>Save your container data to the AWS Elastic Container Registry (ECR), and your Docker Hub account.</li></ul><h4>Prerequisites:</h4><ul><li>Docker Installed</li><li>Docker Hub account</li><li>AWS free tier and AWS CLI configured</li><li>An AWS ECR created</li></ul><blockquote><em>💡 </em>Speed up your blog creation with <a href="https://differ.blog/differ-ai"><strong><em>DifferAI</em></strong></a>.</blockquote><blockquote>Available for <strong><em>free</em> </strong>exclusively on the <strong><em>free and open blogging platform, </em></strong><a href="https://differ.blog/"><strong><em>Differ</em></strong></a><strong>.</strong></blockquote><p><a href="https://differ.blog/differ-ai">Introducing DifferAI</a></p><h4>Step 1: Create Dockerfile and Custom HTML Page</h4><p>First, create a new directory containing our Dockerfile and custom index.html page.</p><pre>mkdir &lt;directory name&gt;</pre><p>Make this your current working directory. Now, create your custom index.html page.</p><pre><br>&lt;!doctype html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;LUIT Week 16 Project!&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;h1&gt;This is our Custom Home Page&lt;/h1&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Next, create a new file called <strong><em>Dockerfile</em></strong>. A Dockerfile contains the commands or instructions used during the build to create the Docker image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wolEk6nppz5rwkXxld7f3Q.png" /></figure><pre> FROM nginx:1.10.1-alpine<br> COPY index.html /usr/share/nginx/html<br> EXPOSE 8080<br> CMD [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]</pre><p>The <strong>COPY</strong> command copies our custom index.html page into the Nginx image. Per our objective, we will need to expose port 8080. The <strong>EXPOSE</strong> command is optional and is used for documentation as you can expose any port when you go to create the container.</p><h4>Step 2: Build the Image</h4><p>Now that we have our Dockerfile and source files, we can build the image. We use the docker build command and specify a tag and the location of the Dockerfile, and a context. The context is the set of files to which the build process can reference. In our case, we are using the COPY command to access our custom index.html file.</p><pre>docker build -t &lt;new_image_name&gt; &lt;url or path of context&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*b9TR2GjUBef3AQSlPLtonA.png" /><figcaption>Showing build command</figcaption></figure><p>Let’s confirm our image has been created. You can run the following command to list out the images.</p><pre>docker images</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAPqi5srsgLKIhD0IPPE1w.png" /><figcaption>Showing our created image</figcaption></figure><h4>Step 3: Create and Deploy the Container</h4><p>To create the container, run the following command. You may use any name you would like to call the container but you need to use the name or image ID of the image we just created. The “-p” switch will map port 8080 of the host to port 80 of the container.</p><pre>docker run -d --name &lt;name-container&gt; -p 8080:80 &lt;image_name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wb06HRptauFbtOYi1roGBg.png" /><figcaption>Showing docker run command</figcaption></figure><p>Let’s confirm that it is running by entering the following command:</p><pre>docker ps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oc1x5Cu7lq1WiOgj-ILR5A.png" /><figcaption>Showing container running</figcaption></figure><p>Verify you can reach the landing page by inputting the IP address and specifying port 8080 in a web browser. Since I’m building this lab on my local machine I’ll use localhost:8080.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QFJlO2DzvCKvJwZVWL3RSA.png" /><figcaption>Show our custom index page</figcaption></figure><h4>Step 4: Push the Image to Docker Hub</h4><p>Log into your Docker Hub account from the command line by using the following command:</p><pre>docker login</pre><p>We want to rename or tag our image with our Docker Hub username and repo so that Docker Hub knows where we want the image pushed to. We will use the docker tag command to achieve this.</p><pre>docker tag &lt;image name&gt;:&lt;tag&gt; &lt;dockerhub username&gt;/&lt;image name&gt;:&lt;tag&gt;</pre><p>Now we can push the image by running the following command:</p><pre>docker push &lt;image name:tag&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nsbIN4hbDSuvSSgfemdXQQ.png" /></figure><p>Now we can see our image has been pushed to Docker Hub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gru1JmF_gxX_i95BlOZ2xg.png" /></figure><h4>Step 5: Push the Image to AWS ECR</h4><p>Within the AWS console, navigate to your repository and click on “<strong><em>View push commands</em></strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f7jqyFzd5ViZ2Sc0t47eag.png" /></figure><p>This will provide the necessary commands needed to run. Note we can skip step two as we have already created the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*hTwzLeTIjaG6ITSmACU3LA.png" /></figure><p>First, we need to authenticate the Docker client to the registry as specified in step 1. To get the token, I will run the following command. Your URI will be specific to your repo.</p><pre>aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 233489832487.dkr.ecr.us-east-1.amazonaws.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GIkihFaqHCZNI3ZnDi_B4g.png" /><figcaption>Showing login succeeded</figcaption></figure><p>We need to tag the image to prepare it to be pushed to ECR. Same as we did before with Docker Hub.</p><pre>docker image tag &lt;IMAGE_NAME&gt;:&lt;IMAGE_TAG&gt;  &lt;REPOSITORY_URI&gt;:&lt;IMAGE_TAG&gt;a</pre><p>Now run the push command.</p><pre>docker image push &lt;IMAGE_NAME[:TAG]&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nq6VhyJKbg3ZuXH93tFqUQ.png" /></figure><p>Let’s check the console to see if our image is listed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*siSHURsYh36-XN6WRtU5_Q.png" /></figure><p>It looks like we were successful!</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd02242a2478" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/how-to-create-custom-nginx-docker-image-cd02242a2478">How to Create Custom Nginx Docker Image</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boto3 and DynamoDB Basics]]></title>
            <link>https://aws.plainenglish.io/boto3-and-dynamodb-basic-f4503a68e99d?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4503a68e99d</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[boto3]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Fri, 20 Jan 2023 04:03:55 GMT</pubDate>
            <atom:updated>2023-01-20T05:07:59.729Z</atom:updated>
            <content:encoded><![CDATA[<p>How to add items and scan DynamoDB with boto3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*f77R0jEO0p9szKNtz5O73A.png" /></figure><h3>Objective:</h3><ul><li>Create a DynamoDB table</li><li>Using the Gist (<a href="https://gist.github.com/zaireali649/0ec6b90155120cf508223788b7b86efc">https://gist.github.com/zaireali649/0ec6b90155120cf508223788b7b86efc</a>) as a starting point, use boto3 and Python to add 10 or more items to the table.</li><li>Use boto3 and Python to scan the DynamoDB table</li></ul><h3>Requirements</h3><ul><li>AWS free tier</li><li>Python and boto3</li><li>IDE of your choice</li></ul><h4>Step 1: Create DynamoDB table</h4><p>We will create a DynamoDB table of your choosing with a partition key and sort key. I will make a table for the best-selling pinball machines. We will not include the access keys directly into the script for this part. You will need to configure AWS CLI appropriately. Once configured, the following code will create a table named <strong><em>Pinball_Machines</em></strong> with a partition key of <strong><em>title</em></strong> and a sort key of <strong><em>units</em></strong>.</p><pre>import boto3<br><br>dynamodb = boto3.resource(&#39;dynamodb&#39;, region_name=&#39;us-east-1&#39;)<br><br>table = dynamodb.create_table(<br>    TableName=&#39;Pinball_Machines&#39;,<br>    KeySchema=[<br>        {<br>            &#39;AttributeName&#39;: &#39;title&#39;,<br>            &#39;KeyType&#39;: &#39;HASH&#39;  #Partition key<br>        },<br>        {<br>            &#39;AttributeName&#39;: &#39;units&#39;,<br>            &#39;KeyType&#39;: &#39;RANGE&#39;  #Sort key<br>        }<br>    ],<br>    AttributeDefinitions=[<br>        {<br>            &#39;AttributeName&#39;: &#39;title&#39;,<br>            &#39;AttributeType&#39;: &#39;S&#39;<br>        },<br>        {<br>            &#39;AttributeName&#39;: &#39;units&#39;,<br>            &#39;AttributeType&#39;: &#39;N&#39;<br>        },<br><br>    ],<br>    ProvisionedThroughput={<br>        &#39;ReadCapacityUnits&#39;: 10,<br>        &#39;WriteCapacityUnits&#39;: 10<br>    }<br>)<br><br>print(&quot;Table status:&quot;, table.table_status)</pre><p>After execution, we can see in the AWS console that we have created the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WoJp3cZJ63L94wS7IJFs1g.png" /></figure><h4>Step 2: Add 10 Items to table</h4><p>Given the following starter code, we must add ten items to the table.</p><pre><br>import boto3<br><br># replace the keys below<br><br>dynamodb = boto3.resource(<br>    &#39;dynamodb&#39;,<br>    aws_access_key_id=&#39;*****&#39;,<br>    aws_secret_access_key=&#39;*****&#39;,<br>    )</pre><p>As you can see in the starter code we will be adding the access key information directly to our code. We will read from a CSV file containing ten items and add them to the table.</p><pre>title,units<br>Adams Family,21270<br>Eight Ball,20230<br>Flash,19505<br>Playboy,18250<br>Firepower,17410<br>High Speed,17080<br>KISS,17000<br>Star Trek,16842<br>Mata Hari,16260<br>Captain Fantastic,16155</pre><p>The code contains two functions. One that will read data from the CSV and add the items to a list. The other function will add an item to the table. The code will look like this.</p><pre>import boto3<br>import csv<br><br><br>def create_item(table_name, title, units):<br>    # Get the table<br>    table = dynamodb.Table(table_name)<br>    # Create the item<br>    table.put_item(<br>        Item={<br>            &#39;title&#39;: title,<br>            &#39;units&#39;: units<br>        }<br>    )<br><br><br>def read_csv(file_path):<br>    data = []<br>    with open(file_path, &#39;r&#39;) as file:<br>        csv_reader = csv.reader(file)<br>        # Skip the header row<br>        next(csv_reader)<br>        for row in csv_reader:<br>            data.append(row)<br>    return data<br><br><br>#### Main ############################<br><br>table_name = &quot;Pinball_Machines&quot;  # set table variable<br>file = &quot;PinballMachines.txt&quot;  # set csv file path<br><br># Create a DynamoDB resource<br>dynamodb = boto3.resource(<br>    &#39;dynamodb&#39;,<br>    # replace the keys below<br>    aws_access_key_id=&#39;AKIAQGQCZXWCBME6V5ES&#39;,<br>    aws_secret_access_key=&#39;+/oWmnXHMgOU3R9BZ7IrvaJWTnK2fRuolNuOYM94&#39;,<br>)<br><br># read data from CSV into list<br>machine_list = read_csv(file)<br><br># add items to table<br>for item in machine_list:<br>    print(&quot;Adding {} to {} table&quot;.format(item[0], table_name))<br>    create_item(table_name, item[0], int(item[1]))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YaRjfJ7uS9hOYmOvrT1now.png" /><figcaption>Execution of script</figcaption></figure><p>Let’s verify that the items have been added via the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6MKXdkdFo57gde2wAlk8xg.png" /><figcaption>Showing added items</figcaption></figure><h4>Step 3: Scan table</h4><p>Our last objective is to scan the table. Here is the function that will scan the table.</p><pre>def scan_table(table_name):<br>    # Get the table<br>    table = dynamodb.Table(table_name)<br>    # Perform the scan<br>    response = table.scan()<br>    # Get the items from the response<br>    items = response[&#39;Items&#39;]<br>    # Print the items<br>    for item in items:<br>        print(item)</pre><p>Here is the script.</p><pre>import boto3<br><br><br>def scan_table(table_name):<br>    # Get the table<br>    table = dynamodb.Table(table_name)<br>    # Perform the scan<br>    response = table.scan()<br>    # Get the items from the response<br>    items = response[&#39;Items&#39;]<br>    # Print the items<br>    for item in items:<br>        print(item)<br><br>#### Main ####<br># Create a DynamoDB resource<br>dynamodb = boto3.resource(<br>    &#39;dynamodb&#39;,<br>    # replace the keys below<br>    aws_access_key_id=&#39;AKIAQGQCZXWCBME6V5ES&#39;,<br>    aws_secret_access_key=&#39;+/oWmnXHMgOU3R9BZ7IrvaJWTnK2fRuolNuOYM94&#39;,<br>)<br><br>table_name = &quot;Pinball_Machines&quot;  # set table variable<br><br>scan_table(table_name)</pre><p>Here is the execution of the script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SwKcEKeHFfgcuG0pZFRo9g.png" /></figure><p>That is all.</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></p><p><strong><em>Interested in scaling your software startup</em></strong><em>? Check out </em><a href="https://circuit.ooo/?utm=publication-post-cta"><strong><em>Circuit</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4503a68e99d" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/boto3-and-dynamodb-basic-f4503a68e99d">Boto3 and DynamoDB Basics</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Highly Available 3-Tier Architecture in AWS]]></title>
            <link>https://blog.devgenius.io/creating-highly-available-3-tier-architecture-in-aws-ba429dbffcda?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba429dbffcda</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 05:11:07 GMT</pubDate>
            <atom:updated>2022-12-13T08:19:03.559Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C_GvfoFe486wT_D7UixhOw.png" /></figure><h4>What is 3-Tier Architecture?</h4><p>It’s a type of client-server architecture that divides the architecture into three tiers: data layer, application layer, and presentation layer.</p><ol><li><strong>Presentation</strong> — This layer sends HTML, JS, and CSS to browsers. It may use frameworks like React, Angular, Ember, Aurora, etc.</li><li><strong>Application </strong>— Processes business logic for an application. It might be written in C#, Java, C++, Python, Ruby, etc.</li><li><strong>Database </strong>— This layer provides access to application data through a database management system. This could be MSSQL, MySQL, or PostgreSQL, etc.</li></ol><p>Imagine you’re trying to find movie times in your area with a web application as an example of 3-tier architecture. In the presentation layer, you are given a web page that has fields for entering information. For example, your zip code and the date you wish to watch the movie. The information is then passed to the application layer, which then formats the query and sends it to the database.</p><p>The database system runs the query and returns the results (a list of movies available within your geographical area) to the application layer, which formats them into a web page. After this, the page is sent back to the browser, which displays it on a laptop or other device using the presentation layer.</p><h4>Benefits</h4><ul><li>You can update one tier of the application’s technology stack without affecting other areas.</li><li>Different development teams can focus on different areas of expertise. Rather than working on the full stack, developers today are more likely to have deep competency in one area, like coding the front end.</li><li>Scalable applications allow you to deploy to multiple databases and add additional web servers rather than being locked into one particular technology. For example, separate back-end tiers allow you to deploy to multiple databases.</li><li>By segregating presentation code and business logic, it simplifies the maintenance of the code base, as a change to business logic, for example, doesn’t affect the presentation code.</li></ul><h4>Objectives</h4><ul><li>Create a VPC</li><li>Create a Web Tier</li><li>Create an Application Tier</li><li>Create a Database Tier</li></ul><h3>Step 1: Create VPC</h3><p>In this step, we will create 6 subnets total for our VPC. Two public subnets for our Web-facing servers and four private subnets. Two each for our application and database tiers. This will be configured across two availability zones to ensure high availability.</p><p>Included in our VPC will be a NAT Gateway for our hosts in the private subnets to ensure they are able to reach out to the internet for updates etc. Public and private route tables will be configured.</p><p>Navigate to the <strong><em>VPC dashboard</em></strong> in the console and click<strong><em> Create VPC</em></strong>.</p><p>We are going to utilize AWS’s <strong><em>VPC experience</em></strong> wizard to automate the creation of our VPC resources. This will create our internet gateway, subnets, NAT gateway, and route tables for us.</p><p>Input your project name and check to auto-generate box. Select 2 public subnets and 4 private subnets. Your settings should look like this so far.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*FbbavADscXgvqmcmx_JlTA.png" /></figure><p>Select the option to choose to create NAT Gateway in 1 AZ. Change the VPC endpoint option to <strong><em>None</em></strong>. Click <strong><em>Create VPC</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*PR_UFiYLqoFlq00-gW49fQ.png" /></figure><p>Now our network VPC diagram should look something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vN3seqkwJxODJ9iCWdDzRg.png" /></figure><p>The wizard will create a route table for each private subnet. This is not needed in our case and we can modify one of the private route tables to include all of our private subnets for ease of management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*dmO_ofwKqH1BsCj5HNKaAQ.png" /></figure><p>Let’s modify one of the route tables to include all of the private subnets. I’ll navigate to VPC &gt; Route tables and change the name of one of the private route tables to “<strong><em>Tier3Project-rtb-private</em></strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgpXWe7aDZ9FXSxURX-tug.png" /><figcaption>Showing route tables</figcaption></figure><p>Click on the <strong><em>route table </em></strong>&gt; <strong><em>subnet associations</em></strong> tab then click <strong><em>edit associations </em></strong>within <strong><em>Explicit subnet associations</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EaSTZTVELSpgJCTngxNrGg.png" /></figure><p>Check the boxes for all our private subnets then click <strong><em>Save associations</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4EhpHQH13F_5O949nFY3qA.png" /></figure><p>Now we can delete the other private route tables. Check the boxes for the subnets then from the <strong><em>actions</em></strong> drop-down click <strong><em>Delete route table</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i2_mhijMl6CEuUGZe6swvQ.png" /></figure><p>Confirm the deletion and we have created our VPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*vQK2Mk2EAKIjXCWylHCOaA.png" /></figure><h3>Step 2: Create a Web Tier</h3><p>Let’s create an auto-scaling group for our web tier with an application load balancer.</p><p>Navigate to Auto scaling groups and click <strong><em>create</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XB3Cugx78FaFvd6e6SPbXw.png" /></figure><p>I’ll give mine the name <strong><em>WebTier-ASG</em></strong> and then click Create a <strong><em>launch template</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1q6Olc5_nxK84HDSRjAPkw.png" /></figure><p>In the new window configure the name of the template and select a free tier Amazon AMI with a t2.micro instance type then associate a key pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*AvxoJiTx1M2X71HyHdT-VA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*NlEg1WUzefjW_w9JpDfh4Q.png" /></figure><p>Create a new Security group, give a name and allow HTTP traffic from any source. Add a rule to allow SSH ideally from your IP only. I’m going to allow it from anywhere for demonstration purposes. Select the VPC we created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*FT3UUyehWItqEtWITU3b5Q.png" /></figure><p>Under <strong><em>Advanced network configuration </em></strong>add network interface and <strong><em>enable</em></strong> Auto-assign public IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*gJLgQ4dgQWM_vDRFWPejpQ.png" /></figure><p>Now will bootstrap the image to install and run apache. Expand <strong><em>advanced details</em></strong> and input the following code in the <strong><em>User data </em></strong>field.</p><pre>#!/bin/bash<br>yum update -y<br>yum install -y httpd<br>systemctl start httpd<br>systemctl enable httpd<br>echo &quot;&lt;html&gt;&lt;body&gt;&lt;h1&gt;My Custom Tier 3 Application!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot; &gt; /var/www/html/index.html</pre><p>Click <strong><em>Create launch template</em></strong> to finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6SZc4p97yw-K-v8wtmG3VA.png" /></figure><p>Now back at the Auto Scaling group wizard select the template we just created from the drop-down then click <strong><em>Next</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikExYt8UbdOQrcs1_jLeFA.png" /></figure><p>Select our VPC and select our two private subnets from the drop-down then click Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*hQ4kSrBFKsgY5vI6HZK46w.png" /></figure><p>Select <strong><em>Attach to a new load balancer </em></strong>and <strong><em>Internet-facing. </em></strong>Select<strong><em> Create a target group t</em></strong>hen leave all the defaults. Click<strong><em> Next.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*t1OWV8fbjqL44PhrlPn3rg.png" /></figure><p>We want a minimum of two machines up at all times. Change the settings to the following. Then click <strong><em>Skip to review.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*vFT9HgRU-RdnhX8UWcfVWg.png" /></figure><p>Click <strong><em>Create Auto Scaling group.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*mnbbUNMbdKkO_COCr2GoTw.png" /></figure><p>Now that we have our ASG created we need to change the security group for our application load balancer to allow internet traffic through. Navigate to <strong><em>EC2 &gt; Load balancers </em></strong>and select our <strong><em>WebTier-ASG-1 </em></strong>load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_UiK-b0TP6q9pJO0WPsTHQ.png" /></figure><p>Go to <strong><em>Actions </em></strong>&gt; Edit <strong><em>security groups</em></strong> Then click <strong><em>create new security group</em></strong>.</p><p>Give it a name and select our VPC. Allow HTTP traffic from any source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*raLiZL62-pEPFOIO7ShXWA.png" /></figure><p>Now associate the security group with the load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*277UEqODGdiFQ8MskDNaGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wg-dfDvw9QWxsqeBePbTkQ.png" /></figure><p>Now let’s test by copying the DNS name of our load balancer into a web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lUOybmvqL3qqMmUhjUqDNg.png" /><figcaption>Showing default web page</figcaption></figure><p>Great! Tier one is complete and we can view our frontend server.</p><h3>Step 3: Create Application Tier</h3><p>Now we will create the application tier. This will be very similar to our web tier. We will place our Auto Scaling Group in two private subnets to host our EC2 instances.</p><p>Create another ASG as before this time call it <strong><em>AppTier-ASG </em></strong>and select <strong><em>Create</em></strong> <strong><em>launch template. </em></strong>Select the same AMI and instance type as we did for the web tier.</p><p>Create a new security group. This time configure the NSG to only allow traffic from our <strong><em>WebTier-NSG</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*F8YjQzFgKfMMZvl_swpZjA.png" /></figure><p>No need to enable public IP assignment as these instances will remain in our private subnets. We will not add any code to the user data field.</p><p>Now back in our ASG wizard select the launch template we just created and click <strong><em>Next</em></strong>. Select the appropriate VPC and two private subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*fCdwMWwoT9Gtv799dVDGAw.png" /></figure><p>Add a new ALB and this time select the <strong><em>Internal</em></strong> for load balancer scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*a0KtNV0xRXfGyRjoE1kaJw.png" /></figure><p>Complete the wizard using the configuration as we did for the web tier. We now have two ASG and two more EC2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VgAPy2Qwb2PSleuATW6fw.png" /><figcaption>Showing ASG</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CD_JprYguMMSITShSH_ERg.png" /><figcaption>Showing EC2 instances</figcaption></figure><p>Now let’s verify that we can reach the tier 2 EC2 instances located in our private subnets from the Web tier. Connect to one of the web tier instances and ping one of the EC2 instances in our tier 2 subnets via private IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*j6oNWnLK3e3i7AXgYM2kUA.png" /><figcaption>Showing successful reply</figcaption></figure><p>Our ping was successful and we have configured our NSGs correctly. Tier 2 is complete.</p><h3>Step 4: Add Database Tier</h3><p>Now we will add our database. We will be utilizing the free tier option and creating one MySQL DB in one of our AZs.</p><p>Create a new security group. Select our VPC and create an inbound rule to only allow traffic for <strong><em>TCP port 3306</em></strong> from our <strong><em>AppTier-NSG</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJv30KoelgRboWero4B1-g.png" /><figcaption>showing NSG</figcaption></figure><p>Within the console navigate to <strong><em>RDS &gt; Databases </em></strong>and<strong><em> </em></strong>select<strong><em> Create database</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SsHCyr7DUClB5iF_74u3pA.png" /></figure><p>Choose <strong><em>Standard create </em></strong>and <strong><em>MySQL</em></strong>. Choose the <strong><em>Free tier</em></strong> and leave defaults. Fill in the password field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*40ejQYmiETFObMZFOnOOlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*WhLcuV9S0DIPu3S92EMYNA.png" /></figure><p>Under the <strong><em>Connectivity</em></strong> section select our VPC and our NSG for the <strong><em>VPC security group</em></strong>. Select <strong><em>us-west-2a</em></strong> for Availability Zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*xGslDe2EckwB0abR2xtBlg.png" /></figure><p>Click <strong><em>Create database</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*dhqLPfYIpImndxCuCKDSCA.png" /></figure><p>The database has been created and we are finished with this tutorial. Take care!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba429dbffcda" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/creating-highly-available-3-tier-architecture-in-aws-ba429dbffcda">Creating Highly Available 3-Tier Architecture in AWS</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Configure an AWS DynamoDB Table and IAM Role]]></title>
            <link>https://blog.devgenius.io/how-to-configure-an-aws-dynamodb-table-and-iam-role-5c705a50230d?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c705a50230d</guid>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 02:22:08 GMT</pubDate>
            <atom:updated>2022-12-12T08:31:42.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhsKbGifjh9IFej0m3U3ig.png" /></figure><p>In this project, we will create a DynamoDB table and populate it with the top ten best-selling pinball machines. We will then apply a role-based policy to allow read access from an EC2 instance.</p><h4>Project Objectives</h4><ul><li>Create a DynamoDB table.</li><li>Using an IAM role and the principle of least privilege, grant the EC2 instance read access to DynamoDB.</li><li>Use the AWS CLI in the EC2 instance to scan the DynamoDB table.</li><li>Use the AWS CLI in the EC2 instance to validate you cannot write an item to the DynamoDB table.</li></ul><h4>Prerequisites</h4><ul><li>AWS free tier account</li><li>EC2 Instance</li></ul><h4>What is DynamoDB?</h4><p>DynamoDB is a fully managed NoSQL database service provided by Amazon Web Services that is known for its low latency and scalability.</p><p>With DynamoDB, you can store and retrieve any amount of data, as well as serve any level of request traffic, in an easy and cost-effective way. Solid-state drives provide high I/O performance, enabling high-volume requests to be handled more efficiently. Users interact with the service either through the AWS Management Console or the DynamoDB API.</p><p>The DynamoDB database uses a NoSQL database model, which is non-relational, so documents, graphs, and columnar relationships can be manipulated between its data models. DynamoDB supports conditional operations as well as basic CRUD operations. Each DynamoDB query uses a primary key, which uniquely identifies each item.</p><h4>Step 1: Create Table</h4><p>Within the AWS console navigate to <strong><em>DynamoDB</em></strong> and click “<strong><em>Create</em></strong><em> </em><strong><em>table</em></strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LIvO2sMFG17tNm2sTAqUag.png" /></figure><p>I named the table “<strong><em>Pinball</em></strong>” and used the value “<strong><em>name</em></strong>” for the partition key. No need for a sort key as the Pinball machine names will be unique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qG0bSY4JBxtWtYkPHv3_jQ.png" /></figure><p>Leave the defaults then click “<strong><em>Create table</em></strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*jBTkKTV5KPT5KaGSzu_WoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e4LH68J1xS6FwFRSu2kroA.png" /><figcaption>Showing DynamoDB Table</figcaption></figure><p>Now let’s populate the table with the top ten best-selling pinball machines. Click on the table then from the actions drop-down select “<strong><em>Create item</em></strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*soM5Jy5bbyrUR1pKqnTJQg.png" /></figure><p>Click the “Add new attribute” drop-down and select “<strong>number</strong>” and name it “<strong>units</strong>”. This is where we will put the number of units sold for each pinball machine. Fill in the appropriate information and select “<strong>Create item</strong>”. Repeat for the next nine items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBWkYHdTi8-_jNc4g5KbZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_oWbslP0InoF6uuwix5dQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*My96ZCWnpao5AfnGXQdjag.png" /><figcaption>Showing completed table</figcaption></figure><h4>Step 2: Create IAM Role</h4><p>In the Identity and Access Management dashboard, click on “<strong><em>Roles</em></strong>” and “<strong><em>Create role</em></strong>”. Select “<strong><em>AWS service</em></strong>” for the trusted entity and “<strong><em>EC2</em></strong>” for the use case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkqiPFZ2MQwJjDtMuDMbVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqxNMCxHISDhE06vFeXhsg.png" /></figure><p>On the next screen type <strong><em>DynamoDBReadOnlyAccess </em></strong>in the search box and select the policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bsT8nwn5PXknyHo5nxY2nw.png" /></figure><p>Give the role a name then click “<strong><em>Create Role</em></strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9KdwqPPCSnabtRfUo5176w.png" /></figure><h4>Step 3: Apply IAM Role</h4><p>Navigate to your EC2 instance within the console. From the “<strong><em>Actions</em></strong>” drop-down go to “<strong><em>security”</em></strong> &gt; “<strong><em>Modify IAM role</em></strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*VEuqVARTrhKvnUQsD7mN2A.png" /></figure><p>On the next screen select our IAM role and click “<strong><em>Update IAM role</em></strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*627Rkl9Z1hAQdPxL99xEqw.png" /></figure><h4>Step 4: Scan DynamoDB Table</h4><p>Connect to your EC2 Instance and run the following command using your respective table name.</p><pre>aws dynamodb scan --table-name Pinball --region us-east-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZwZM8hYQ4S5an9cao9TrA.png" /></figure><p>Looks like we are successful and can read the data from our EC2 instance.</p><h4>Step 5: Test Permissions</h4><p>If we set up our role correctly we should only be able to read and not write to the table. Let’s test this by trying to add another item. I’ll input the following command.</p><pre>aws dynamodb put-item — table-name Pinball — item ‘{“name”: {“S”: “Twilight Zone”},”units”: {“N”: “15235”}}’ — region us-east-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZwIIQXatwp7-1toXvRn30A.png" /><figcaption>Showing access denied</figcaption></figure><p>Success! We received an access denied error. Our IAM role is working and not allowing us to write to the table.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c705a50230d" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/how-to-configure-an-aws-dynamodb-table-and-iam-role-5c705a50230d">How to Configure an AWS DynamoDB Table and IAM Role</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an EC2 Autoscaling Group with an Application Load Balancer]]></title>
            <link>https://blog.devgenius.io/creating-an-ec2-autoscaling-group-with-an-application-load-balancer-5e54dc15337d?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e54dc15337d</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[ec2]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Sat, 03 Dec 2022 01:57:08 GMT</pubDate>
            <atom:updated>2022-12-06T04:41:32.325Z</atom:updated>
            <content:encoded><![CDATA[<p>Automate provisioning and scaling for an Apache web server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*F_GtA5YDZCu9Vujtrq8qzQ.png" /></figure><p>In this tutorial, we will create an autoscaling group for your Apache web server and place it behind an application load balancer.</p><h3>Requirements</h3><ul><li>AWS free tier</li></ul><h3>Step 1: Create VPC</h3><p>The first step is to create a new VPC to segment our web app resources. We will create three public subnets in three different availability zones to ensure high availability.</p><p>After logging into the console locate the VPC service from the dashboard. Click “<strong>Create VPC</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ow8KhLfgD8aXvj3WMe3qmg.png" /></figure><p>We will utilize the newly <strong><em>create VPC experience</em></strong><em> </em>from AWS to auto-generate the names for our resources as well as create the subnets, route table, and internet gateway for us.</p><p>Let’s call our project “<strong>Web-App</strong>” and use the <strong>10.10.0.0/16 </strong>network for our VPC and break that down into the following public subnets: <strong>10.10.1.0/24</strong>, <strong>10.10.2.0/24</strong>, and <strong>10.10.1.0/24</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZdDCMY4RCUZ11r8oKK4kA.png" /><figcaption>Showing new create VPC experience</figcaption></figure><p>Change the number of availability zones to 3 and the number of private subnets to 0. Fill in customized subnet CIDR blocks with our specified and change the VPC endpoint to none.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*_oQBUzh4mS-B6l9-NmV7Zw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*WOEt_U9aRjhfB5yIpAzjcQ.png" /></figure><h3>Step 2: Create a Launch Template</h3><p>Now that our VPC and network resources have been created we can create a launch template that will be used with our auto-scaling group.</p><p>First, let&#39;s create a security group to allow web traffic. Navigate to VPC &gt; Security Groups then click “Create security group”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xp1JiANxslU4sIOd9qt5VA.png" /></figure><p>Create the following security group to allow inbound traffic for TCP ports 80 and 443 from any source. Let’s call it “Allow-Web-Access”. Select the VPC we just created in the drop-down. Then click “create security group”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FS4FmIvEfx87EXbke2oPvw.png" /></figure><p>Navigate to Instances &gt; Launch Templates and click “Create launch template”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xiBEI8j4nMshNZGuRmiHVg.png" /></figure><p>Give a template name and select an Amazon AMI from the free tier and t2.micro instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*N0iYaoTHrNM3EAGOCMO_5g.png" /></figure><p>Assign a pre-existing key pair and the security group we just created. Under “Advanced network configuration” change “Auto-assign public IP” to <strong>enabled</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*gYE_HyHuNgRYiql1IjbQIw.png" /></figure><p>Hit the “Advanced Details” arrow and scroll down to the “User data” field. Input the following code that will be used to provision our Apache web server upon launch. Then click create.</p><pre>#!/bin/bash<br>yum update -y<br>yum install -y httpd<br>systemctl start httpd<br>systemctl enable httpd<br>EC2AZ=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) <br>echo &#39;&lt;center&gt;&lt;h1&gt;This Amazon EC2 instance is located in Availability Zone: AZID &lt;/h1&gt;&lt;/center&gt;&#39; &gt; /var/www/html/index.txt<br>sed &quot;s/AZID/$EC2AZ/&quot; /var/www/html/index.txt &gt; /var/www/html/index.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wowFCM9BKi1mwXd90v3gZA.png" /></figure><h3>Step 3: Create an Auto-scaling Group</h3><p>Navigate to Auto Scaling &gt; Auto Scaling groups and click “Create Auto Scaling group.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*XAFsnQqibPaAbzwRSBfQcA.png" /></figure><p>Give it a name and select the template we just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*b_pwkio4FyDuYOKs8txAIw.png" /></figure><p>On the next page, select our newly created VPC from the drop-down and check the boxes for all 3 subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*WL0T5jRg-woKLWWvbN9KFw.png" /></figure><p>Select “Attach to a new load balancer” option and choose “Internet-facing”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*wIP1zLVyG8YQsE83Vri0SA.png" /></figure><p>Select “Create a target group” under “Listeners and routing” and leave the default. Click Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*dJnQI-pmb8CVhUTeDMaHzQ.png" /></figure><p>Changed the Group size to the settings as shown below then click “Skip to review” and then “Create Auto Scaling Group”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*0KfywJ7VB2Pe5ibNTA1TFQ.png" /></figure><p>You should now see our Auto Scaling group listed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hb_I0tgLDs7_Py2mZtAwmg.png" /></figure><p>You can go to your EC2 instances section in the console to confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*75nlT1apKuDgPtffmp2Ifw.png" /></figure><p>As of right now, our web apps can receive inbound traffic via the security group we created. But our load balance does not have the security group applied. Let’s go to our load balancer and apply the group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lh_WA9zbJKFSsrrc0aMDFA.png" /></figure><p>Within our load balancer config go to the security tab and click edit to add our “Allow-Web-Access” security group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_SUVVPANQZgfiJVG07S3Uw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*zaEv_-qxWgiWdjDRLM3yBw.png" /></figure><p>After saving the changes copy the DNS name for our load balancer and input it into a web browser to test our web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vy5yUmynldkFvXZX6vA3iw.png" /><figcaption>Showing Load Balancer DNS name</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yKoYYwbgYg0SS8gnsww1CA.png" /><figcaption>Showing working web server</figcaption></figure><p>Success! That’s it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e54dc15337d" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/creating-an-ec2-autoscaling-group-with-an-application-load-balancer-5e54dc15337d">Creating an EC2 Autoscaling Group with an Application Load Balancer</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using AWS CLI to Create EC2 Instance with Nginx Install]]></title>
            <link>https://blog.devgenius.io/using-aws-cli-to-create-ec2-instance-with-nginx-install-75b1510b087?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/75b1510b087</guid>
            <category><![CDATA[aws-cli]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Fri, 02 Dec 2022 08:36:16 GMT</pubDate>
            <atom:updated>2022-12-03T14:52:47.965Z</atom:updated>
            <content:encoded><![CDATA[<p>How to use AWS CLI and user-data field to create Nginx web server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*Drac3VXUw4pLISIzmKIcnQ.png" /></figure><h3>Mission:</h3><p>Our goal here is to spin up an Nginx web server using an Amazon EC2 instance all via AWS CLI. We will create a security group and provision the server to our default VPC, install and start our web server without having ever to log into it.</p><h3>Requirements:</h3><ul><li>AWS free tier</li><li>AWS CLI configured for use with your account</li><li>Bash</li></ul><h3>Step 1: Create a Security Group</h3><p>Will need to create a security group to allow traffic from the outside to hit our web server. Let&#39;s give it a name and description. I’m going to name it “<strong>allow-web-access</strong>” Here is the command to create the security group.</p><pre><br>aws ec2 create-security-group --group-name allow-web-access --description &#39;Allow for inbound traffic to port 80&#39;</pre><p>If the command was successful you will receive a response written in JSON noting the <strong>GroupID</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*3pmb4XXQklrk66iIn3tfWQ.png" /><figcaption>showing response with GroupID</figcaption></figure><p>Next, we need to configure the rules for the group. We will create a rule to allow inbound traffic destined for TCP port 80 from any IP. Here is the command we will use to specify the rule for the security group we just created.</p><pre>aws ec2 authorize-security-group-ingress --group-name allow-web-access --protocol tcp --port 80 --cidr 0.0.0.0/0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*pmrzxGgc9-D0LNEXXGoPOw.png" /><figcaption>showing the response from the successful command</figcaption></figure><h3>Step 2: Create EC2 Instance</h3><p>Before we create the EC2 instance we need to gather the required information to create the instance. First, let’s find out what the ID is for our AMI. You will need to log into the portal to confirm the ID for your desired instance. Navigate to “<strong>EC2 &gt; Instances &gt; Launch an Instance</strong>” then select your desired image and note the ID and Instance type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQIycF0TOXNZ0waZy3RGIQ.png" /><figcaption>showing AMI ID</figcaption></figure><p>Before we run the command to create the instance we need to create a BASH script. This script will be used to install the Ngnix web server upon initial launch. We will utilize the “<strong>user-data</strong>” option for this. Create the following script on your local machine and save it as “<strong>install.sh</strong>”.</p><pre>#!/bin/bash<br>sudo yum update -y<br>sudo amazon-linux-extras install nginx1 -y<br>sudo systemctl start nginx<br>sudo systemctl enable nginx</pre><p>Now let’s run the AWS CLI command to create the instance.</p><pre>aws ec2 run-instances --image-id ami-0b0dcb5067f052a63 --instance-type t2.micro --security-groups allow-web-access --user-data install.sh</pre><p>You should now see our new instance in the console. Let’s copy the public IP into a new browser window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ML5I25dkqEJ2KocvhXnJWQ.png" /><figcaption>Showing new instances and public IP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*zSDYsgVmZ0fPTrnCdJSkZg.png" /><figcaption>Showing default web page</figcaption></figure><p>That’s it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75b1510b087" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/using-aws-cli-to-create-ec2-instance-with-nginx-install-75b1510b087">Using AWS CLI to Create EC2 Instance with Nginx Install</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying an EC2 instance in AWS and installing Apache]]></title>
            <link>https://blog.devgenius.io/deploying-an-ec2-instance-in-aws-and-installing-apache-81d3c3670b9?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/81d3c3670b9</guid>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Fri, 02 Dec 2022 04:04:51 GMT</pubDate>
            <atom:updated>2022-12-03T14:52:49.864Z</atom:updated>
            <content:encoded><![CDATA[<h4>Amazon Web Services and Apache</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*oaSfOR_s3H0iQRUCtqAxLA.png" /></figure><h3>Scenario:</h3><p>Your company wants to start shifting from using on-premises servers to using servers in the cloud. Rather than purchasing all the infrastructure in a data center, they ask you to create an EC2 instance in AWS to host their new website.</p><h3>Requirements</h3><ul><li>AWS free tier account</li></ul><h3>Step 1: Deploy EC2 Instance</h3><p>Access the EC2 service through your AWS account. Use the search bar at the top left to locate the service if it is not listed on your homepage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e20yKcrL7PMPwdxrnS14Vg.png" /></figure><p>Click<strong> “Launch Instance”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KxWYIhAuYP9mZnEzKuurgg.png" /></figure><p>Now we can name it and select the desired<strong> AMI </strong>and <strong>instance</strong> type. I’ll choose an instance type that remains in the free tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*uAiEoHk4z9wJc0DnKjDcBg.png" /></figure><p>Next, we need to create a <strong>Key Pair</strong>. This will issue a set of SSH keys to enable us to remote into our instance via SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*srukixJXx-2A5L4PZWIv-w.png" /></figure><p>Next, we need to create a new security group to allow the public to access the webpage and allow us to ssh into the server. Check all boxes and input your IP address in the “<strong>Allow SSh traffic from</strong>” drop menu. This will allow only access from your IP to be able to SSH to the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*7I-qTTHaEtqaWivZm4_WWA.png" /></figure><p>Click “<strong>Launch Instance</strong>” to deploy the instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*ZdpgvFl6RfON3h7V0HbiDA.png" /></figure><h3>Step 2: SSH into the Instance</h3><p>Now will SSh into the instance. From the EC2 services page locate and click on your instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gIYwhbeS85reD9rOGcGNg.png" /></figure><p>Click on the “<strong>Connect</strong>” button then the “<strong>SSH client tab</strong>”. This will display the necessary information and commands we will use to remote in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BokbnVrrKxvjiaWK70OOeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*TktftANGjrmWs98SLrIP3Q.png" /></figure><p>Open up a terminal on your local machine and follow the instructions as outlined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_wXfb6eX8Dt_k5dlCNlQg.png" /><figcaption>Show successful log in</figcaption></figure><h3>Step 3: Install Apache</h3><p>Let’s create a BASH script for the installation. Open up your favorite editor and input the following code.</p><pre>#!/bin/bash<br>sudo yum update -y<br>yum install -y httpd<br>sudo systemctl start httpd<br>sudo systemctl enable httpd<br>sudo echo &#39;&lt;center&gt;&lt;h1&gt;This Apache Web Server is Running on an AWS EC2 Instance &lt;/h1&gt;&lt;/center&gt;&#39; &gt; /var/www/html/index.html</pre><p>Save the file as “<strong>install.sh”</strong> and give it execute permissions and run the script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*tJQnKzgFWIGlQgn_gyT5tg.png" /><figcaption>Running BASH Script</figcaption></figure><h3>Final Step: Access web site</h3><p>Now that the service has been installed and is running. Input the public IP of the instance into a web browser to confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puOowxRO4GI1agC9xJPN0Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81d3c3670b9" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/deploying-an-ec2-instance-in-aws-and-installing-apache-81d3c3670b9">Deploying an EC2 instance in AWS and installing Apache</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Basics]]></title>
            <link>https://blog.devgenius.io/github-basics-ef4a19fd60e2?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef4a19fd60e2</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Sun, 06 Nov 2022 06:07:22 GMT</pubDate>
            <atom:updated>2022-11-06T19:24:37.187Z</atom:updated>
            <content:encoded><![CDATA[<h4>Fork, Clone, Commit, Push, Pull</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poVqhn3nbvTSeNlajRO8yw.jpeg" /></figure><p>When you collaborate with multiple people, writing code and tracking changes can get quite cumbersome. That’s why version control software is so important. We’re going to look at the basics of GitHub today. In order to make edits without fear of overwriting an existing repository, we will fork it and clone it to our local workstation. Once we’ve made the edits to our forked repository, we can request a merge with the original repository.</p><h4>What is Git?</h4><p>In 2005, Linus Torvalds developed <strong>Git </strong>as an open source version control system to help developers track changes to files during software development, when multiple programmers collaborate to develop code.</p><h4>What is GitHub?</h4><p><strong>GitHub </strong>is a website where you can host, track, and manage your Git repositories. Users can easily share their repositories on the website with other developers. Developers can clone remote repositories to their computers so they can work on a local version of the project and its code history.</p><h4>Prerequisites</h4><ul><li>CentOS Stream 9</li><li>GitHub Account</li></ul><h4><strong>Installing Git</strong></h4><p>Step 1: Update and install Git</p><p>Let’s update our repo.</p><pre>yum update -y &amp;&amp; yum upgrade -y</pre><p>Now install the <strong>Git </strong>package.</p><pre>yum install git -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tyKXWuXglZQVGkkDllXIZQ.png" /><figcaption>Installing Git package</figcaption></figure><p>Verify the install.</p><pre>git --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*Vf7V7T9piqEUjwMiUFDjJA.png" /><figcaption>Showing installed Git version</figcaption></figure><p>Now let’s set up some basic configurations. We will be setting the global username variable and email address. Insure the email address is one that is tied to your <strong>GitHub</strong> account. Your username can be anything you like.</p><pre>git config --global user.name &lt;username&gt;<br>git config --global user.email &lt;email_addr&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q_scI_H41kWu2pqHcw8fkw.png" /><figcaption>Setting username and email variables</figcaption></figure><h4>Fork Repository</h4><p>By forking a repository, you can change it without changing the original repository. Let’s fork the desired repo to our <strong>GitHub</strong> account.In this example we are going to fork the following repo. <a href="https://github.com/LevelUpInTech/LevelUpTeam">https://github.com/LevelUpInTech/LevelUpTeam</a></p><p>Navigate to the repo you would like to fork and click the <strong><em>Fork</em></strong> link in the top right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5rW7h3P5UdjW_hFI5tXXg.png" /><figcaption>How to fork a repo</figcaption></figure><p>On the next screen you can change the name and description of your fork. I will leave the defaults. Click “<strong><em>Create fork</em></strong>” to finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_2VpjHpmnN_AyZhHK0aDPA.png" /><figcaption>Create fork</figcaption></figure><h4>Clone Forked Repository</h4><p>The forked repository has now been created on <strong>GitHub</strong>. To access it locally, we must <strong>clone</strong> the repository. Using the URL of the forked repository, enter the following command on your workstation where you would like to clone the repository.</p><pre>git clone <a href="https://github.com/DaftDaze/LevelUpTeam">https://github.com/DaftDaze/LevelUpTeam</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70n6rmI8QwvFRcNvKaLjYw.png" /><figcaption>Cloning Repository</figcaption></figure><p>Once the clone is finished you will notice you now have a copy of all directories and files from the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*xyctsKo5OdrzV_VV8tLY-w.png" /><figcaption>Showing cloned directories and files</figcaption></figure><h4>Commit</h4><p>In Git, commits are the building blocks of the timeline. Commits are snapshots or milestones along the timeline. They are created by using the <strong>git commit </strong>command to capture the current state of the project.</p><p>For our example we&#39;ll be making a change to the <strong><em>linux.sh</em></strong> file. Looks like we need to edit line 22.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*K6FqwUS4h2_W7Dq6wlOk6A.png" /><figcaption>Showing line we need to change</figcaption></figure><p>Let’s change the line to echo out <em>“This is week 4 — project Github”.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*nTj8Tara8izZJeS-pq8ygg.png" /><figcaption>Showing updated change</figcaption></figure><p>Now that we have have a changed the file in our repo we need to add it in order for our commit to record the changes.</p><p>By using the <strong>git add </strong>command, you can add changes to the staging area from your working directory. Git knows you want to include changes to a particular file in the next commit. However, git add does not actually have any significant impact on the repository — changes aren’t recorded until you run git commit .</p><p>Run the following command to add the file.</p><pre>git add linux.sh</pre><p>You can confirm if the command was successful by running the <strong>git status</strong> command.</p><pre>git status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiENgR4k7aXPN6zMw-NPSA.png" /><figcaption>Showing git status</figcaption></figure><p>Let’s create a commit using the <strong>git commit</strong> command. You can think of this as creating a “save-point”. We will use the “<strong>m</strong>” switch to add a message to our commit.</p><pre>git commit -m &quot;Edit line 22 to echo project Github&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DRBhOmnMn2c-v2Tj64C2Ww.png" /><figcaption>Showing git commit command</figcaption></figure><h4><strong>Push</strong></h4><p>In Git, pushing means moving code from one repository to another. This is often used to move code from a local machine to a remote one, or to a repository hosting service like GitHub.</p><p>Now let’s push the changes to our forked repository on GitHub.</p><p><strong>Step 1: Create Access Token</strong></p><p>We will need to create an access token in order to authenticate to GitHub. Here&#39;s a link to a video that will show you the steps. <a href="https://www.youtube.com/watch?v=SzrETQdGzBM">https://www.youtube.com/watch?v=SzrETQdGzBM</a></p><p>Navigate to <strong>Settings</strong> &gt; “<strong>Developer settings</strong>” . Select “<strong>Tokens (classic)”</strong>under “<strong>Personal access tokens</strong>” &gt; Then under “<strong>Generate new token</strong>” drop-down select “<strong>Generate new token (classic)</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4dbGPc-0Q7HbdHPuLlbIQ.png" /><figcaption>Showing Developer settings</figcaption></figure><p>Give it a name and define the scope then click “<strong>Generate token</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwHQ_tT9_xotkc0hW5P7rw.png" /><figcaption>Access token settings</figcaption></figure><p>Copy your access code from the next screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0n8iQikcarUtJxmd4kApRQ.png" /><figcaption>New access token created</figcaption></figure><p><strong>Step 2: Push</strong></p><p>Push the changes to the remote repository by running the following command.</p><pre>git push origin main</pre><p>It will prompt for username and password for remote GitHub repository. Use the access token we just created for the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1_fIG5NIcEOVzwe1JrZbBg.png" /><figcaption>Successful push command</figcaption></figure><p>Navigate back to the forked repo on GitHub and go to commits. You will see the changes that have been made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xXsKexyZaQRnqkQDjryzw.png" /><figcaption>Showing difference in files</figcaption></figure><h4>Pull</h4><p>GitHub <strong>pull </strong>requests let you share changes you’ve made to a branch in a repository. Once a pull request is opened, you can communicate with collaborators about the potential changes and add follow-up commits before the changes are merged to the original repository.</p><p>Let’s initiate a <strong>pull</strong> to request our commits be merged with the original repository. From your forked repo click on <strong>Pull requests</strong> &gt; <strong>New pull request</strong> &gt;<strong> Create pull requests</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vk5MjOXBWVKUc9bm3diIaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4cBjV4TGV9U9Z5xfOjqVQ.png" /></figure><p>You can add a comment, explain your reasons for committing or add any additional information on the next page. Click “<strong>Create pull request</strong>” to finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubq8e7xPFSck9fFV95Xgyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUyqhWFmnyqWhXbdGY21xg.png" /><figcaption>Showing completed pull request</figcaption></figure><h4>Conclusion</h4><p>It’s time to wrap up this tutorial. We’ve gone over some basics about what GitHub and Git are. We forked, cloned, committed, pushed, and pulled!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef4a19fd60e2" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/github-basics-ef4a19fd60e2">GitHub Basics</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Install NGINX on Ubuntu 18.04 LTS]]></title>
            <link>https://blog.devgenius.io/how-to-install-nginx-on-ubuntu-18-04-lts-99008ad33ae5?source=rss-5e7c796e80d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/99008ad33ae5</guid>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[Anthony Giles]]></dc:creator>
            <pubDate>Wed, 19 Oct 2022 06:57:10 GMT</pubDate>
            <atom:updated>2022-10-21T20:45:59.495Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C4ewXfgIVtx1g2upH4s90g.jpeg" /></figure><p>It’s been an unusually hot day in Seattle today especially for mid-October. The air is thick with smoke from wildfires and a muggy 82 degrees. A good day to stay inside with my air filters and write my first Medium article.</p><p>Today we will be installing NGINX web server on Ubuntu 18.04 LTS. This will be a quick install intended to create a test web server.</p><h4>What is NGINX?</h4><p><strong>NGINX</strong> is open-source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers.</p><h4>Prerequisites</h4><ul><li>Root level access</li><li>Ubuntu 18.04 LTS</li></ul><h4>Installing NGINX</h4><p><strong>Step 1: Updating packages</strong></p><p>Begin by logging into your Ubuntu instance .</p><pre>ssh &lt;username&gt;@&lt;ip&gt;</pre><p>Let’s update the repo to ensure we have the latest and most secure version.</p><pre>apt-get update &amp;&amp; apt-get upgrade</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*-N_2tXXO-HD9j1xctN_ARA.png" /><figcaption>Updating Repository</figcaption></figure><p><strong>Step 2: Install NGINX</strong></p><p>Now that the repo is up to date let’s install the NGINX package.</p><pre>apt install nginx -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*fWyEXSE-IdVn7sXPaRrkjg.png" /><figcaption>Installing NGINX package</figcaption></figure><p>Let’s verify the install and check the version by running the following command.</p><pre>nginx -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*UVwJpy-p9P4MzWJYedCwKQ.png" /><figcaption>Confirming install and version</figcaption></figure><p>When you install NGINX on Ubuntu 18.04 the service will automatically start. Now let’s check the status to see if the service is running.</p><pre>systemctl status nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*hFH7GoDA5BKc8nxCsXkhJQ.png" /><figcaption>Checking service status</figcaption></figure><p>Now let’s enable the service so it will auto-start after reboot.</p><pre>systemctl enable nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*tfyqMZT5BQCr42RvKtbKdA.png" /><figcaption>Enable service to auto-start after reboot</figcaption></figure><h4><strong>Step 3: Test</strong></h4><p>Last step to confirm a working install is to access the site through a web browser by inputting the public IP of your server. If you do not know what your IP is you can run the following command.</p><pre>curl -4 icanhazip.com</pre><p>Now input the IP address into your favorite web browser and you should see the default landing page for NGINX.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*6KNl51EuN_6lhqSGjc0RoA.png" /><figcaption>Default web page</figcaption></figure><p>That was simple! Lets put these commands into a bash script and customize the landing page.</p><p>Create a file with your favorite editor. I like to use <strong>VIM</strong>. Input the following code and save as “<strong>installNginx.sh”</strong>.</p><pre>#!/bin/bash</pre><pre>echo -e &#39;\nStarting script...&#39;</pre><pre>apt-get update &amp;&amp; apt-get upgrade -y<br>apt install nginx -y<br>systemctl status nginx<br>systemctl enable nginx</pre><pre>rm /var/www/html/*.html</pre><pre>echo &#39;&lt;html&gt;<br>&lt;head&gt;<br>        &lt;title&gt;Test Page&lt;/title&gt;<br>&lt;/head&gt;</pre><pre>&lt;body&gt;<br>        &lt;h1&gt;Welcome to LUIT - Black Team!&lt;/h1&gt;<br>        &lt;a href=&quot;<a href="https://www.linkedin.com/in/algiles/">https://www.linkedin.com/in/algiles/</a>&quot;&gt;Check out my LinkedIn!&lt;/a&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;&#39; &gt; /var/www/html/index.html</pre><pre>echo -e &#39;\nInput following IP into web browser\n&#39;</pre><pre>curl -4 icanhazip.com</pre><pre>echo -e &#39;\nDone!\n&#39;</pre><p>Make the file executable.</p><pre>chmod +x installNginx.sh</pre><p>Now execute the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*LrFyDfPvcPHJGtdUJ0PuIw.png" /><figcaption>Starting Script</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*SAEqjRgn-67oOzMVHtM6aA.png" /><figcaption>Script finished running and displays public IP</figcaption></figure><p>Let’s see if it worked by inputting the specified IP into our web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*VTF9SEJscUoe_1aIuY3PEQ.png" /><figcaption>Custom index.html</figcaption></figure><p>Sweet! That worked out pretty well. I really enjoyed this exercise so let’s make it happen again. This time using <strong>Python</strong>!</p><p>Same steps as before. I’ll create a file named “<strong>installNginx.py”</strong>. Write the code, this time using Visual Studio Code on my workstation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*-35B5iYAjIxHCjT_ZLo3Wg.png" /><figcaption>Python code in Visual Studio Code</figcaption></figure><p>I’ll use the “<strong>scp</strong>” command to transfer the file from my local machine to the “<strong>/tmp”</strong> directory on my remote server.</p><pre>scp installNginx.py &lt;username&gt;@&lt;server-IP&gt;:/tmp/</pre><p>Make the file executable as we did before and run it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*28lv-wdtoTZEbx6ejwFJuQ.png" /><figcaption>Running python script</figcaption></figure><p>That’s it. We have successfully installed <strong>NGINX</strong> on <strong>Ubuntu 18.04 LTS</strong> and script the install using <strong>Bash</strong> and <strong>Python.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99008ad33ae5" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/how-to-install-nginx-on-ubuntu-18-04-lts-99008ad33ae5">How To Install NGINX on Ubuntu 18.04 LTS</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>