<?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 Deshone Henry on Medium]]></title>
        <description><![CDATA[Stories by Deshone Henry on Medium]]></description>
        <link>https://medium.com/@Deshone_Henry?source=rss-1603ed13b15f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*88Zahll72np95sWsWgU57Q.png</url>
            <title>Stories by Deshone Henry on Medium</title>
            <link>https://medium.com/@Deshone_Henry?source=rss-1603ed13b15f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:20:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Deshone_Henry/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 a Docker Image and Container with a Dockerfile]]></title>
            <link>https://medium.com/@Deshone_Henry/how-to-create-a-docker-image-and-container-with-a-dockerfile-af93aee358a2?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/af93aee358a2</guid>
            <category><![CDATA[image]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Sat, 04 Jun 2022 22:44:09 GMT</pubDate>
            <atom:updated>2022-06-04T22:47:58.730Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*1h-lfMpkZbjfY-je73OFgA.jpeg" /></figure><h3>What is Docker?</h3><p>Docker is a tool that allows developers to quickly and easily deploy their applications or websites in a sandbox called containers. These containers can run on the host operating systems or in the cloud. Compared to Virtual machines, Docker containers doesn&#39;t use any of the host resources like CPU memory or HD space. It just runs on top of the infrastructure that it is on.</p><h3><strong>Setting your Environment</strong></h3><ul><li>Use Cloud 9 environment with Ubuntu server</li><li>Go to the security group of the cloud 9 instance and add an inbound rule to allow all traffic with the source being your IP Address eg. 10.0.0.0/32</li><li>Next install aws</li></ul><pre>pip install aws</pre><h3>Github</h3><ul><li>Here is the <a href="https://github.com/gr8ness/Docker/tree/main/LUIT/week-17-project">Dockerfile</a> and script for this tutorial</li></ul><h3>Creating an image</h3><p>We are going to create our own image using Nginx. To do that we need to use the docker command</p><pre>docker pull nginx </pre><p>To find more documentation about this image, it can be found <a href="https://hub.docker.com/_/nginx">here</a>.</p><p>You can view the image with</p><pre>docker images</pre><h3>Run the container</h3><p>Now to create a container use the code below and enter the image name. This will run the container in a detached state -d and make it interactive with -it flag.</p><pre> docker run -d -it &lt;image_name&gt;  </pre><p>You can even assign a port to the container . It will be exposed to port 8080.</p><pre>docker run -dp 8080:80 -it nginx</pre><p>To list the running or all containers use :</p><pre>docker ps </pre><pre>or</pre><pre>docker ps -a </pre><p>This will list the container ID , Image Name, Command , Status and Ports</p><p>Lets interact with the container and open its terminal . You can use either the image name or container id</p><pre>docker exec -it &lt;container_name or ID&gt; bash</pre><p>Type ‘exit’ to leave the terminal of the container</p><p>Since we have an Nginx (web sever) image inside of our container we can view the web page of the container .</p><pre>curl localhost:8080 </pre><p>To view Nginx page copy ip address with port :80 to view the webpage in your browser</p><h3>Clean up</h3><p>To stop the running container</p><pre> docker stop &lt;container ID or name&gt;</pre><p>Remove container</p><pre>docker rm &lt;container ID or name&gt;</pre><h3>Dockerfile creation</h3><p>Now lets recreate this image but with a Docker file. This will lets us create images and containers faster by tell Docker what to build .</p><p>To start create the Docker file</p><pre>touch Dockerfile </pre><p>Note: make sure the D is capitalized or it will not be recognized by docker</p><pre>FROM nginx</pre><pre>RUN mkdir -p /environment/my-first-image/</pre><pre>COPY . /environment/my-first-image/</pre><pre>WORKDIR /environment/my-first-image/</pre><pre>EXPOSE 8080</pre><pre>RUN chmod 755 date.sh</pre><pre>ENTRYPOINT [&quot;./date.sh&quot;]</pre><pre>CMD [&quot;./date.sh&quot;]</pre><pre>CMD [&quot;tail&quot;, &quot;-f&quot;, &quot;/dev/null&quot;]</pre><p>This is the code for the Docker file that will create an nginx image create two directories and run a script to timestamp the date and time the container was created.</p><pre>FROM : is the image that you want to create or pull</pre><pre>RUN: tell docker to execute these commands in the container. It will create two directories</pre><pre>COPY: this will copy everything from the source in the containers path.</pre><pre>WORKDIR : sets the working directory to my-first-image</pre><pre>EXPPOSE: expose to container to listen to port 8080</pre><pre>RUN: execute the command to change the script of date.sh to be executable</pre><pre>ENTRYPOINT: configures a container to run as an executable</pre><pre>CMD : this works as if you are using the terminal to run commands</pre><p>Once the Dockerfile is created save and use the command below to build the image. The -t flag will give the image a name</p><pre>docker build -t &lt;name_the_image&gt; .</pre><p>Repeat the steps to create and interact with the container by using the image you just created with the Dockerfile</p><pre>docker run -d -it &lt;image-name or ID&gt; bash<strong> (runs container in detached state)</strong></pre><p>Interact with the containers termianl</p><pre>docker exec -it [container_name or ID] bash</pre><p>Lets check to see if the directory and files were created according to the Dockerfile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*3dmOMkV8BEOPvrKxdpPcRA.png" /><figcaption>Dockerfile</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*blRKqscJLXxsEKHWaOVQcQ.png" /><figcaption>build date of container</figcaption></figure><p>Ladies and Gents that is how you create an image with a Dockerfile. I hope you enjoyed this tutorial. And stay tuned for the next one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af93aee358a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create and modify a DynamoDB table with AWS Cloud 9 using Python]]></title>
            <link>https://medium.com/@Deshone_Henry/how-to-create-and-modify-a-dynamodb-table-with-aws-cloud-9-using-python-9621fff35ea5?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9621fff35ea5</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 14:28:37 GMT</pubDate>
            <atom:updated>2022-04-05T15:29:55.549Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6aAxmu7mYbeGy7WQDsoQ4w.png" /></figure><p>In this project with Level Up In Tech I learned python and how to create a DynamboDB table and add items to it. I am going to walk you through the steps on how to do this so LET’S GO!</p><h3>What is Cloud 9?</h3><p>Cloud 9 is an internet-facing IDE (integrated development environment) that supports several programming languages with a built-in terminal. It provides tools to code build, run, test, and deploy software to the cloud. You can also also push, pull and merge your repositories to GitHub to collaborate with others.</p><h3>Steps to complete this project:</h3><ol><li>Create Cloud9 environment</li><li>Write and run code</li></ol><ul><li>Note: I will provide the code in this project and also a link to my <a href="https://github.com/gr8ness/Open_Source_Code.git">GitHub </a>to fork the repository to your local machine</li></ul><h3>Creating our Cloud9 environment</h3><p>Go to the AWS console and search for Cloud9. Click create environment to get started. Give your environment a name and configure the settings to your liking. I used:</p><ol><li>Create a new EC2 instance</li><li>T2.micro instance type</li><li>Amazon Linux 2 platform</li></ol><p>You can even add you r own VPC under the network settings. Once you’re done click next and create environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*lPYnprZBkZQMJa8Yy6EuHA.png" /></figure><h3>Write and run code</h3><p>To get started with this part we need to install boto3. Boto3 library is the AWS Software Development Kit (SDK) for Python that allows you to create, configure, and manage AWS services using AWS APIs. Boto3 SDK provides not only an object-oriented API but also low-level access to AWS services.</p><p>To install boto3, go to the terminal and use the command</p><pre>pip install boto3</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJMhfBUuQohAS4cBuahldw.png" /></figure><h3>Lets write some code</h3><p>Create a new file and save it with a .py extension “file_name.py” to get started. Remember to always save your file after adding code to it.</p><p><strong>Create a table</strong></p><pre>import boto3</pre><pre>dynamodb = boto3.resource(&#39;dynamodb&#39;, region_name=&#39;us-east-1&#39;)</pre><pre>#creates table with partition and sort key, attributes and provision throughput<br>table = dynamodb.create_table(<br>    TableName=&#39;MyMovies&#39;,<br>    KeySchema=[<br>        {<br>            &#39;AttributeName&#39;: &#39;year&#39;,<br>            &#39;KeyType&#39;: &#39;HASH&#39;  # Partition key<br>            },<br>        {<br>            &#39;AttributeName&#39;: &#39;title&#39;,<br>            &#39;KeyType&#39;: &#39;RANGE&#39;  # Sort key<br>            }<br>        ],<br>        AttributeDefinitions=[<br>            {<br>            &#39;AttributeName&#39;: &#39;year&#39;,<br>            &#39;AttributeType&#39;: &#39;N&#39;<br>            },<br>        {<br>            &#39;AttributeName&#39;: &#39;title&#39;,<br>            &#39;AttributeType&#39;: &#39;S&#39;<br>            },</pre><pre>],<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>Be sure to use the region to that you are located in and associated with your account our you wont be able to find your table.</p><p>Go to your terminal and run the file to create it.</p><pre>python &lt;file_name&gt;.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*lC4EKpQehiufoi5FDkDPQw.png" /><figcaption>Table has been created</figcaption></figure><p><strong>Adding items</strong></p><p>Create a file and save as .json “file_name.json” This adds items to the table with JSON file and it’s a quick way to add items to the table so you don’t have to do it individually.</p><pre>[<br>    {<br>        &quot;year&quot;: 2008,<br>        &quot;title&quot;: &quot;Iron Man&quot;<br>    },<br>    {<br>        &quot;year&quot;: 2010,<br>        &quot;title&quot;: &quot;Iron Man 2&quot;<br>    },<br>    {<br>        &quot;year&quot;: 2013,<br>        &quot;title&quot;: &quot;Iron Man 3&quot;<br>    },<br>    {<br>        &quot;year&quot;: 2012,<br>        &quot;title&quot;: &quot;Marvel&#39;s The Avengers&quot;<br>    }<br>]</pre><p>The code below will import the json file and add them to the table. Create another file and save as .py .</p><pre>import boto3<br>import json</pre><pre>dynamodb = boto3.resource(&#39;dynamodb&#39;, region_name=&#39;us-east-1&#39;)</pre><pre>#name of the table database<br>table = dynamodb.Table(&#39;MyMovies&#39;)<br>#open table to put items<br>with open(&quot;movie_list.json&quot;) as json_file:<br>    movie_list = json.load(json_file)<br>    for movies in movie_list:<br>        year = movies[&#39;year&#39;]<br>        title = movies[&#39;title&#39;]</pre><pre>        print(&quot;Adding movies:&quot;, year, title)<br>        <br>        #putting the attributes in the table<br>        table.put_item(<br>           Item={<br>               &#39;year&#39;: year,<br>               &#39;title&#39;: title,<br>            }<br>        )</pre><p>Run the file again these are the results</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*7tGlyHOwtDCsp5dPjNvc-A.png" /></figure><p><strong>Query the table</strong></p><p>Query an item by the primary key.</p><pre>import boto3<br>from boto3.dynamodb.conditions import Key</pre><pre>dynamodb = boto3.resource(&#39;dynamodb&#39;)<br>table = dynamodb.Table(&#39;MyMovies123&#39;)</pre><pre>response = table.query(KeyConditionExpression=Key(&#39;year&#39;).eq(2019))</pre><pre>print(&quot;The query returned the following items:&quot;)<br>for item in response[&#39;Items&#39;]:<br>    <br>    print(item)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*KpL4xmb9Qkb7dZliLTb5yA.png" /></figure><p><strong>Delete Item</strong></p><p>Delete item by specifying the primary key and sort key.</p><pre>import boto3<br>dynamodb = boto3.resource(&#39;dynamodb&#39;, region_name=&#39;us-east-1&#39;)</pre><pre>table = dynamodb.Table(&#39;MyMovies&#39;)</pre><pre>response = table.delete_item(Key={<br>    &#39;year&#39;: 2008,<br>    &#39;title&#39;: &quot;Iron Man&quot;,<br>})</pre><pre>print(response)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*aCbUcHYc10Ix1M903lSSOA.png" /></figure><p><strong>Delete Table</strong></p><p>Deletes table and adds a catch with the try: function if an occurs when trying to delete the table.</p><pre>import boto3</pre><pre>#deletes dynamoDB table<br>client = boto3.client(&#39;dynamodb&#39;)</pre><pre>try:<br>    resp = client.delete_table(<br>        TableName=&quot;MyMovies123&quot;,<br>    )<br>    print(&quot;Table deleted successfully!&quot;)<br>except Exception as e:<br>    print(&quot;Error deleting table:&quot;)<br>    print(e)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*Tw_ELtFwff2Z739A_gN3qw.png" /></figure><p>And there you have it. You now have the knowledge on how to create and modify a DynamoDB table with Cloud9 using python. All the code in this article can be found at my <a href="https://github.com/gr8ness/Open_Source_Code.git">GitHub</a>.</p><h3>Be Gr8 and do Gr8 things today!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9621fff35ea5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CodePipline and CI/CD?]]></title>
            <link>https://medium.com/@Deshone_Henry/what-is-codepipline-and-ci-cd-b2e8348ecbf3?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2e8348ecbf3</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Mon, 14 Mar 2022 12:00:13 GMT</pubDate>
            <atom:updated>2022-03-14T12:00:13.040Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ISykMhfPzXI-ajP-ajr2Jg.png" /></figure><p>Its an AWS service that is a workflow constructed to describe how code changes and goes through a release process. For example, an application can go through a building, testing and production phase before it is released to the public.</p><p>It is built on the backbone of CI/CD (Continuous Integration and Continuous Deployment) that focuses on having a shared repository between developers that allow them to work on code as a team and is overseen by a product owner. This workflow is continuous and never ending as long as the product is still alive.</p><p>The benefits of using CI/CD:</p><ul><li>Shorter cycle times for the product to be functional to reach the end users.</li><li>No manual process. Automation makes developers work flow easier and efficient</li><li>Code quality. Because the code is shared in a repository, developers are able to detect and fix bugs before it is released to the public.</li></ul><h3>GETTING STARTED</h3><p>Prerequisites</p><ul><li>Git Hub Account with source code</li><li>AWS Account</li></ul><ol><li>Create an S3 bucket</li></ol><p>We need a place to hold our website so we need to create a bucket with a unique name, allow the public to view the objects in out bucket by unchecking “Block all public access” and enable web hosting in the properties section. Link to article on how to create s3 <a href="https://medium.com/aws-tip/how-to-host-a-static-website-using-s3-and-cloudfront-c8b3ed6ece2f">bucket</a>.</p><p>Once our bucket is created we are going to create a bucket policy. Under permissions scroll down and click edit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WLMoPpzD6sXQCZ3cB5P-6w.png" /><figcaption>Copy Bucket ARN</figcaption></figure><p>Enter all the information from the image below. Paste your bucket name in the ARN. Once done click add statement and then click generate policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwWC-HR-epeirfnjQzW3OQ.png" /></figure><p>Once the policy is generated copy the JSON output. It should look like the code below.</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;PublicReadGetObject&quot;,<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: &quot;*&quot;,<br>      &quot;Action&quot;: [<br>        &quot;s3:GetObject&quot;<br>      ],<br>      &quot;Resource&quot;: &quot;arn:aws:s3:::YOURBUCKETNAME/*&quot;<br>    }<br>  ]<br>}</pre><p>Paste the JSON test in the policy section as this will allow our CodePipeline to get objects from the S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ga5r6smUdBGBtB-iBZ4CWw.png" /></figure><p>2. Create CodePipeline</p><p>Go to the search bar and type in CodePipline to create a new pipeline. Give the pipeline a name and click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*eKM5KyoBBbW2KZnN7OJu3g.png" /></figure><p>Next, we are going to select the location where our source code is located and ours is stored in Github.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*uBJHeZ-OC3SD7BiDfidW0w.png" /></figure><p>If your AWS account isn’t linked to Github, click “Connect Github” and follow the instructions on getting connected or select a previous connection if this isn’t your first time. Once we are connected, select the repository name of where the code is located along with the branch and click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*HJqxYZrJsu8_Yrp5-4xQpw.png" /></figure><p>3. Create a project</p><p>Now we are going into the build stage of our pipeline. From here we are going to name the project. In the environment section select:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a3fNBSfWGlHL40El_P4XpQ.png" /></figure><ul><li>Operating System: Ubuntu</li><li>Runtime: Standard</li><li>Image: aws/codebuild/standard:5.0</li><li>Image Version: Always use the latest image</li><li>Environment Type: Linux</li><li>Service Role: New Service Role</li></ul><p>Enter in all the information then click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*WAs83n5-i-7ic5OLm6-jIg.png" /></figure><p>The deployment stage can be skipped but we need it to select our S3 bucket. This where are code is going to be deployed automatically when we make changes. Once the information is entered click next to finally finish your pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*FEhAX35nriZoBOmbUG7_4g.png" /></figure><p>We can check the progress of our pipeline. It will take a few moments to be created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDizH27LViLyRYKKaVhKXg.png" /></figure><p>And check out the s3 bucket to see the repository was pulled from Github. Head to properties of the bucket and click on Bucket website endpoint” to view the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*beZ61GaJMUdFOYEe2pqdQQ.png" /></figure><p>Now we are going to make changes to our code and refresh the webpage to see the changes.</p><p>I made changes to my code using VS Code Studio that’s connected to my Git Hub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_HDVsvr2dqI_gWrpId7mKA.png" /></figure><p>Go back to the code pipeline on the AWS console and you will see the changes happening</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLwKgZL1LSK1eCaPpXGe1g.png" /></figure><p>Here is the updated version of our website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TyOACnL14BmzOuGqQs3oUg.png" /></figure><p>Congrats on creating a CI/CD pipeline!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2e8348ecbf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a highly available website using auto-scaling with AWS]]></title>
            <link>https://medium.com/@Deshone_Henry/how-to-create-a-highly-available-website-using-auto-scaling-with-aws-ec07a83db69e?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec07a83db69e</guid>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[autoscaling]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Tue, 08 Mar 2022 22:31:49 GMT</pubDate>
            <atom:updated>2022-05-21T18:11:31.538Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*srJXimbMeUfvN-h1eUmb3g.png" /></figure><p>How to create a highly available website using auto-scaling with AWS</p><p>Scenario: You are creating a buzz in the Cloud industry and a popular company has contacted you to create a scalable website that is able to handle traffic during their Spring sale.</p><p>To complete this job you are going to use AWS and create an Auto-Scaling group that automatically creates more instances when reaching a threshold and an elastic load balancer to transfer the network load to keep the instance from crashing.</p><p>What is Auto-Scaling<br>Auto Scaling is a service that automatically scales up or down in capacity based on its configuration and It also helps users monitor applications performance.</p><p>Benefits<br>- Monitor applications through Cloud Watch<br>- Predict cost based on needs through metrics<br>- Reliable and scalable</p><p>What is a Load Balancer<br>An Elastic Load Balancer automatically distributes your network workload across multiple targets. Those targets can be an EC2 instance, S3 bucket or an IP address in multiple availability zones.</p><p>Benefits<br>- Increases availability of applications<br>- Configure health checks so only the workload gets sent to healthy targets</p><h4>Steps to complete this task:</h4><h3>1. Create a VPC with subnet</h3><p>To get started we are going to create a VPC with a CIDR and a subnet. Start by going to the console and search for VPC then create VPC. Select “VPC, Subnets, etc.”.</p><p>We will then name the VPC and put 10.0.0.0/16 in “IPv4 CIDR block”.<br>For availability zones select 2 and the number of public subnets is going to be 2 as well. Once that is created we will then create the EC2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*zHdEw0YrHZJ_yef1wSllZQ.png" /></figure><h3>2. Create EC2 and create an Image</h3><p>Create your EC2 and select the AMI that you would like to use. For this instance we are using the free tier “t.2 micro”. Configure the security with inbound traffic to SSH port 20 and HTTP port 80 and they will both use open IP addresses. Once the security group is created click review and launch instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wwXYR3rjYXTI17y7tzJkdw.png" /></figure><p>(LAUNCH CONFIG / ADV SETTING)<br>Next we are going to add a bootstrap to automatically install and setup the Apache Web Server in advanced details under users data. The script below will also create a webpage showing the host IP address.</p><p>Once the EC2 instance is created, go back top the EC2 dashboard and create an image. This creates a copy of our image that we configured during the EC2 setup and will allow us to select the image when we create the launch configuration template for the Auto Scale group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRk5c2kg_IqakJVw8u-lBw.png" /></figure><p>Give the Image a name and a description. We can also tag the image as a tracking option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IywmfcvCrCaJ_5Ye0syobg.png" /></figure><h3>3. Create load balancer</h3><p>Under EC2 on the left side scroll down and select Load Balancers. We are going to create an Application Load Balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qeEj4GQGPzE-MieDTgn9_w.png" /></figure><p>Under basic configuration we are going to name the load balancer select “internet-facing” so we can receive request from clients from the public internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-OzGOi6ajr97wuVS_eIQ-Q.png" /></figure><p>Remember the VPC we created? We‘re now going to select that VPC. Once we check AZ the subnets will populate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k32uTJYsMtZv8CLYEaf9SA.png" /></figure><p>Select your VPC security group if you have one created or create a new one. In this case we are going to create a new security group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*_71gUVERqwvu8GLfX1ivwg.png" /></figure><p>Name the security group, provide a description and attach it to our VPC we previously created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FyiHDpsGXGH5jRAJROHkvA.png" /></figure><p>The inbound rules is going to be HTTP port 80 and SSH port 20 with an open IP address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ZV-KzxvS7cwgtw3mDdEcQ.png" /></figure><p>After the security group is created, go back to the Load Balancer tab and select the security group that we just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*_71gUVERqwvu8GLfX1ivwg.png" /><figcaption>Select new security group</figcaption></figure><p>Next we need to create a target group as this is used to route request/traffic to this particular group which is our instances when load balancing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*00qeUrYPk3OnZgBC0Uo6-A.png" /></figure><p>To configure this select instances</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*JwY5s1eB33GMrErpWpWF9A.png" /></figure><p>We are going to name our target group and select or created VPC. We can also tag this group as well to keep track of it if you have multiple target groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*DDmZFRf7u40Bo7JUGbYPww.png" /></figure><p>After that is created go back to out load balancer tab and select the target group name. Then scroll down to create load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2t8stVat15V6yndd27ruCw.png" /></figure><h3>4. Create Auto Scaling group Launch Template</h3><p>Under the navigation panel to the left select Auto Scaling groups. Select Auto Scaling Groups and click “Create a launch template”. This allows us to create a saved instance configuration for EC2 Auto Scaling which we will then associate it with our Auto Scaling group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*VG9MxNYW4mBykZksTdxWeg.png" /></figure><p>Select the name of the AMI we created at the beginning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*ZgrQV19r55Je-I5LrY5Bew.png" /></figure><p>Choose you instance type. We are going to use the free tier “t.2 micro” instance. Select the name of the security group we created for our VPC and for the key pair, we can either create or choose an existing one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*Wc_qzMFgD2RvhSQD_I0zgg.png" /></figure><p>Under advance network settings select network interface and add our two subnets then change index 0 and 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*0XFXekEFqlgd4RjFU2t7Bg.png" /></figure><p>At the bottom of the page under Advance Details in user data section add the bootstrap script for the Apache web server. Then click create launch template.</p><pre>#!/bin/bash</pre><pre>yum update -y</pre><pre>yum install -y httpd</pre><pre>systemctl start httpd</pre><pre>systemctl enable httpd</pre><h3>5. Create Auto Scale Group</h3><p>Once the template is created go back to the Auto Scale tab , give it a name, and select our template, then click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*qE8Ky-T-e3-YO3oZ9IVAQw.png" /></figure><p>Add our created VPC and subnets and click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*Hv0P9mw7110YDaQyXMRTOw.png" /></figure><p>Now we are going to attach an existing load balancer and choose our target groups that we created. Keep the default Health checks at 300 sec, enable ELB and enable cloud watch monitoring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*nJtH_trG0mFss85VZ4R6BA.png" /></figure><p>We are going to start off with a desired capacity of 2. Meaning that 2 instances will be created and start when we create our Auto Balancer and it will maintain a min 2 instances and will not create more than a max of 5 instances during a working load. Give the scaling policy a name. We will select the metric type to average CPU utilization. Target value is 80 and give the instance 60 sec to include metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*aPgSEFA3xDLVIsr2VjSc_A.png" /></figure><p>We have now created our Auto Scale Group. Have some patience as it will take some time for the status to change to active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-kfoVlCcD2a1BNN2If2Ksw.png" /></figure><p>Check the activity of our instances under the activity tab. One instance was successfully created and the other instance is being created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oOeC02TJINvawHk2f6xIVw.png" /></figure><p>Go to EC2 Dashboard to see our healthy instances and when you stress test your website. ( I opened up multiple tabs of my domain) The auto scaling group will kick in and start creating more instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YIVfk3oG7dhF4VvQ-SVj3Q.png" /></figure><p>Now you know how to create a highly scalable website that automatically scales up and down by web traffic. I hope this training wasn’t too long winded. Stay tuned for a part 2 where I will use cloud formation to do the same thing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec07a83db69e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Use The AWS CLI To Create An EC2 and Launch an Apache Web Server]]></title>
            <link>https://medium.com/@Deshone_Henry/how-to-use-the-aws-cli-to-create-an-ec2-and-launch-an-apache-web-server-d318512bca92?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d318512bca92</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Sun, 20 Feb 2022 02:56:34 GMT</pubDate>
            <atom:updated>2022-02-20T20:16:22.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/237/1*Ek10Pt9oAiBaPaXXcns-Aw@2x.jpeg" /></figure><p>On the road to master the AWS CLI we are going to use it to spin up an EC2 and launch a webserver. This EC2 will start and run a script to automatically install the Apache web server so you don’t have to manually do it yourself when you log into the EC2.</p><h3>Prerequisites:</h3><ul><li>AWS Account</li><li>User with access keys with admin permissions</li></ul><h3>Steps to completion</h3><ol><li>Configure AWS CLI</li><li>Create key pair</li><li>Build EC2 Template</li><li>Create security group with rules</li><li>Create EC2 and run script to start Apache</li></ol><h3>1. Configure AWS CLI</h3><p>We are going to configure the command line as this will give us access to run commands with the right permissions. You enter your Access key and Secret Access key with Default region and output.</p><pre>aws configure</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*p7KJU1tS-neyRyezBFSijg.png" /><figcaption>Enter your Key ID and Secret Access Key</figcaption></figure><h3>2. Create the Key Pair</h3><p>The key pair will allow us to ssh into our EC2. Now there are two ways to write this command. If you are on windows using PowerShell use this command:</p><pre>aws ec2 create-key-pair --key-name KeyPairName --query &#39;KeyMaterial&#39; --output text | out-file -encoding ascii -filepath KeyPairName.pem</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJbdr7kG6-KnaH5yE0YZbw.png" /><figcaption>PowerShell example</figcaption></figure><p>Make sure the keys that are created are in the same path where you run PowerShell or you will get an error.</p><p>Linux and Mac users you will use this command:</p><pre>aws ec2 create-key-pair --key-name <strong>MyKeyPair</strong> --query &#39;KeyMaterial&#39; --output text &gt; <strong>MyKeyPair.pem</strong></pre><p>then you will change the permission on the file to read only</p><pre>chmod 400 keypairname</pre><p>To view the key that was created run the command</p><pre>aws ec2 describe-key-pairs</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*c1UtHUOBF3aiVEgHsM0KVQ.png" /></figure><h3>3. Build EC2 instance Template</h3><p>Before we jump into creating our instance I want you to open up a note taking app or create a file as a quick reference to attach the information we need for our instance.</p><p>The things we need to build our instance:</p><ul><li>AMI (amazon machine image)</li><li>Instance type (CPU, memory and storage)</li><li>VPC ID (virtual network)</li></ul><p>Go to the AWS console and search for EC2. To the left of the screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WuW2WIKtB0Rw_H3-qWyzjQ.png" /><figcaption>Copy either the (x86) or (Arm) AMI</figcaption></figure><p>We are going to choose our instance and it will be t2.mirco as this is the free tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2h4nxiSbeti_RS0mtAtJjg.png" /><figcaption>Copy just “t2.micro” to your note pad</figcaption></figure><p>To get the name of our VPC we are going to go back to the terminal and use the command:</p><pre>aws ec2 describe-vpcs</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*Rb84xyi69qNsEucaMjdCNw.png" /><figcaption>This is the default VPC. Copy to notes</figcaption></figure><h3>4. Create Security Group with Rules</h3><p>The security group holds rules for incoming and outgoing network traffic. We are going to name our security group and attach the VPC ID</p><pre>aws ec2 create-security-group --group-name MySecurityGroup --description &quot;My security group&quot; --vpc-id vpc-XXXXXXXX</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wsrQ5uCwcofYh9F88xWWUA.png" /><figcaption>Copy Security Group to notes</figcaption></figure><p>Next we need to allow traffic to come in through port 22 for SSH and port 80 for HTTP when the Apache server is created. Make sure you add the security group id. For CIDR (Classless inter-domain routing) will contain either your IP address i.e. <em>25.234.8.222/32</em> or leave it open with 0.0.0.0/0</p><p>To find your IP address you can use</p><pre>curl https://ipv4.lafibre.info/ip.php or curl -4 icanhazip.com</pre><p>Commands for ports 22 and 80</p><pre>aws ec2 authorize-security-group-ingress --group-id sg-xxxxxxxxxxx --protocol tcp --<strong>port 22 </strong>--cidr 0.0.0.0/0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*144-Zho6yuk0PlvTj8U3aw.png" /></figure><pre>aws ec2 authorize-security-group-ingress --group-id sg-xxxxxxxxxxx --protocol tcp --<strong>port 80 </strong>--cidr 0.0.0.0/0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4sfz4XsXSuU9DrE-A6KsXw.png" /></figure><h3>5. Create EC2 and run script to start Apache</h3><p>Now that we have added all the details to our security group, its time to build our script and run the commands to create our instance.</p><p>To create the Apache script, use a text editor (nano or vim) and name it <em>&lt;script_name&gt;.sh</em> copy and paste the script below into your file</p><pre>#!/bin/bash</pre><pre>yum update -y #install all updates</pre><pre>yum install httpd -y #install Apache web server</pre><pre>systemctl start httpd #start the Apache web server</pre><pre>systemctl enable httpd #enable httpd auto-start after reboot</pre><p>Next create the instance with this command</p><pre>aws ec2 run-instances --image-id <strong>ami-xxxxxxxx</strong> --count 1 --instance-type t2.micro --key-name <strong>Your_KeyPair</strong> --security-group-ids <strong>sg-xxxxxxxx</strong> --user-data file://<strong><em>&lt;script_name&gt;.sh</em></strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GZpLOwKp30tb0zQylbM2wQ.png" /></figure><p>View your instance to make sure that it is running. It takes sometime for it to fully operational and it should display running when its done.</p><pre><strong>aws ec2 describe-instances</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*MzY8CsAlylKUa4l2FkxVDw.png" /></figure><p>Now its time to log into the instance. To get the IP address of the instance use command:</p><pre>aws ec2 describe-instances  --query &#39;Reservations[*].Instances[*].{PublicIP:PublicIpAddress}&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*maxJmk9OIyJxlYithSRjnA.png" /></figure><p>Login as ec2-user with this command:</p><pre>ssh -i &lt;KEYPAIRNAME&gt; ec2-user@&lt;IPADDRESS&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*kSZOxEtO4FgXFgrbmE1g1Q.png" /><figcaption>Result of a successful login</figcaption></figure><p>To see if our script worked run:</p><pre>sudo systemctl status httpd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*qSsGHGhf2zwuTU-y6uwl-A.png" /><figcaption>Running is a good sign</figcaption></figure><p>Now we grab the IP address of our EC2 and paste it into the browser to get a successful webpage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*loAvkU_qC0EKjDHijyAUeQ.png" /><figcaption>Note that the http address will work and not time out</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d318512bca92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Host a Static Website Using S3 and CloudFront]]></title>
            <link>https://awstip.com/how-to-host-a-static-website-using-s3-and-cloudfront-c8b3ed6ece2f?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8b3ed6ece2f</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloudfront]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Sat, 12 Feb 2022 16:30:12 GMT</pubDate>
            <atom:updated>2022-02-16T07:09:08.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZcHHO4Em6dZ7FA87kM4j3g.png" /></figure><p><strong>Scenario:</strong></p><p>You have been contracted to help a company called Too Legit to Quit Fitness deploy a static website that is low-cost and quickly accessible in North America. To complete this contract, you have decided to use AWS services, S3 and CloudFront to host and deploy their webpage.</p><h3><strong>Why use S3 to serve a static site?</strong></h3><p>In my last article, we briefly touched on what <a href="https://medium.com/@Deshone_Henry/using-aws-cli-to-create-users-groups-and-s3-buckets-44216b8caef4">S3</a> is, but now I’m going to give a couple of reasons as to why you should use S3 to serve a static website.</p><ul><li><strong>Simplicity:</strong> S3 is a convenient method for hosting a website because it is simple and you’re able to launch a website within minutes.</li><li><strong>Cheap:</strong> With its simplicity, it’s also cheap to host for smaller-scale websites that don’t drive a lot of traffic. If you want to host a website that will see high traffic, then you would use CloudFront.</li></ul><h3><strong>What is CloudFront?</strong></h3><p>CloudFront is a CDN (content delivery network) service that delivers static and dynamic websites quickly to end-users through the use of edge locations (data centers that handle cached information that improves latency).</p><h4>What Are The Benefits of Using CloudFront?</h4><p>CloudFront provides 3 benefits:</p><ul><li><strong>Reduced latency: </strong>Through CloudFront, a user watching a video about <a href="https://www.youtube.com/watch?v=TtqVWY-6R7k&amp;t=401s">Level Up In Tech</a> on a static website can quickly access this content in California due to the creator of the CloudFront delivering their data to the west coast region to be quickly accessible.</li><li><strong>Security: </strong>Not only is it fast but it’s also secure by using encryption and access control to secure data and protects against DDoS using AWS Shield.</li><li><strong>Cost-Efficient: </strong>CloudFront provides a few ways to cut down the cost</li></ul><ol><li><a href="https://aws.amazon.com/cloudfront/pricing/?loc=ft#AWS_Free_Usage_Tier">Pricing packages</a>: Free Tier, On-demand Pricing, and Custom Pricing</li></ol><p>2. Cache-Control: You can use the browser cache of users to reduce the load on your CloudFront servers by reducing the transfer-out data</p><p>3. Compress data: CloudFront uses Gzip to compress static files which will also cut costs as it’s delivered to the end-users in smaller data sizes.</p><p>4. <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html">Price Class</a>: Determines the edge location to cache your data. There are 3 Tiers; Price Class All, Price Class 200 and Price Class 100. Choosing a lower Price Class will result in higher latency but will also help you save money in the long run if you know that you don’t need to deploy your content across the globe.</p><h3>Now lets get to work</h3><p>Steps complete this contract:</p><ol><li>Create S3 bucket</li><li>Create and upload index.html</li><li>Create a CloudFront Distribution to host our website</li></ol><p><strong>Create your S3 bucket</strong></p><p>Go to S3 in the AWS console and create your bucket. Remember that the bucket name has to be unique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*4Ty6LWVTR1ark5LIQLthWQ.png" /></figure><p>In order for clients to reach the site, we are going to allow the public access to the files in our bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*LH7MFtmvoatcozcAOwOY4w.png" /></figure><p>Scroll to the bottom and click “Create Bucket”.</p><p>Now that the bucket is created we are going to upload our website to the bucket by clicking your bucket name. From here you can upload your files multiple ways. You can click “Add files”, “Add folder” or drag and drop your items. Once you’re done click Upload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*IoUVXXBB93FABKXbJYRWJA.png" /></figure><p>Click on the properties tab and scroll to the bottom to enable static website hosting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y1ioNNh5A5eoyKQ5O5U6ow.png" /></figure><p>We have a few options here to select. We are going to enable hosting for the bucket, leave Host Static Website as it is because we aren’t going to redirect requests to another object. For the index document, we’re going to name your index which is your default or home page. The error document is optional as this will load an error page if you try to access a file that isn’t available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*mpamCrgj0RDEVI6-Zagceg.png" /></figure><p>Scroll to the bottom again on the properties page and copy the link because we are going to need this later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JM96VAmCYVM5GyJxsrZ52Q.png" /><figcaption>Copy the Link</figcaption></figure><p>Click on your bucket URL link to check it out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*mLCelq5CzORRhpcM_ML5cw.png" /><figcaption>Error :(</figcaption></figure><p>This happened because we have not allowed permission for the files to be accessible through the webserver. Go to the permissions tab of your bucket, scroll down to “Bucket Policy” and click edit. We are going to edit the policy of the bucket to allow access to all of the files in our bucket instead of manually going to each file individually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*haXtC11maGAKGDQ9GMoqlw.png" /></figure><p>Paste the code below into the bucket policy</p><pre>{<br> &quot;Version&quot;: &quot;2012-10-17&quot;,<br> &quot;Statement&quot;: [<br>  {<br>   &quot;Sid&quot;: &quot;PublicReadGetObject&quot;,<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Principal&quot;: &quot;*&quot;,<br>   &quot;Action&quot;: [<br>    &quot;s3:GetObject&quot;<br>   ],<br>   &quot;Resource&quot;: [<br>    &quot;arn:aws:s3:::BUCKET_NAME/*&quot;<br>   ]<br>  }<br> ]<br>}</pre><h3>Create CloudFront Distribution</h3><p>Enter the CloudFront service from the search bar. Once you are on the CloudFront page click “Create a CloudFront Distribution”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qTFyx4m0vtH50UiuatiqfQ.png" /></figure><p>From here we are going to paste our Origin Domain name that we copied earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*56qrOL55YWLulqXctqZG-A.png" /></figure><p>To make our bucket more secure we are going to create an Origin Access Identity. This will allow CloudFront to make calls to our bucket with its unique ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*RsWROd5KQFpU7qc-JwQMFw.png" /></figure><p>To save cash we want to select the right Price Class. The one highlighted is <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html">Price Class 100</a> and it is the most cost-efficient option and it will deliver our content the fastest in the North American region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*PKL-4-JusVh-ROmsGTxTJA.png" /></figure><p>Go back to the CloudFront distribution page and wait for the status to say enabled and for the last modified date to display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hs966nKkbmz_-2cguwDEjA.png" /></figure><p>To check that our webpage is properly running, select our CloudFront name, copy the domain name and paste it into the web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DjjGvGv7nm83EW3LRmuRPg.png" /></figure><p>If set up correctly your new webpage is created and it’s time to get paid for your hard work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*9ZRc0DwvoJxgZbZzApujjQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8b3ed6ece2f" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/how-to-host-a-static-website-using-s3-and-cloudfront-c8b3ed6ece2f">How to Host a Static Website Using S3 and CloudFront</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[Using AWS CLI to Create, Users, Groups and S3 Buckets]]></title>
            <link>https://medium.com/@Deshone_Henry/using-aws-cli-to-create-users-groups-and-s3-buckets-44216b8caef4?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/44216b8caef4</guid>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[bucketsdotcofeatures]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Sun, 06 Feb 2022 20:58:39 GMT</pubDate>
            <atom:updated>2022-02-12T04:30:01.574Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using AWS CLI to Create Users, Groups and S3 Buckets</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sjvRMWMMpIOMZw1B258MvA.jpeg" /></figure><p>By the end of this lesson you are going to be able to create a new user and add the user to a group that will have the permission to create S3 buckets all through AWS CLI. Now this is for people that like to get their hands dirty with the command line and feel super techie and cool. So grab your cup of coffee and lets go!</p><p>The prerequisites to complete this project:</p><ol><li>AWS Root account</li><li>Terminal with <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">AWS CLI</a></li></ol><p>These are the steps we are going to take to complete this lesson:</p><ol><li>Create a AWS user and access key</li><li>Create login profile</li><li>Create our “Admin” group and attach S3 policy</li><li>Add User to “S3admin” group</li><li>Create S3 Bucket</li></ol><p>First things first head over to your terminal and we are going to create our User and access key with this command:</p><pre><em>aws iam create-user — user-name USERNAME</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*aWC5W8GH7ufIIUn8h7IVCA.png" /><figcaption>Give the user a name</figcaption></figure><p>Next, create the users access key. This will allow the user to make programmatic requests to AWS</p><pre><em>aws iam create-access-key — user-name USERNAME</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*V_IuZ0Wkw9YsEQU_nzBZlQ.png" /><figcaption>Access key for our user</figcaption></figure><p><strong>NOTE:</strong> Be sure to copy and store the secret access key because once its lost you can not retrieve it and will have to create a new access key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rqcVjshvRc9EDVdwNFui5Q.png" /></figure><p>To view your created user, user the command</p><pre><em>aws iam list-users</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*scX2nFF9rUmeGYx9Ncsc-A.png" /></figure><p><strong>User Name:</strong> It is a friendly user name that we specify while creating the IAM user</p><p><strong>User ID:</strong> It is a unique id of each IAM user</p><p><strong>ARN:</strong> It is the Amazon resource name to identify the user</p><p><strong>Create Date:</strong> It is the user creation date in date-time format</p><p><strong>Tip:</strong> When typing your command you can hit Tab twice to auto complete or bring up different options for the command.</p><p>Lets create the login profile for the user so they can access the AWS Console. To do that use the command below:</p><pre><em>aws iam create-login-profile — user-name testuser1 — password USERPASSWORD — no-password-reset-required</em></pre><p>For best security practice you want to have the user rest their password when logging in but for this lesson we will set “no” for password reset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rqcVjshvRc9EDVdwNFui5Q.png" /><figcaption>(the account ID will be located in the AWS console user )</figcaption></figure><pre><em>aws iam create-group — group-name GROUPNAME</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*V-GN7k7Kd2-whs7KBftQ3Q.png" /></figure><p>Now its time to create a group that will be called “S3admin” and then we’re going to attach a policy to the group so anyone added to the group will have the privilege to run different commands that pertain to S3. But to find the policy ARN access resource name you will go to the AWS console IAM:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B80FUHeG939PAQ6CAU5gjQ.png" /><figcaption>Search for policies</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UF1x3ORyDQjukCOley5mOQ.png" /><figcaption>Copy ARN Link</figcaption></figure><p>Attach the policies to the group:</p><pre><em>aws iam attach-group-policy — group-name GROUPNAME — policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JVzrwfx2Uf4xYuFN3P5z0A.png" /></figure><p>One more policy to add to the group to give access to AWS CLI</p><pre><em>aws iam attach-group-policy — group-name S3admin — policy-arn arn:aws:iam::aws:policy/AWSCloudShellFullAccess</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_3z1fhvEuH9fv8-gqZ7sw.png" /></figure><p>Now that the policies are attached, you can view the policies that were added to the group using the command:</p><pre><em>aws iam list-attached-group-policies — group-name S3admin</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*lXvnEt1-85Aw5UVWjTbodQ.png" /></figure><p>Its time to add our user to the group:</p><pre><em>aws iam add-user-to-group — user-name USERNAME — group-name GROUPNAME</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*PckNgHt55EBbjZMJme214w.png" /></figure><p>Use the command below to view the user added to our group:</p><pre><em>aws iam list-groups-for-user — user-name testuser</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*N-QqUn2EBOWkhYHlIA6AfA.png" /></figure><p>From here we are going to log into our “testuser” and go into the AWS CLI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*pJh3z4gXreKUif6iXe5Otg.png" /><figcaption>The account ID will be located in the AWS console IAM User</figcaption></figure><h3>AWS S3</h3><p>AWS S3 is Simple Storage Service. This service is used to hold files called objects and those objects are stored inside of directories called buckets where you can hold anything from a static website, pictures etc. With the S3 service you can create, delete, copy and move objects, buckets and more. Ok lets create some buckets.</p><p>One thing about buckets is that they need to have a unique name. So get creative when you create them.</p><p>To make a bucket use the command:</p><pre><em>aws s3 mb s3://UNIQUEBUCKETNAME</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*aRkNnA3IBcd7mWrzQWqokA.png" /></figure><p>Congrats! You’ve now learned how to create a user that was added to a special group that has privileges to create S3 buckets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44216b8caef4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Fork A Repository In Github]]></title>
            <link>https://medium.com/@Deshone_Henry/how-to-fork-a-repository-in-github-a31c26c27439?source=rss-1603ed13b15f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a31c26c27439</guid>
            <category><![CDATA[repositories]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Deshone Henry]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 16:29:50 GMT</pubDate>
            <atom:updated>2022-01-29T18:20:10.456Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3cpMYLJp0i-X7Y1S" /><figcaption>Photo by <a href="https://unsplash.com/@synkevych?utm_source=medium&amp;utm_medium=referral">Roman Synkevych</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>What is git? Git manages content and is able to keep track of a version or many versions of a file/project called version or source control. The main reason that you will use Git is that it will allow multiple people to work on the same project and Git will track every modification done to the project. Once you are finished making changes, you can merge them into the original project.</p><p>This tutorial will teach you how to install git, setup the configuration files, clone, pull, and push repositories to Github so that the world or your team can view and work on your project.</p><p>Before we get started, below are the basic requirements to complete this project:</p><ul><li>Internet</li><li>Github account</li><li>Linux</li><li>Terminal</li><li>Sudo privileges</li></ul><h3>How To Install And Setup Git On Your Linux System (CentOS 7)</h3><p>To install git you will need to run<strong> </strong><strong><em>yum install git </em></strong>and<strong> e</strong>nter your password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*M6sMhQNLuDBlSKKim3SqRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jANhatmiDsXs9zyxoIpSDQ.png" /><figcaption>Type <strong>Yes </strong>to confirm Install. Packages are being installed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aUT4xXQAjHr6-Ic_cWjBJg.png" /><figcaption>Install complete!</figcaption></figure><p>Now that git is installed. We will now create a repository.</p><p>The<strong> </strong><strong><em>git init &lt;dir name&gt;</em> </strong>command creates a repository or “directory” with a hidden directory called <strong>.git </strong>inside of your working directory that holds scripts that will allow you to run git commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/101/1*6pa9BUB2nbl9z2se5Odt_g.png" /><figcaption>Hidden .git inside of our directory</figcaption></figure><h3>Configuring Files</h3><p>In order for others to know who created and made changes in this repository, you must add your information to the configuration files using the command</p><ul><li><strong><em>git config</em></strong></li></ul><p>We are going to add two pieces of information to the config files: user name and email address</p><ul><li><strong><em>git config — global user.name &lt;enter name&gt;</em></strong> (adds user name)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*O62_guUPDaB8GfRF8-7Q4w.png" /></figure><ul><li><strong><em>git config — global user.email &lt;email address&gt;</em></strong> (adds email address)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*8Ezwo9ScOYGbb-U1Ij7ZPQ.png" /></figure><p>To list the information we have put in those files you will run the command:</p><ul><li><strong><em>git config — global — list</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*DjxR_H05vtIRfOsBqNN7ww.png" /><figcaption>username and email address listed</figcaption></figure><h3><strong>Forking A Repository On Github</strong></h3><p>Now let’s get to the juicy stuff!</p><p>What is forking and how does it work? To Fork a project you are basically cloning someone else’s original project from Github and adding it to your repository. This will allow you to modify the project without interfering with the owner’s original project.</p><ul><li>Head over to Github and create an account if you don’t have one already.</li><li>Next search for the repository you would like to fork.</li><li>Click the fork button in the upper-righthand corner to add to your repository.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*OAQd1H6MG9FZZchK6seLJw.png" /></figure><p>To add this forked project to our local machine, we will go back into our terminal and type the command</p><ul><li><strong><em>git clone &lt;link of the project&gt; &lt;local repo path&gt;</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*pGIsURtXicII0kSllx86PA.png" /><figcaption>The project is being cloned to our machine</figcaption></figure><p>Now we can modify this project to our liking on our local machine by adding, editing, or deleting files.</p><p>Once we are done with making changes, we need to track the changes and add a comment about what we did with the command:</p><ul><li><strong><em>git commit -a -m “comment goes here”</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*ljL5m-vqSpm7vSBFXoJO8w.png" /></figure><p>Adding comments will create a log of what we have done and others can follow and understand the changes.</p><p>We can then check the status of our repo to make sure that we have added all the files we want to push to our upstream. To do this we will use the command:</p><ul><li><strong><em>git status</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*5iDjtJlUwcCMkyIeCwTnWg.png" /><figcaption>We are now ready to push our repo to Github</figcaption></figure><h3>Push And Pulling A Request</h3><p>If we would like to contribute to the owner’s project we would then create a pull request to ask the owner to upload or merge our work to the original project. But first, we need to create a <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token">security token</a> so we can push our project and changes to Github.</p><p>Once our token is created, we are ready to push our project. To show the remote servers that are being tracked in our repo and where we are going to push our repo use the command:</p><ul><li><strong><em>git remote -v</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*E8tGk-8LxqsXf-9aH0yN0Q.png" /></figure><p>Push the repo to Github:</p><ul><li><strong><em>git push -u origin</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*y7W09QsqoFWT9fmtxiOdAg.png" /></figure><p>Now that the repo is pushed we will see the changes added to Github along with the comments we added from the terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*uzqyboTf4dQduzx03Vqtug.png" /><figcaption>the README.md file has been added</figcaption></figure><p>Next, we will go to the owner’s repo on Github and pull a request to tell others that are on the project about the changes we pushed to the branch. Once a request is made the owner will look over our work and approve it to merge our contributions to their original project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9P2TNv6-YJjegRMQw_qdw.png" /></figure><p>Type a message to the owner and click “Create pull request”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*lJpfNoPt-JMYOUOzw4ABpw.png" /></figure><p>Congratulations! You‘ve just learned how to Fork a repository! Now go fork it up on Github while I go fork some food from my wife’s plate. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a31c26c27439" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>