<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Leighiam Virrey</title>
    <description>The latest articles on DEV Community by Leighiam Virrey (@shakeldv).</description>
    <link>https://dev.to/shakeldv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F864089%2F2b528216-8fcd-43ad-9501-20652da01a17.jpeg</url>
      <title>DEV Community: Leighiam Virrey</title>
      <link>https://dev.to/shakeldv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shakeldv"/>
    <language>en</language>
    <item>
      <title>AWSCloudChallenge</title>
      <dc:creator>Leighiam Virrey</dc:creator>
      <pubDate>Wed, 25 May 2022 23:03:53 +0000</pubDate>
      <link>https://dev.to/shakeldv/awscloudchallenge-cm</link>
      <guid>https://dev.to/shakeldv/awscloudchallenge-cm</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46wszpmpi9oatn3fxb92.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46wszpmpi9oatn3fxb92.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Starting off my blog about the &lt;a href="https://cloudresumechallenge.dev/docs/the-challenge/aws/" rel="noopener noreferrer"&gt;Cloud Resume Challenge&lt;/a&gt;. This is to detail every step I took to complete the challenge.&lt;/p&gt;

&lt;h2&gt;
  
  
  HTML and CSS
&lt;/h2&gt;

&lt;p&gt;I started off my journey with taking 2 weeks trying to make my resume. It had been a bit since I renewed it but I got it finished.&lt;/p&gt;

&lt;p&gt;I started off writing barebones html and then trying to add it with some CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8k9nbzd1c7vjy5z40pwp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8k9nbzd1c7vjy5z40pwp.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not looking too good as I wanted, I just gave up and faced the reality I am not going to be a great front-end website designer anytime soon. I started browsing for templates and I landed on this template from styleshout.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj3u546zc7b0p3863onav.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj3u546zc7b0p3863onav.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I re-arranged everything to fit my aesthetics and to something I can proudly run with.&lt;/p&gt;

&lt;h2&gt;
  
  
  Website Back-End
&lt;/h2&gt;

&lt;p&gt;With the front-end of the website being done, I started tackling the infrastructure back-end of the website. This is where it started to get fun and challenging. &lt;/p&gt;

&lt;p&gt;The Challenge suggested using SAM in AWS to deploy infrastructure, IaC (Infrastructure as Code). I opted out to try and use Terraform, since I have been eyeing it for awhile but I have not really found a project to actually start learning it with.&lt;/p&gt;

&lt;p&gt;This is where I found this YouTube channel &lt;a href="https://www.youtube.com/watch?v=vwn77cUarTs&amp;amp;list=PL8HowI-L-3_9bkocmR3JahQ4Y-Pbqs2Nt" rel="noopener noreferrer"&gt;Will Brock&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Totally gave me a great understanding of Terraform and how to utilize and write the code. After about half a day watching his videos I started utilizing the &lt;a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs" rel="noopener noreferrer"&gt;Terraform Documentation&lt;/a&gt; to start writing the code myself.&lt;/p&gt;

&lt;p&gt;It took me a bit to get everything written out but I got it going. I did have some trouble validating my domain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ab0g7wvnfvgz8u0jewo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ab0g7wvnfvgz8u0jewo.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DNS WAS THE WORST. I HAD SO MUCH TROUBLE TRYING TO GET THAT SETUP hahaha. Troubleshooting was a bit difficult since it took 5 minutes to never if it will go up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfr10rjfc36v10gklsl1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfr10rjfc36v10gklsl1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;BUT AFTER THAT I GOT IT TO FINALLY WORK THOUGH! Setting up the Route53 (DNS) and CloudFront rewarded my website with the shiny letter "S" to my HTTP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgebtz6d6ehwg9c4c3nqa.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgebtz6d6ehwg9c4c3nqa.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I started finishing off the rest of the backend code and doing tests. I managed to finish it up and make it clean and easy to go back to if I need to make changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq1f7fg622r2a574gb2z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbq1f7fg622r2a574gb2z.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Github Actions (CI/CD Pipeline) and Coding
&lt;/h2&gt;

&lt;p&gt;When everything seems to have started working perfectly, I started to implement my CI/CD pipeline. This is where I got started with GitHub Actions. Note, Terraform statefiles is needed to keep the configurations of Terraform made infrastructure. This needed to be present to know what Terraform has done before. I configured Terraform to use an S3 bucket as a storage for that statefile so Terraform can access the config files when I move it from local machine to a GitHub Repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frn1ig35425sau7ktd8ze.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frn1ig35425sau7ktd8ze.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I finished off the resume website with adding the visitor count to the front page. The visitor count is suppose to be stored in a database. That is where AWS DynamoDB comes in. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4tsh1gfbnericr71h1pn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4tsh1gfbnericr71h1pn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We needed to interact with the database so we utilized AWS Lambda to update and get the amount of visitors within the database whenever the Lambda function is fired up. Here is the code I wrote with python to do that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import boto3

table_name = "visitor-count"
dynamodb = boto3.resource("dynamodb")
db_client = boto3.client("dynamodb")
table = dynamodb.Table(table_name)


def increment_visitor():
    response = db_client.update_item(
        TableName=table_name,
        Key = {
            'Primary Key': {
                'N': "0"
            }
        },
        ExpressionAttributeValues = { ":inc": {"N": "1"}},
        UpdateExpression = "ADD visitor :inc"
    )


def retrieve_visitor_count():
    item = table.get_item(
        Key = {
            "Primary Key": 0
        }
    )
    visitcount = (item["Item"])["visitor"]
    return visitcount


def lambda_handler(event, context):
    increment_visitor()
    return retrieve_visitor_count()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, We needed something to interact with the code in a secure way. That is where AWS API Gateway came in. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bnhh8p59hmt1ovjg4wq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bnhh8p59hmt1ovjg4wq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The API is exposed to the web for the written Javascript to interact with in the website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F41cb91ztondy0aa5sbh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F41cb91ztondy0aa5sbh5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Finally! I have been procrastinating trying to do this challenge for awhile. I am so glad and happy I was able to finish it and have a finished product to show off haha.&lt;/p&gt;

&lt;p&gt;This challenged pushed me to learn JavaScript, Terraform, and utilize AWS cloud resources. I learned that DNS is still a pain troubleshooting it as a help desk technician as well as building a website. I learned how easy it is to deploy resource with code than utilizing the AWS console (A lot more clicks).&lt;/p&gt;

&lt;p&gt;Please check out the website at &lt;a href="//leighiamvirrey.com"&gt;leighiamvirrey.com&lt;/a&gt; the source code is in my &lt;a href="https://github.com/ShakeLDV" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. Here are the links &lt;a href="https://github.com/ShakeLDV/AWS-CloudResumeChallenge-FrontEnd" rel="noopener noreferrer"&gt;frontend&lt;/a&gt; and &lt;a href="https://github.com/ShakeLDV/AWS-CloudResumeChallenge-BackEnd" rel="noopener noreferrer"&gt;backend&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
