<?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 Ronald Maroria on Medium]]></title>
        <description><![CDATA[Stories by Ronald Maroria on Medium]]></description>
        <link>https://medium.com/@ron.maroria?source=rss-8b83013beda8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*9xIkOdOKZS-h64Xt</url>
            <title>Stories by Ronald Maroria on Medium</title>
            <link>https://medium.com/@ron.maroria?source=rss-8b83013beda8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 02:17:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ron.maroria/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[Building a 2-tier for Adventure Works]]></title>
            <link>https://medium.com/@ron.maroria/building-a-2-tier-for-adventure-works-da44970c58d7?source=rss-8b83013beda8------2</link>
            <guid isPermaLink="false">https://medium.com/p/da44970c58d7</guid>
            <dc:creator><![CDATA[Ronald Maroria]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 01:26:37 GMT</pubDate>
            <atom:updated>2026-07-31T01:26:37.006Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>In this project, we have a requirement to create cloud infrastructure to host a website for Adventure Works, a company that specializes in organizing global tours and adventures. The new website is to use Joomla as their conatent management system(CMS).</p><p>To simplify this deployment, we will begin with bare-bones one ec2 instance and one RDS instance in the foundational level, then we will add “Advanced” level, where we will add more components and finally “Complex”, where will add even more components.</p><h4>Foundational</h4><ol><li><strong>Set Up Networking</strong>:</li></ol><ul><li>Create a custom VPC with an Internet Gateway.</li></ul><p>From the VPC creation menu, create a VPC with 10.0.0.0/16 CIDR IPv4.</p><ul><li>Create two public subnets and two private subnets.</li><li>Set up appropriate routing:</li><li>Public subnets should route traffic to the Internet Gateway.</li><li>Private subnets should route traffic locally to the vpc.</li><li>Ensure the EC2 instance is in a public subnet and the RDS instance is in a private subnet.</li></ul><ol><li><strong>Set Up the Web Tier</strong>:</li></ol><ul><li>Launch an Ubuntu EC2 instance in one of the public subnets to host the Joomla application.</li></ul><ol><li><strong>Set Up the Database Tier</strong>:</li></ol><ul><li>Launch a MySQL RDS instance in one of the private subnets.</li><li>Create the Joomla database and user.</li></ul><ol><li><strong>Install and Configure Joomla</strong>:</li></ol><ul><li>Follow the instructions for the Joomla Installation</li></ul><ol><li><strong>Security and Best Practices</strong>:</li></ol><ul><li>Ensure the security group settings allow appropriate traffic between the EC2 instance and the RDS instance.</li><li>Hint: look into which port RDS MySQL uses</li><li>Remove the Joomla installation directory after setup for security.</li></ul><ol><li><strong>Testing:</strong></li></ol><ul><li>Test the website and post a sample blog to verify.</li></ul><ol><li><strong>Documentation and Reporting</strong>:</li></ol><ul><li>Document the setup process, configurations, and any issues encountered.</li><li>Be sure to include the benefits of the two-tier architecture for Adventure Works.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da44970c58d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Jenkins to AWS using IAC — Terraform]]></title>
            <link>https://medium.com/@ron.maroria/deploying-jenkins-to-aws-using-iac-terraform-9bc811a5c4dd?source=rss-8b83013beda8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bc811a5c4dd</guid>
            <dc:creator><![CDATA[Ronald Maroria]]></dc:creator>
            <pubDate>Tue, 05 Aug 2025 05:40:43 GMT</pubDate>
            <atom:updated>2025-08-05T05:40:43.203Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying Jenkins to AWS using IAC — Terraform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/80/1*bT57MOs0Zzc0r74C8K2oeg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bc811a5c4dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Jenkins on AWS Ubuntu as IAC using Terraform]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ron.maroria/deploying-jenkins-on-aws-ubuntu-as-iac-using-terraform-2aa2d5cefc2e?source=rss-8b83013beda8------2"><img src="https://cdn-images-1.medium.com/max/600/1*nX2LjewwPGL_HoeZlVTjoQ.png" width="600"></a></p><p class="medium-feed-snippet">We have seen how to deploy an application using aws GUI tools as well as AWS Cloudformation, an Infrastructure As Code(IAC) tool.</p><p class="medium-feed-link"><a href="https://medium.com/@ron.maroria/deploying-jenkins-on-aws-ubuntu-as-iac-using-terraform-2aa2d5cefc2e?source=rss-8b83013beda8------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ron.maroria/deploying-jenkins-on-aws-ubuntu-as-iac-using-terraform-2aa2d5cefc2e?source=rss-8b83013beda8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2aa2d5cefc2e</guid>
            <dc:creator><![CDATA[Ronald Maroria]]></dc:creator>
            <pubDate>Tue, 05 Aug 2025 05:39:22 GMT</pubDate>
            <atom:updated>2025-08-05T05:39:22.102Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Using a CI/CD pipeline to automate application deployment in AWS]]></title>
            <link>https://medium.com/@ron.maroria/using-a-ci-cd-pipeline-to-automate-application-deployment-in-aws-3ddbf42db85a?source=rss-8b83013beda8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ddbf42db85a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ci-cd-devops]]></category>
            <category><![CDATA[codepipeline]]></category>
            <dc:creator><![CDATA[Ronald Maroria]]></dc:creator>
            <pubDate>Thu, 22 May 2025 04:51:43 GMT</pubDate>
            <atom:updated>2025-05-22T04:51:43.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*2UtIqi5yZIftAde7bqRxXg.png" /><figcaption>AWS CodePipeline data flow</figcaption></figure><p><strong>Introduction</strong></p><p>At the heart of modern application development is continuous integration and continuous deployment (CI/CD). By implementing CI/CD, teams can deliver applications in timely fashion and more efficiently. It also helps to reduce human error since because developers are able to collaborate and review/approval each other’s changes. The CI/CD running automatically ensure speed in delivery and consistency.</p><p>In my project, the requirement was to use AWS native tools to automate the deployment of a web application. The AWS tools to use are: AWS CodeCommit as a repository, codebuild for the build stage and codepipeline for automatic deployment.</p><p>For codepipeline to run, we need to set up a repository in codecommit and a project in codebuild. Once we have those set up, then we need to invoke them while setting up codepipeline. During the setup of codepipeline, we are also going to setup an Amazon Eventbridge event that monitors for any changes in the codecommit repository. Any such changes will automatically trigger codepipeline to run and reploy to the deploy provider, which in my was Amazon S3.</p><p>Further, we added two more stages. Since our initial deployment is to a development S3 bucket, we still needed to deploy to production. There is a requirement that before a change is deployed to production, it needs to be reviewed and approved by an authorized party. For this, we added two more stages after the development deployment stage. The first stage to add is named “Approve” and for this, we chose “Manual Approval” as the provider, and in the second additional stage, the production s3 bucket is chosen as the deployment provider. Optionally, a link to the development bucket is provided in case the approver would like to review what is being deployed before approving.</p><p>With the “Approve” stage and “Deploy_to_Prod” stages added, every time the pipeline runs, it will stop at the “Approve” stage and wait for an approval before proceeding to the final “Deploy_to_prod” stage. The manual approval was also a requirement from the customer.</p><p><strong>Challenges</strong></p><p>During implementation of this project, there were obstacles that I needed to overcome in order to execute successfully:</p><ol><li>I discovered that in the provided buildspec file, a command was referring to a wrongly spelled file name that was provided by the customer. So I needed to correct that.</li><li>The second issue I encountered is that the buildspec had a .yaml extension which was causing problems with the execution. I needed to change that extension to .yml.</li><li>It is very important to pay attention to the region you are in when creating a resource because many resources have a regional scope and will not interact with other resources in a different region.</li></ol><p><strong>Conclusion</strong></p><p>Overall, I can say that building this pipeline was highly satisfying for me. I am a step closer to gaining respectable skills as a Devops Engineer. There are other ways I plan to implement in order to improve on this project by employing other AWS tools and even third party ones as well. In a future article I will detail that process.</p><p>All in all, the importance of CI/CD in modern application development and deployment cannot be overstated. It is absolutely central to whole process.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ddbf42db85a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using AWS Cloudformation to create and scale a one-tier application]]></title>
            <link>https://medium.com/@ron.maroria/using-aws-cloudformation-to-create-and-scale-a-2-tier-application-2caf9a4cb60b?source=rss-8b83013beda8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2caf9a4cb60b</guid>
            <category><![CDATA[aws-security-group]]></category>
            <category><![CDATA[autoscaling-group]]></category>
            <category><![CDATA[target-group]]></category>
            <category><![CDATA[aws-cloudformation]]></category>
            <category><![CDATA[application-load-balancer]]></category>
            <dc:creator><![CDATA[Ronald Maroria]]></dc:creator>
            <pubDate>Fri, 21 Mar 2025 05:42:27 GMT</pubDate>
            <atom:updated>2025-03-23T01:58:43.666Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*CSdPGqLWQLgnfZHOjEHHSQ.png" /></figure><h4>Introduction</h4><p>So far we have been spinning up infrastructure manually by going to the AWS console and creating them one at a time. This method works well initially but is not suitable when the solution becomes large. AWS has a service known as AWS Cloudformation which is a tool that engineers can use to automate this process. Creating infrastructure this way is known as Infrastructure as code(IAC). With IAC, you give specifications about what infrastructure you want to create in a template and Cloudformation creates it for you. It is much more scalable, eliminates human error and easily repeatable.</p><p>For this project, I have my requirements divided into three categories: foundational, Advanced and complex. Let’s start with the foundational requirement.</p><p><strong>FOUNDATIONAL:</strong></p><p>Create and successfully deploy a CloudFormation Template that deploys the following resources.</p><ol><li>An EC2 instance with an Apache Webserver.</li><li>Be sure to useUser Data to do the install of Apache</li><li>Can be deployed to the default public subnet(default VPC).</li><li>A Webserver Security Group with the needed permissions</li></ol><p>For this we will use the template here.</p><pre>AWSTemplateFormatVersion: 2010-09-09<br>Description: CDA03 template<br>Parameters:<br>  VpcId:<br>    Type: String<br>    Description: VPC id<br>    Default: vpc-0a5ee13289d4666ed<br>  ImageId:<br>    Type: String<br>    Description: &#39;Linux 2 AMI for N. Virginia us-east&#39;<br>    Default: ami-08b5b3a93ed654d19<br>  InstanceType:<br>    Type: String<br>    Description: Choosing t2 micro because it is free<br>    Default: t2.micro<br>  KeyName:<br>    Description: SSH Keypair to login to the instance<br>    Type: AWS::EC2::KeyPair::KeyName<br>    Default: [REDACTED]<br><br>Resources:<br>  Ec2Instance:<br>    Type: AWS::EC2::Instance<br>    Properties:<br>      InstanceType: t2.micro<br>      ImageId: ami-08b5b3a93ed654d19<br>      KeyName: AMI2_Apache<br>      SecurityGroupIds:<br>        - EC2SecurityGroup<br>      UserData:<br>          Fn::Base64: |<br>            #!/bin/bash<br>            sudo yum -y update<br>            sudo yum install -y httpd <br>            sudo systemctl start httpd<br>            sudo systemctl enable httpd<br>            sudo echo &quot;&lt;h1&gt;Hello World from $(hostname -f)&lt;/h1&gt;&quot; &gt; /var/www/html/index.html<br><br>  EC2SecurityGroup:<br>    Type: AWS::EC2::SecurityGroup<br>    Properties:<br>        GroupDescription: Allow http and ssh to host <br>        SecurityGroupIngress:<br>        - IpProtocol: tcp<br>          FromPort: 80<br>          ToPort: 80<br>          CidrIp: 0.0.0.0/0<br>        - IpProtocol: tcp<br>          FromPort: 22<br>          ToPort: 22<br>          CidrIp: 0.0.0.0/0 </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YFfWihCavAVnr4GusNVqOw.png" /></figure><p>I chose options as shown above and uploaded my template from above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YmBkB3dOv-THTrh_Y-7sPA.png" /></figure><p>I have provided the stack name for my stack but the rest of the settings have been populated for me from the template. I will leave everything else at default and proceed to create the stack.</p><p>After a few minutes the stack shows as created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qw1tQ1N7ZmSPVeIr8ycCww.png" /></figure><p>Let’s head over to EC2 instances list to see if there is any newly created instance. And voila, the instance is there and opening a browser connection from the browser opens the webpage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*7xD79rUFP7CZcFoWDP7Ucg.png" /></figure><p>This concludes the ‘foundational’ requirement for this project. Now I will go ahead and delete the just created stack and all the resource that the template will be deleted as well. Next we move on the “advanced” requirement.</p><p><strong>ADVANCED:</strong></p><p>Create and successfully deploy a CloudFormation Template that deploys the following resources.</p><ol><li>Create an autoscaling group using t2.micro instances. All instances should have apache installed on each instance with a custom web page.</li><li>The autoscaling min and max should be 2 and 5.</li><li>The Autoscaling Group should span to at least 3 of the default public subnets.</li><li>Deploy a Webserver Security Group with the necessary permissions.</li></ol><p>For this ‘Advanced requirement’, I will update my cloudformation template resource section with this code and create the stack:</p><pre>AWSTemplateFormatVersion: 2010-09-09<br>Description: CDA03 template<br>Parameters:<br>  VpcId:<br>    Type: String<br>    Description: VPC id<br>    Default: vpc-0a5ee13289d4666ed<br>  ImageId:<br>    Type: String<br>    Description: &#39;Linux 2 AMI for N. Virginia us-east&#39;<br>    Default: ami-08b5b3a93ed654d19<br>  InstanceType:<br>    Type: String<br>    Description: Choosing t2.micro because it is free<br>    Default: t2.micro<br><br><br>Resources:<br>  EC2SecurityGroup:<br>    Type: AWS::EC2::SecurityGroup<br>    Properties:<br>      GroupDescription: &#39;SSH and Port 80&#39;<br>      VpcId: !Ref VpcId<br>      SecurityGroupIngress:<br>        - IpProtocol: tcp<br>          FromPort: 22<br>          ToPort: 22<br>          CidrIp: 0.0.0.0/0<br>        - IpProtocol: tcp<br>          FromPort: 80<br>          ToPort: 80<br>          CidrIp: 0.0.0.0/0<br><br>  myASG:<br>    Type: AWS::AutoScaling::AutoScalingGroup<br>    Properties:<br>      LaunchTemplate:<br>        LaunchTemplateId: !Ref myLaunchTemplate<br>        Version: !GetAtt myLaunchTemplate.LatestVersionNumber<br>      MaxSize: &#39;5&#39;<br>      MinSize: &#39;2&#39;<br>      VPCZoneIdentifier:   <br>        - subnet-058324a83ce4974d1<br>        - subnet-0277ca85e92e7ae19<br>        - subnet-0630fa4f2eb8f0007<br><br>  myLaunchTemplate:<br>    Type: AWS::EC2::LaunchTemplate<br>    Properties:<br>      LaunchTemplateName: !Sub ${AWS::StackName}-launch-template<br>      LaunchTemplateData:<br>        ImageId: !Ref ImageId<br>        InstanceType: !Ref InstanceType<br>        SecurityGroupIds:<br>        - !Ref EC2SecurityGroup<br>        UserData:<br>          Fn::Base64: !Sub |<br>            #!/bin/bash<br>            #!/bin/bash<br>            sudo yum -y update<br>            sudo yum install -y httpd <br>            sudo systemctl start httpd<br>            sudo systemctl enable httpd<br>            sudo echo &quot;&lt;h1&gt;Hello World from $(hostname -f)&lt;/h1&gt;&quot; &gt; /var/www/html/index.html<br>        KeyName: [REDACTED]</pre><p>With the templated edited as above, to create the stack, grab the subnet IDs from our default VPC to specify them in the Autoscaling group section. After updating the template accordingly, we create the stack. The instances are created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UfMG8THfypH54Ci8RnFD3Q.png" /></figure><p>From the template, we are also supposed to have Apache installed. So let us test:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*iZ_vdRCP5Cp_KXnwZs7HZA.png" /></figure><p>and</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*6ICSEFz6TLl1PRmB1Xn91Q.png" /></figure><p>So the requirement from the “advanced” section is met.</p><p>Before we continue with the complex requirement we will go ahead and delete this stack.</p><p><strong>COMPLEX:</strong></p><p>Create a CloudFormation Template that deploys the following resources. Note that the environment should look familiar from last week’s project.</p><ol><li>Create a VPC with cidr 10.10.0.0/16 (Without using the VPC &amp; More option)</li><li>Create three public subnets with 10.10.1.0/24 &amp; 10.10.2.0/24 &amp; 10.10.3.0/24</li><li>Create an autoscaling group using t2.micro instances. All instances should have apache installed on each instance with a custom web page. Ensure the autoscaling group is using the public subnets from #2.</li><li>The autoscaling min and max should be 2 and 5 and desired to 3.</li><li>Create an Application Load Balancer to distribute traffic to the autoscaling group.</li><li>Create web server security group that allows inbound traffic from HTTP from your Application Load Balancer. As a security precaution, no one should be able to use the public ip of your webserver to reach your website. All users should be using the Application Load Balancer.</li><li>Create a load balancer security group that allows inbound traffic from HTTP from 0.0.0.0/0.</li><li>Use the DNS url of the Application Load Balancer in a browser to verify you can reach your site.</li></ol><p>For this requirements, I am still editing my template from above to have this code:</p><pre>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Description: CloudFormation Template to Create a VPC with 3 Subnets and an Auto Scaling Group<br>Parameters:<br>  InstanceType:<br>    Type: String<br>    Default: t2.micro<br>    Description: EC2 instance type<br>    AllowedValues:<br>      - t2.micro<br>      - t2.small<br>      - t2.medium<br>    ConstraintDescription: t2.micro<br><br>  AMIID:<br>    Type: AWS::EC2::Image::Id<br>    Description: The AMI ID for the EC2 instances.<br>    Default: ami-08b5b3a93ed654d19  # AMI ID for N. Virginia<br>    ConstraintDescription: ami-08b5b3a93ed654d19<br><br>Resources:<br>  # VPC<br>  MyVPC:<br>    Type: AWS::EC2::VPC<br>    Properties:<br>      CidrBlock: &quot;10.10.0.0/16&quot;<br>      EnableDnsSupport: &quot;true&quot;<br>      EnableDnsHostnames: &quot;true&quot;<br>      Tags:<br>        - Key: Name<br>          Value: &quot;MyVPC&quot;<br>  # Internet Gateway<br>  MyInternetGateway:<br>    Type: AWS::EC2::InternetGateway<br>    Properties:<br>      Tags:<br>        - Key: Name<br>          Value: &quot;MyInternetGateway&quot;<br><br>  # Attach Internet Gateway to VPC<br>  MyVPCGatewayAttachment:<br>    Type: AWS::EC2::VPCGatewayAttachment<br>    Properties:<br>      VpcId: !Ref MyVPC<br>      InternetGatewayId: !Ref MyInternetGateway<br><br>  # PublicSubnet1<br>  PublicSubnet1:<br>    Type: AWS::EC2::Subnet<br>    Properties:<br>      VpcId: !Ref MyVPC<br>      CidrBlock: &quot;10.10.1.0/24&quot;<br>      AvailabilityZone: !Select [ 0, !GetAZs &#39;&#39; ]<br>      MapPublicIpOnLaunch: &quot;true&quot;<br>      Tags:<br>        - Key: Name<br>          Value: &quot;PublicSubnet1&quot;<br><br>  # PublicSubnet2<br>  PublicSubnet2:<br>    Type: AWS::EC2::Subnet<br>    Properties:<br>      VpcId: !Ref MyVPC<br>      CidrBlock: &quot;10.10.2.0/24&quot;<br>      AvailabilityZone: !Select [ 1, !GetAZs &#39;&#39; ]<br>      MapPublicIpOnLaunch: &quot;true&quot;<br>      Tags:<br>        - Key: Name<br>          Value: &quot;PublicSubnet2&quot;<br><br>  # PublicSubnet3<br>  PublicSubnet3:<br>    Type: AWS::EC2::Subnet<br>    Properties:<br>      VpcId: !Ref MyVPC<br>      CidrBlock: &quot;10.10.3.0/24&quot;<br>      AvailabilityZone: !Select [ 2, !GetAZs &#39;&#39; ]<br>      MapPublicIpOnLaunch: &quot;true&quot;<br>      Tags:<br>        - Key: Name<br>          Value: &quot;PublicSubnet3&quot;<br>  # Route Table for Public Subnets<br>  PublicRouteTable:<br>    Type: AWS::EC2::RouteTable<br>    Properties:<br>      VpcId: !Ref MyVPC<br>      Tags:<br>        - Key: Name<br>          Value: &quot;PublicRouteTable&quot;<br><br>  # Create a route table for the public subnets<br>  MyRouteTable:<br>    Type: AWS::EC2::RouteTable<br>    Properties:<br>      VpcId: !Ref MyVPC<br>      Tags:<br>        - Key: Name<br>          Value: MyRouteTable<br><br>  # Create a route to the internet through the Internet Gateway<br>  MyRoute:<br>    Type: AWS::EC2::Route<br>    Properties:<br>      RouteTableId: !Ref MyRouteTable<br>      DestinationCidrBlock: 0.0.0.0/0<br>      GatewayId: !Ref MyInternetGateway<br><br>  # Associate the route table with all subnets<br>  MySubnetRouteTableAssociation1:<br>    Type: AWS::EC2::SubnetRouteTableAssociation<br>    Properties:<br>      SubnetId: !Ref PublicSubnet1<br>      RouteTableId: !Ref MyRouteTable<br><br>  MySubnetRouteTableAssociation2:<br>    Type: AWS::EC2::SubnetRouteTableAssociation<br>    Properties:<br>      SubnetId: !Ref PublicSubnet2<br>      RouteTableId: !Ref MyRouteTable<br><br>  MySubnetRouteTableAssociation3:<br>    Type: AWS::EC2::SubnetRouteTableAssociation<br>    Properties:<br>      SubnetId: !Ref PublicSubnet3<br>      RouteTableId: !Ref MyRouteTable<br><br><br>  # Security Group for the Instances<br>  InstanceSecurityGroup:<br>    Type: AWS::EC2::SecurityGroup<br>    Properties:<br>      GroupDescription: &quot;Allow SSH and HTTP access&quot;<br>      VpcId: !Ref MyVPC<br>      SecurityGroupIngress:<br>        - IpProtocol: tcp<br>          FromPort: &#39;22&#39;<br>          ToPort: &#39;22&#39;<br>          CidrIp: &#39;0.0.0.0/0&#39; # SSH access from anywhere<br>        - IpProtocol: tcp<br>          FromPort: &#39;80&#39;<br>          ToPort: &#39;80&#39;<br>          SourceSecurityGroupId: !Ref ALBSecurityGroup # HTTP access from Load Balancer<br><br># Security Group for ALB (Allow inbound HTTP traffic from anywhere on port 80)<br>  ALBSecurityGroup:<br>    Type: AWS::EC2::SecurityGroup<br>    Properties:<br>      GroupDescription: &quot;Allow inbound HTTP traffic from anywhere&quot;<br>      VpcId: !Ref MyVPC<br>      SecurityGroupIngress:<br>        - IpProtocol: tcp<br>          FromPort: &#39;80&#39;<br>          ToPort: &#39;80&#39;<br>          CidrIp: 0.0.0.0/0  # Allow traffic from the internet to the ALB on port 80<br><br>  # Launch Template for the Auto Scaling Group<br>  MyLaunchTemplate:<br>    Type: AWS::EC2::LaunchTemplate<br>    Properties:<br>      LaunchTemplateName: &quot;MyLaunchTemplate&quot;<br>      LaunchTemplateData:<br>        InstanceType: !Ref InstanceType<br>        ImageId: !Ref AMIID<br>        SecurityGroupIds:<br>          - !Ref InstanceSecurityGroup<br>        KeyName: Lin_01_key<br>        UserData:<br>          Fn::Base64: !Sub |<br>            #!/bin/bash<br>            sudo yum update -y<br>            sudo yum install -y httpd<br>            sudo service httpd start<br>            sudo chkconfig httpd on<br>            sudo echo &quot;&lt;h1&gt;Hello World from $(hostname -f)&lt;/h1&gt;&quot; &gt; /var/www/html/index.html<br><br>  # Create an Auto Scaling Group<br>  MyAutoScalingGroup:<br>    Type: AWS::AutoScaling::AutoScalingGroup<br>    Properties:<br>      VPCZoneIdentifier:<br>        - !Ref PublicSubnet1<br>        - !Ref PublicSubnet2<br>        - !Ref PublicSubnet3<br>      LaunchTemplate:<br>        LaunchTemplateId: !Ref MyLaunchTemplate<br>        Version: !GetAtt MyLaunchTemplate.LatestVersionNumber  # Reference the latest version number of the Launch Template<br>      MinSize: &#39;2&#39;<br>      MaxSize: &#39;5&#39;<br>      DesiredCapacity: &#39;3&#39;<br>      HealthCheckType: ELB  # Use ELB Health Checks for the ASG<br>      HealthCheckGracePeriod: 300  # 5 minutes grace period before health checks start<br>      TargetGroupARNs:<br>        - Ref: MyTargetGroup  # Link the Target Group to the Auto Scaling Group<br>      Tags:<br>        - Key: Name<br>          Value: AutoScalingInstance<br>          PropagateAtLaunch: true<br><br><br># Application Load Balancer<br>  MyLoadBalancer:<br>    Type: AWS::ElasticLoadBalancingV2::LoadBalancer<br>    Properties:<br>      Name: &quot;MyLoadBalancer&quot;<br>      Subnets:<br>        - !Ref PublicSubnet1<br>        - !Ref PublicSubnet2<br>        - !Ref PublicSubnet3<br>      SecurityGroups:<br>        - !Ref InstanceSecurityGroup<br>      LoadBalancerAttributes:<br>        - Key: idle_timeout.timeout_seconds<br>          Value: &#39;120&#39;<br>      Scheme: internet-facing<br>      Type: application<br>      IpAddressType: ipv4<br><br>  # Create a Target Group for EC2 instances<br>  MyTargetGroup:<br>    Type: AWS::ElasticLoadBalancingV2::TargetGroup<br>    Properties:<br>      Name: MyTargetGroup<br>      Port: 80  # Modify as necessary for your app<br>      Protocol: HTTP<br>      VpcId: !Ref MyVPC<br>      TargetType: instance<br><br>  # Load Balancer Listener<br>  MyListener:<br>    Type: AWS::ElasticLoadBalancingV2::Listener<br>    Properties:<br>      DefaultActions:<br>        - Type: fixed-response<br>          FixedResponseConfig:<br>            StatusCode: 200<br>            ContentType: &quot;text/plain&quot;<br>            MessageBody: &quot;Healthy!&quot;<br>      LoadBalancerArn: !Ref MyLoadBalancer<br>      Port: 80<br>      Protocol: HTTP<br><br>  # Listener Rule for Load Balancer<br>  MyListenerRule:<br>    Type: AWS::ElasticLoadBalancingV2::ListenerRule<br>    Properties:<br>      Actions:<br>        - Type: forward<br>          TargetGroupArn: !Ref MyTargetGroup<br>      Conditions:<br>        - Field: path-pattern<br>          Values:<br>            - &quot;/&quot;<br>      ListenerArn: !Ref MyListener<br>      Priority: 10<br><br>Outputs:<br>  VPCId:<br>    Description: &quot;The VPC ID&quot;<br>    Value: !Ref MyVPC<br><br>  PublicSubnet1Id:<br>    Description: &quot;The Public Subnet 1 ID&quot;<br>    Value: !Ref PublicSubnet1<br><br>  PublicSubnet2Id:<br>    Description: &quot;The Public Subnet 2 ID&quot;<br>    Value: !Ref PublicSubnet2<br><br>  PublicSubnet3Id:<br>    Description: &quot;The Public Subnet 3 ID&quot;<br>    Value: !Ref PublicSubnet3<br><br>  AutoScalingGroupName:<br>    Description: &quot;The name of the Auto Scaling Group&quot;<br>    Value: !Ref MyAutoScalingGroup<br><br>  LoadBalancerDNSName:<br>    Description: &quot;The DNS Name of the Load Balancer&quot;<br>    Value: !GetAtt MyLoadBalancer.DNSName<br><br>  InternetGatewayId:<br>    Description: &quot;The ID of the Internet Gateway&quot;<br>    Value: !Ref MyInternetGateway</pre><p>After creating the stack from this template, it shows created successfully:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tOdMdBg32aDSyEIJzckXBA.png" /></figure><p>This is a diagram showing the desired final infrastructure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*JtF4xpiuCamPXQE0YKxVig.png" /></figure><p>Let us verify whether the resources were created as we intended:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9914Xhly_S8-aEzcyhLmxA.png" /></figure><p>Now let us go and grab the Load balancer DNS name and test reachability:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*137wI0ya1ElRwNqHPTwI1g.png" /></figure><h4>Troubleshooting</h4><p>we expect the load balancer DNS name to respond on the browser and display the contents of the user file we used to create the Apache web servers. But it is not, so let us find out why:</p><ol><li>I checked the security group for the Instance and noticed that where I need to allow traffic from the Load balancer, I didn’t have that, so I am changing that. Check again and there is no change.</li><li>Next, I will check what my target groups are doing:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hGs8tJiRMN8KSu5ZXW2S4g.png" /></figure><p>So, the targets are unhealthy and I need to figure out why.</p><p>3. Next, I edited my health check at the autoscaling groups to include ALB(by default it runs the healthchecks only the EC2 Instances only.). I also noticed that I had assigned the wrong security group to the load balancer as well, so I fixed that as well. My instances became healthy after these 2 fixes.</p><p>This is the change I made for the ALB security group section:</p><p>from</p><pre>MyLoadBalancer:<br>    Type: AWS::ElasticLoadBalancingV2::LoadBalancer<br>    Properties:<br>      Name: &quot;MyLoadBalancer&quot;<br>      Subnets:<br>        - !Ref PublicSubnet1<br>        - !Ref PublicSubnet2<br>        - !Ref PublicSubnet3<br>      SecurityGroups:<br>        - !Ref InstanceSecurityGroup<br>      LoadBalancerAttributes:<br>        - Key: idle_timeout.timeout_seconds<br>          Value: &#39;120&#39;<br>      Scheme: internet-facing<br>      Type: application<br>      IpAddressType: ipv4</pre><p>to</p><pre>MyLoadBalancer:<br>    Type: AWS::ElasticLoadBalancingV2::LoadBalancer<br>    Properties:<br>      Name: &quot;MyLoadBalancer&quot;<br>      Subnets:<br>        - !Ref PublicSubnet1<br>        - !Ref PublicSubnet2<br>        - !Ref PublicSubnet3<br>      SecurityGroups:<br>        - !Ref ALBSecurityGroup<br>      LoadBalancerAttributes:<br>        - Key: idle_timeout.timeout_seconds<br>          Value: &#39;120&#39;<br>      Scheme: internet-facing<br>      Type: application<br>      IpAddressType: ipv4</pre><p>Testing my load balancer, it is responding and is distributing traffic to all 3 instances with each refresh:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*bEmxWFTNgJtnc_5HDsP-JQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*xr3Y3tqW29T03Y1hDjWSwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*0Ikf0wLe_bdTq0OQ6QWstg.png" /></figure><p>This is the expected result and concludes my project. Seeing ‘success’ on this one really got my adrenaline high and now I can’t wait to get started on the next project.</p><p>If you liked reading this, then please follow me and also consider giving me up to 50 claps. I will be writing more about upcoming projects. Until then, peace.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2caf9a4cb60b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating an application from on-prem to AWS]]></title>
            <link>https://medium.com/@ron.maroria/migrating-an-application-from-on-prem-to-aws-654e9e68fd9a?source=rss-8b83013beda8------2</link>
            <guid isPermaLink="false">https://medium.com/p/654e9e68fd9a</guid>
            <dc:creator><![CDATA[Ronald Maroria]]></dc:creator>
            <pubDate>Wed, 12 Mar 2025 07:58:38 GMT</pubDate>
            <atom:updated>2025-03-12T07:58:38.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*bYtWWbJdoH5XGsPD0rQ5Fg.png" /></figure><p>We have a scenario where a bank needs to completely migrate their application from on-premises to AWS. The bank wants to reap the benefits of being in AWS. Some of the advantages of AWS as opposed to on-premises include but are not limited to the below:</p><p><strong>Scalability</strong></p><p>When hosting on-premises, you would tend to over provision, that way at the busiest times, you do not loose business to the competition. But the flexibility in AWS affords the customers the luxury to provision for only what they need at the time increase or decrease capacity as need arises.</p><p><strong>Cost Optimization</strong></p><p>Given that with AWS you get to scale up only when you need to and scale down during hours of low demand, you only pay for what you use. This is in contrast to on-premises where you over provision and pay for much of that upfront regardless of how you end up using it. the return on investment is low on-promises.</p><p><strong>Reliability</strong></p><p>By design, AWS comes with multiple levels of redundancy built into it. You get the option to run your application in multiple regions that have multiple availability zones. All these have redundant power connections, internet connections and physical separation. In the event of a catastrophic failure, your application will still be available to your customers and you’ll have no disruption in revenue generation because it would still be able to continue functioning from another availability zone or region.</p><h4>Building the infrastructure</h4><p>Now let us go get our infrastructure ready so we can move our application and reap the benefits of AWS. This is the architectural diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*4RXJOdXYMsd5suqN_o-ljg.png" /></figure><h4>Creating VPC and subnets</h4><p>We will build this from AWS console and will start with the VPC with a CIDR block of 10.10.0.0/16. We will curve out 3 subnets of /24 from that CIDR block. So our subnets will be 10.10.1.0/24, 10.10.2.0/24 and 10.10.3.0/24.</p><p>Creating the VPC and subnets is pretty straight forward. From the VPC menu, click on “Create VPC” and just supply a name and the CIDR range to use. For the subnets, the steps are just about as simple; you supply a name, and the CIDR range.</p><h4>Creating the EC2 Instances</h4><p>For the EC2 Instances we will utilize Launch templates. Here we provide parameters and attributes that will be used to launch instances automatically when we choose to use a the template.</p><h4>Auto Scaling Groups</h4><p>Auto Scaling Group (ASG) is the AWS services that will manage for us the scaling up or scaling down of instances when it receives the appropriate health check status. Clicking on “Create Auto Scaling group” will give us the option to create a Launch Template or proceed without one. I chose to proceed with the one I already created.</p><p>I chose 2 as the desired number of instances, 2 for the minimum and 5 for the maximum and created the Auto Scaling group.</p><h4>Target group</h4><p>This is where we specify to the Load balancer what group of resources to distribute requests to. So here we click on “Target Group”, then “”Create target group”, leave everything at default except for providing the instances that will receive requests from the load balancer.</p><h4>Challenges</h4><p>After everything was created, nothing seems to work, so now it is time to troubleshoot.</p><ol><li>First, I checked the status of the EC2 instances and they all showed green status check.</li><li>Next I checked whether Apache was installed as specified in the user data. I This was found to not be an issue and so on to the next check.</li><li>I looked closer and noticed the http error code received - “502 bad Gateway”. From googling I figured that it has to do with load balancer issues, possibly not able to reach the instances. So now I suspect the security group rules between the load balancer and the instances, so that is what I’m going to investigate. That got me nowhere as modifying the security groups didn’t solve my issue.</li><li>Upon closer inspection, I discovered that instances created using the Launch template were not being assigned a public IP. I changed the appropriate setting on my instances and they all turned healthy shortly afterwards. The load balancer also started to distribute requests to all instances.</li></ol><h4>Conclusion</h4><p>Thus far this was my most challenging cloud project especially the troubleshooting part. I had actually prepared a teams message to ask my team for help but I didn’t send it yet since it was late into the night. So I left it in draft and continued to troubleshoot and I am so glad that I finally found the missing parameter on my own.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=654e9e68fd9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to host a static website on Ubuntu using AWS EC2 instance]]></title>
            <link>https://medium.com/@ron.maroria/how-to-host-a-static-website-on-ubuntu-using-aws-ec2-instance-05e448068b52?source=rss-8b83013beda8------2</link>
            <guid isPermaLink="false">https://medium.com/p/05e448068b52</guid>
            <dc:creator><![CDATA[Ronald Maroria]]></dc:creator>
            <pubDate>Tue, 04 Feb 2025 00:34:08 GMT</pubDate>
            <atom:updated>2025-02-04T00:34:08.863Z</atom:updated>
            <content:encoded><![CDATA[<p>It is fairly easy to set up and host a static website using AWS EC2 instances. In this article, I am going to take you through the steps to setup your EC2 instance and ultimately host the static website. I am using my AWS free tier and so I will not incur any cost during this project. If you don’t have the AWS free tier but would like to follow along, I suggest you go and create your account to properly follow along.</p><p><strong>Steps:</strong></p><p>If you are logging into AWS console for the first time, you will see the screen below, and on the top left, you can “ec2”(or any other service you desire).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CZZaV0h4btGgXbM8g34pxA.png" /></figure><p>Select on EC2, then “Launch instance”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*LEUa7BJgLE1NZ9cunl028A.png" /></figure><p>Then,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*8Ni-2Xww_wPOBRr5c8AdEQ.png" /></figure><p>On the screen that follows choose the following parameters:</p><p>· Name of the server</p><p><strong>·</strong> OS to use (I will choosing Ubuntu)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*sx1CHqFO9n_oiuIX8hrUcA.png" /></figure><p><strong>·</strong> Key Pair — <strong>Important:</strong> make sure to keep note of where on your desktop this is downloaded to</p><p><strong>·</strong> Under network setting, choose to “Create security group” and check the boxes to Allow SSH traffic and Allow HTTP traffic from the internet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*Y9BYeQ8afoUvWUHluN_HPQ.png" /></figure><p>· Click on “Advanced details”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zTgXkeBlzqcSBdte14Ueag.png" /></figure><p>· Scroll all the way down to the “User data” section. In this area, we supply configurations that we want the instance to launch with, so I will paste the text into the box:</p><pre>#!/bin/bash</pre><pre># Use this for your user data (script from top to bottom)</pre><pre># install httpd (Linux 2 version)</pre><pre>sudo apt update &amp;&amp; sudo yum upgrade</pre><pre>sudo apt install -y apache2</pre><pre>echo “&lt;h1&gt;”Welcome to LUIT — Gold Team — Devops — January 2025&quot;&lt;/h1&gt;” &gt; /var/www/html/index.html```</pre><p>· If we’ve done this correctly, then we will be able to open the web page we’ve created with the words “Welcome to LUIT — Gold Team — Devops — January 2025”</p><p>After waiting a few minutes, the instance will be fully launched, so let’s go and test:</p><p>· Click on Instances to reveal your list of instances:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*R0Z32yACMBbECtZvi3fE9g.png" /></figure><p>· Click on the instance ID of you instance and under instance summary copy the “Auto-assigned IP address”, paste this into your browser to test.</p><p><strong>Troubleshooting</strong></p><p>It didn’t work and the page would not open, so I had to do some troubleshooting. These are the steps I followed with help from searching on Google:</p><p>· I SSH’ed into the instance and tried to run “curl localhost”. This should tell me whether the web page is present and accessible locally. I found out that it is not there.</p><p>· Next, I checked whether the Apache server was actually installed, so I ran “apache2 –v”</p><pre>ubuntu@ip-172–31–95–95:~$ apache2 -v</pre><pre>Server version: Apache/2.4.58 (Ubuntu)</pre><pre>Server built: 2024–10–02T12:40:51</pre><p>· So Apache is installed and the Apache default web page is reachable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*-E8V5YEKsIKJHKRL6yng5w.png" /></figure><p>· Now I need to modify the configuration so that the default page that I intend to use can be displayed — a one-liner “Welcome to LUIT — Gold Team — Devops — January 2025”</p><p>· For that, I need to create an html file in /var/www/html with the line that I need to be displayed:</p><pre>sudo touch/var/www/html/default-page.html</pre><p>· Next I need to open the file with nano and provide the text to the line:</p><pre>Sudo nano /var/www/html/default-page.html</pre><p>· Upon testing, we are still seeing the Apache default page being displayed instead of what I have specified in the file I created, so now it is time to do some more research. I finally found out that I need to do more configuration for Apache to display the intended webpage :</p><p>1. First, in the /var/www/html/, we need to create another file named .htaccess.</p><p>2. The first attempt to edit this file after creating it fails because of permissions. To set the correct permissions, use this command:</p><pre>sudo chmod 755 .htaccess</pre><p>3. Once permissions are correctly set, go into the .htaccess file and add this line:</p><pre>DirectoryIndex default-page.html</pre><p><strong>Note that “default-page.html” is the name of file containing what I want to be displayed, so change yours accordingly.</strong></p><p>4. Next, edit /etc/apache2/apache2.conf file using nano or your favorite text editor. Scroll down to “&lt;Directory /var/www/&gt;” block and ensure it looks like this:</p><pre>&lt;Directory /var/www/&gt;</pre><pre>Options Indexes FollowSymLinks</pre><pre>AllowOverride All</pre><pre>Require all granted</pre><pre>&lt;/Directory&gt;`</pre><p>5. If you are done editing per the instructions, save the file and restart the webserver:</p><pre>sudo systemctl restart apache2</pre><p>· Now go back to your webpage and test again. Voila!! that is what I needed for my webpage to come up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*d3FJh_KHVBAvWxgNvqbwWg.png" /></figure><p>I hope you enjoyed, and more importantly learned with me. I will be posting more as continue learning. Please give me a follow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05e448068b52" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>