<?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>Forem: Riyaz Ahmed</title>
    <description>The latest articles on Forem by Riyaz Ahmed (@riyazahmed14).</description>
    <link>https://forem.com/riyazahmed14</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%2F1071530%2F6df87761-b1e8-4bf8-8de4-a6bfc867e998.png</url>
      <title>Forem: Riyaz Ahmed</title>
      <link>https://forem.com/riyazahmed14</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/riyazahmed14"/>
    <language>en</language>
    <item>
      <title>Hosting a Static Website on AWS</title>
      <dc:creator>Riyaz Ahmed</dc:creator>
      <pubDate>Tue, 27 Jun 2023 14:00:18 +0000</pubDate>
      <link>https://forem.com/riyazahmed14/hosting-a-static-website-on-aws-4mmi</link>
      <guid>https://forem.com/riyazahmed14/hosting-a-static-website-on-aws-4mmi</guid>
      <description>&lt;p&gt;In this blog, I will be writing a step by step guide on how I created a basic / simple static website hosted on AWS:&lt;/p&gt;

&lt;p&gt;The first thing we needed to do is to register a domain. This can be done on Route 53. Route 53 is a scalable and highly available domain name system (DNS) web service offered by Amazon Web Services (AWS). It provides domain registration, DNS routing, and health checking capabilities, allowing users to manage and route internet traffic to their applications or resources. &lt;/p&gt;

&lt;p&gt;From this service, I was able to register a domain with the name "RiyazsProject.net"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fpb6G541--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s44v75s9mbt1t1ft184d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fpb6G541--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s44v75s9mbt1t1ft184d.png" alt="Image description" width="800" height="942"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;side note&lt;/em&gt;&lt;br&gt;
( While most organisations will use .com as it is the most popular, I opted to go for .net, for pricing reasons  ఠ_ఠ … )&lt;/p&gt;

&lt;p&gt;One small thing to mention, AWS kindly offers to allow auto renewal on a yearly basis as well as informing you that this option is on closer to the renewal period. This is great for large organisations who plan to have their webpage up and running throughout the years. However in this case, I will not be choosing this option.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TlW5mmDF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pinyd1ixl8t1d0lu6o0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TlW5mmDF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pinyd1ixl8t1d0lu6o0x.png" alt="Image description" width="781" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After some confirmation and verification (and some patience..), we finally have our official domain name registered to "riyazproject.net". &lt;/p&gt;

&lt;p&gt;Now that we have our domain, the next step is to create a bucket on S3. Amazon S3 (Simple Storage Service) is a cloud-based storage service provided by Amazon Web Services (AWS). It offers highly scalable, durable, and secure object storage, allowing individuals and businesses to store and retrieve vast amounts of data over the internet. While S3 is widely used for its  various purposes such as content storage, data archival and data lakes, in this case we will be using it for hosting a static webpage. &lt;/p&gt;

&lt;p&gt;There are a few key things we need to note when creating our bucket. The first being the region the bucket is created in. Due to my location, I will be creating this bucket in EU (London) eu-west-2 in order to reduce latency as much as possible. &lt;br&gt;
The second important thing to mention is allowing public access to my bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_6j619v4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iubvakpavp861cpb3jdc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_6j619v4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iubvakpavp861cpb3jdc.png" alt="Image description" width="800" height="703"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Allowing public access as well as checking the box below allows for the contents of my bucket to be accessible to the public. If my bucket was private, it would not allow anyone to access my webpage (which defeats the whole purpose to why we're here...)&lt;/p&gt;

&lt;p&gt;Once our bucket has been created, I am now able to add the contents needed in order for my webpage to be accessible. I will first start by adding a basic html file (which I was kindly gifted), into my S3 bucket. &lt;br&gt;
Now that I have the contents within my bucket, I now need to enable the bucket for static website hosting as well as having the right permissions for users to access it. This can be done by going into the properties of the bucket and editing "static website hosting"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YfPA27YH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vy7zymugtxk2mt5vtd0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YfPA27YH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vy7zymugtxk2mt5vtd0.png" alt="Image description" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The bucket is now successfully able to host a static website, however we aren't done just yet. We still need to configure the permissions settings before we send it off. This can be configured on the permissions tab of the bucket.&lt;br&gt;
We need to attach a bucket policy that will allow users to only READ the contents within the bucket. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CGPTlRvl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym47htkky8wqpumk1a74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CGPTlRvl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym47htkky8wqpumk1a74.png" alt="Image description" width="800" height="614"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The permission in the image above consists of a JSON file that represents an IAM policy that grants public read access to all objects within the S3 bucket named "riyazproject.net". This means that any user or entity, including anonymous users, can retrieve (read) objects from this specified S3 bucket.&lt;/p&gt;

&lt;p&gt;Our website is officially hosted on Amazon S3! But we have one small detail left..&lt;br&gt;
Unfortunately, our website has a URL that is provided by AWS, not our custom URL. In order to tackle this, we need to redirect riyazproject.net to this S3 bucket. &lt;/p&gt;

&lt;p&gt;To do this, I will return to Route 53 and add an additional record. This ensures the bucket will be connected to the Route 53 domain name. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8mvT45yY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3dskflolij94ok8z161k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8mvT45yY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3dskflolij94ok8z161k.png" alt="Image description" width="800" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We start off by choosing an A record type. Next, I opt to use an Alias, this allows me to route traffic to the S3 endpoint. I select Simple routing as it is directed only one way and now the record has been created. &lt;/p&gt;

&lt;p&gt;Once the record has been set, our webpage officially has its URL set to the domain! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8rBCucpN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zukrhyunvqka00gur8v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8rBCucpN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zukrhyunvqka00gur8v.png" alt="Image description" width="488" height="247"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you very much for reading my blog post. This small project was to showcase my skills and knowledge of AWS. I appreciate you taking the time to read my work. If you used this to create and host your own static webpage, I hope it helped!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Capstone Project - Cloud Architecture</title>
      <dc:creator>Riyaz Ahmed</dc:creator>
      <pubDate>Mon, 26 Jun 2023 17:03:56 +0000</pubDate>
      <link>https://forem.com/riyazahmed14/capstone-project-cloud-architecture-1d90</link>
      <guid>https://forem.com/riyazahmed14/capstone-project-cloud-architecture-1d90</guid>
      <description>&lt;p&gt;The Capstone project is quite a formidable task, making even quite experienced users work hard on how to overcome this scenario.&lt;br&gt;
We find ourselves working at a Social Research organisation that has a website that allows users to look up various data. Over the past few years, the website has grown in popularity and begun experiencing traffic issues as well as complaints about how slow it is. Additionally, there have been attempted ransomware attacks and security breaches. This is where we come in. We are here to design an infrastructure for the company's website that follows best practises and improves upon the existing architecture.&lt;/p&gt;

&lt;p&gt;This blog is a record of how I overcame the Capstone project.&lt;/p&gt;

&lt;p&gt;What we started with&lt;br&gt;
At the start, we were given a diagram of the current environment and how the company's website was laid out:&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%2Fka4pjckny3q8aou6k6tf.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%2Fka4pjckny3q8aou6k6tf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This current architecture shows us how the bastion host has been set up as well as its additional security groups placed in multiple subnets.&lt;br&gt;
This current architecture does not follow best practises as it is not highly available or does not scale automatically.&lt;/p&gt;

&lt;p&gt;The solution&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%2Fj5fc0afofky6wjujb7sj.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%2Fj5fc0afofky6wjujb7sj.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The solution I came up with not only solves the initial problem of being unable to scale automatically but also makes it more secure and highly available. By storing data within a MySQL RDS Multi-AZ database in a private subnet across multiple availability zones (AZ), it allows for more users around the world to access the website without experiencing traffic delays. Additionally, this meant that this solution had failover, allowing the secondary database to take over if the primary one were to fail or become unavailable.&lt;/p&gt;

&lt;p&gt;The Application Load Balancer (ALB) is placed in front of the autoscaling group, which is linked to both applications in each AZ, allowing for a smoother runtime. Admin users would be able to access the applications by using SSH through the bastion host and access or store data.&lt;/p&gt;

&lt;p&gt;We start off by downloading a SQL dump file provided by AWS that gives us the necessary tools in order for our applications as well as our databases to run.&lt;br&gt;
We create an internet-facing Application Load Balancer and attach it to two public subnets, as well as attaching the respective security groups. As we were setting up the autoscaling group, which would be behind the ALB, it gave us the option to attach it to both availability zones as well as both subnets (public and private). This would allow the infrastructure to be highly available.&lt;/p&gt;

&lt;p&gt;Once the two had been created, it allowed the application to also be created within the process. After configuring the security groups, I was finally able to access the website. However, not only did it not look like a proper website, it was not functioning like one either.&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%2Fklhfb49d335fzgciinie.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%2Fklhfb49d335fzgciinie.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The website would list what users may want to find information about, but it would not be able to list any of the necessary information. The website would return a connection error.&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%2Fdh9lwsxtrpvaftutrhj9.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%2Fdh9lwsxtrpvaftutrhj9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next step was to create a multi-RDS database. This would allow for a secure and highly available way to store and access data that users could access without experiencing traffic.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;note&lt;/em&gt; &lt;br&gt;
(I had used a burstable class for this instance as it would allow for performance to exceed regular use if there was a need for it as we were already experiencing traffic issues.)&lt;/p&gt;

&lt;p&gt;While the database was being created, I used this time to go into Systems Manager and create the parameters needed in the parameter store:&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%2F6kpi2klf2aiw2lbo7s2n.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%2F6kpi2klf2aiw2lbo7s2n.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
Once the database was created, it was time to connect to it through the application we created earlier. This was done through the Bastion host and accessing it through the Access Key and Secret Access Key provided by AWS. Upon entering, I was able to import the SQL dump file, which allowed the database to have the data it needed. This was done by listing within the file to ensure that Countrydatadump.sql was inside of it. After the commands mysql -u username -p database_name &amp;lt; file.sql and entering the required password that I had set earlier when creating the RDS database, it was successfully able to ingest all the data it needed.&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%2F2tiawvb85wjmb2qn77qm.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%2F2tiawvb85wjmb2qn77qm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upon successfully launching the application, the last thing to do was to check the website one last time and see if users could access the data they were looking for. After all my hard work, it was finally a success.&lt;/p&gt;

&lt;p&gt;The Capstone project really pushed me to think outside the box and utilise all the skills I acquired during my journey as a trainee cloud engineer. This was something I had never experienced before, and I look forward to working on more projects like this in the future. I plan to update my blog throughout my career to not only allow readers to see my work but also to use it as a portfolio to show myself and others how I have evolved over the coming years with each project.&lt;/p&gt;

&lt;p&gt;I appreciate you taking the time to read this!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>aws</category>
      <category>cloud</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
