<?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 Luciano Marcondes on Medium]]></title>
        <description><![CDATA[Stories by Luciano Marcondes on Medium]]></description>
        <link>https://medium.com/@lucianobm?source=rss-fd0eb59b1d88------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ovdamLGRzUc2BIahfWRsfw.jpeg</url>
            <title>Stories by Luciano Marcondes on Medium</title>
            <link>https://medium.com/@lucianobm?source=rss-fd0eb59b1d88------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:17:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lucianobm/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 deploy a high available and auto scale Apache Web Server on EC2 instances using AWS…]]></title>
            <link>https://towardsaws.com/how-to-deploy-a-high-available-and-auto-scale-apache-web-server-on-ec2-instances-using-aws-809214841538?source=rss-fd0eb59b1d88------2</link>
            <guid isPermaLink="false">https://medium.com/p/809214841538</guid>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[cloudformation]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[Luciano Marcondes]]></dc:creator>
            <pubDate>Tue, 03 Jan 2023 13:52:54 GMT</pubDate>
            <atom:updated>2023-01-11T05:08:11.784Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to deploy a high available and auto scale Apache Web Server on EC2 instances using AWS CloudFormation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*_wNF2EVJBOCJuzG2iGmOUQ.png" /></figure><h4>Introduction</h4><p>This article will guide you <strong>deploy a high available and auto scale Apache Web Server</strong> on EC2 instances using <strong>AWS CloudFormation</strong> on both the AWS Console and AWS CLI.</p><p>To achieve this, we will create the following resources:</p><ul><li>VPC with custom CIDR block</li><li>3 Public Subnets in 3 different availability zones</li><li>Internet Gateway</li><li>Security Group</li><li>LaunchTemplate</li><li>Auto Scaling Group</li><li>Application Load Balancer</li><li>Scaling UP and DOWN policy</li></ul><h4>Let the fun begin!</h4><p>According to <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html">AWS CloudFormation best practices</a> documentation, it is recommended to break the templates into smaller manageable templates. So I splitted the deploy on 2 different template files <strong>vpc.yaml</strong> and <strong>asg_alb.yaml</strong> listed below.</p><p>Let’s go through each item of the template:</p><ul><li><strong>Description</strong> is a text string to describe the purpose of the template.</li><li><strong>Parameters</strong> are used to pass custom values at runtime. It is how we can make templates reusable to customize our stacks when we create them.</li></ul><p>On the example below (<strong>vpc.yaml</strong>), we are including the name of the environment (that will be used later to tag the resources), the IPv4 CIDR of the VPC and subnets.</p><pre>Parameters:<br> EnvName:<br>   Description: Name that will be used on resources<br>   Type: String<br>   Default: LUIT<br> <br> VPCCIDR:<br>   Description: Please enter the IPv4 CIDR for this VPC<br>   Type: String<br>   Default: 10.10.0.0/16<br><br> PublicSubnetACIDR:<br>   Description: Please enter the IPv4 CIDR for this Public Subnet A<br>   Type: String<br>   Default: 10.10.1.0/24<br> PublicSubnetBCIDR:<br>   Description: Please enter the IPv4 CIDR for this Public Subnet B<br>   Type: String<br>   Default: 10.10.2.0/24<br> PublicSubnetCCIDR:<br>   Description: Please enter the IPv4 CIDR for this Public Subnet C<br>   Type: String<br>   Default: 10.10.3.0/24</pre><ul><li><strong>Resources</strong> are the only required object of a template. We are including the VPC with the “DnsSupport” and “DnsHostnames” options enabled, an Internet Gateway that will be attached to the new VPC created, the 3 public subnets and the default route to 0.0.0.0/0 using the Internet Gateway created.</li></ul><pre>Resources:<br> VPC:<br>   Type: AWS::EC2::VPC<br>   Properties:<br>     CidrBlock: !Ref VPCCIDR<br>     EnableDnsSupport: true<br>     EnableDnsHostnames: true<br>     Tags:<br>      - Key: Name<br>        Value: !Ref EnvName<br><br> InternetGateway:<br>   Type: AWS::EC2::InternetGateway<br>   Properties:<br>     Tags:<br>      - Key: Name<br>        Value: !Ref EnvName<br><br> InternetGatewayAttachment:<br>   Type: AWS::EC2::VPCGatewayAttachment<br>   Properties:<br>     InternetGatewayId: !Ref InternetGateway<br>     VpcId: !Ref VPC<br><br> PublicSubnetA:<br>   Type: AWS::EC2::Subnet<br>   Properties:<br>     VpcId: !Ref VPC<br>     CidrBlock: !Ref PublicSubnetACIDR<br>     MapPublicIpOnLaunch: true<br>     AvailabilityZone: &quot;us-east-1a&quot;<br>     #AvailabilityZone: !Select [ 0, !GetAZs &#39;&#39; ]<br>     Tags:<br>     - Key: Name<br>       Value: !Sub ${EnvName} Public Subnet A<br> PublicSubnetB:<br>   Type: AWS::EC2::Subnet<br>   Properties:<br>     VpcId: !Ref VPC<br>     CidrBlock: !Ref PublicSubnetBCIDR<br>     MapPublicIpOnLaunch: true<br>     AvailabilityZone: &quot;us-east-1b&quot;<br>     #AvailabilityZone: !Select [ 1, !GetAZs &#39;&#39; ]<br>     Tags:<br>     - Key: Name<br>       Value: !Sub ${EnvName} Public Subnet B<br> PublicSubnetC:<br>   Type: AWS::EC2::Subnet<br>   Properties:<br>     VpcId: !Ref VPC<br>     CidrBlock: !Ref PublicSubnetCCIDR<br>     MapPublicIpOnLaunch: true<br>     AvailabilityZone: &quot;us-east-1c&quot;<br>     #AvailabilityZone: !Select [ 2, !GetAZs &#39;&#39; ]<br>     Tags:<br>     - Key: Name<br>       Value: !Sub ${EnvName} Public Subnet C<br><br> PublicRouteTable:<br>   Type: AWS::EC2::RouteTable<br>   Properties:<br>     Tags:<br>      - Key: Name<br>        Value: !Sub ${EnvName} Public Route Table<br>     VpcId: !Ref VPC<br><br> DefaultPublicRoute:<br>   Type: AWS::EC2::Route<br>   DependsOn: InternetGatewayAttachment<br>   Properties:<br>     DestinationCidrBlock: 0.0.0.0/0<br>     GatewayId: !Ref InternetGateway<br>     RouteTableId: !Ref PublicRouteTable<br><br> PublicSubnetARouteTableAssociation:<br>  Type: AWS::EC2::SubnetRouteTableAssociation<br>  Properties:<br>    RouteTableId: !Ref PublicRouteTable<br>    SubnetId: !Ref PublicSubnetA<br> PublicSubnetBRouteTableAssociation:<br>  Type: AWS::EC2::SubnetRouteTableAssociation<br>  Properties:<br>    RouteTableId: !Ref PublicRouteTable<br>    SubnetId: !Ref PublicSubnetB<br> PublicSubnetCRouteTableAssociation:<br>  Type: AWS::EC2::SubnetRouteTableAssociation<br>  Properties:<br>    RouteTableId: !Ref PublicRouteTable<br>    SubnetId: !Ref PublicSubnetC</pre><p>Lastly, we are including the <strong>Outputs</strong> section. It is optional but important to print the information of some resources that we might need to know or to use on any other stack.<br>On the example below, we are printing and exporting the ID of created VPC and subnets, and the CIDR of public subnets created.</p><pre>Outputs:<br>  VPC:<br>    Description: ID of created VPC<br>    Value: !Ref VPC<br>    Export:<br>      Name: VPC<br>  PublicSubnets:<br>    Description: CIDR of public subnets created<br>    Value: !Join [ &quot;,&quot;, [ !Ref PublicSubnetACIDR, !Ref PublicSubnetBCIDR, !Ref PublicSubnetCCIDR ] ]<br>  PublicSubnetA:<br>    Description: ID of created public subnet A<br>    Value: !Ref PublicSubnetA<br>    Export:<br>      Name: PublicSubnetA<br>  PublicSubnetB:<br>    Description: ID of created public subnet B<br>    Value: !Ref PublicSubnetB<br>    Export:<br>      Name: PublicSubnetB<br>  PublicSubnetC:<br>    Description: ID of created public subnet C<br>    Value: !Ref PublicSubnetC<br>    Export:<br>      Name: PublicSubnetC</pre><p>Below is the full <strong>vpc.yaml</strong> template that we will use to create the stack.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61913f7e48a198a7536da96ee915939c/href">https://medium.com/media/61913f7e48a198a7536da96ee915939c/href</a></iframe><p>Now let’s go through each item of the <strong>asg_alb.yaml</strong> template:</p><p>We are including the following resources:</p><ul><li><strong>Security Group</strong> to allow inbound HTTP and SSH traffic from the Internet;</li><li><strong>Launch Template</strong> with an Amazon Linux AMI, t2.micro instance type, my key pair “luciano” previous created, the security group created above and the UserData to install Apache Web Server;</li><li><strong>Application Load Balancer</strong>, Target Group and Listener;</li><li><strong>Auto Scaling Group</strong> with desired capacity of 2, minimum of 2 and maximum of 5.</li><li><strong>Scale up</strong> and <strong>down</strong> policies with alarms to scale in case of the utilization of CPU goes above or beyond 50% for 10 minutes.</li></ul><p>Also we are including an <strong>output</strong> section to print the DNS name of the Application Load Balancer.</p><p>Below is the full <strong>asg_alb.yaml</strong> template that we will use to create the stack.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42a4f4e7d016ddd1be77e298138365bc/href">https://medium.com/media/42a4f4e7d016ddd1be77e298138365bc/href</a></iframe><p>Now let’s deploy the stacks using both the AWS Console and AWS CLI:</p><h4>Using AWS Console</h4><p>After logging into your AWS account, search for <strong>CloudFormation</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jvr6OiMekR8HlAs9viJdwA.png" /><figcaption>CloudFormation service</figcaption></figure><p>On the CloudFormation dashboard, click on “Create stack” button.</p><p>Select “Upload a template file” and click on “Choose file” button to browse the <strong>vpc.yaml</strong> file on your computer and then click on “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHX7Ws69d6tm-DsPbfVswg.png" /><figcaption>Create stack</figcaption></figure><p>Enter a stack name, the environment name and the IPv4 CIDR blocks for the VPC and the subnets, and click on “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PmBLnJDYqxb4Ov7Y3dV8Q.png" /><figcaption>Specify stack details</figcaption></figure><p>On<strong> Configure stack options</strong> section, we will leave everything as default and click on “Next”.<br>Review your stack details and click on “Submit” if everything seems correct.</p><p>You can repeat this process to create another stack using the <strong>asg_alb.yaml</strong> file.</p><h4>Using AWS CLI</h4><p>To create the stacks using AWS CLI, follow the steps below:</p><p><strong>Validate our templates</strong></p><pre>aws cloudformation validate-template --template-body file://vpc.yaml<br><br>aws cloudformation validate-template --template-body file://asg_alb.yaml</pre><p><strong>Create stacks using our templates</strong></p><pre>aws cloudformation create-stack --stack-name LUIT --template-body file://vpc.yaml <br><br>aws cloudformation create-stack --stack-name LUIT2 --template-body file://asg_alb.yaml</pre><p><strong>Check if the stack we created via template is completed successfully</strong></p><pre>aws cloudformation list-stack-resources --stack-name LUIT<br><br>aws cloudformation list-stack-resources --stack-name LUIT2</pre><p><strong>Describe stack and its resources to view its properties</strong></p><pre>aws cloudformation describe-stacks --stack-name LUIT<br><br>aws cloudformation describe-stacks --stack-name LUIT2<br><br><br>aws cloudformation describe-stack-resources --stack-name LUIT<br><br>aws cloudformation describe-stack-resources --stack-name LUIT2</pre><p><strong>Check events for stack formation</strong></p><pre>aws cloudformation describe-stack-events --stack-name LUIT<br><br>aws cloudformation describe-stack-events --stack-name LUIT2</pre><p>Now you should check if the Status is “CREATE_COMPLETE” and check the resources created.</p><p>If everything was created successfully, we will be able to reach the Application Load Balancer DNS on our browser and see the Apache running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SI3feg3ve-avycKWWEcJYg.png" /><figcaption>ALB redirecting traffic to EC2 instance on us-east-1a</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwR99s996OztvQSJfcjTGQ.png" /><figcaption>ALB redirecting traffic to EC2 instance on us-east-1c</figcaption></figure><h3>Success!</h3><p>We have successfully created 2 stacks using AWS CloudFormation to deploy a high available and auto scale Apache Web Server running on EC2 instances.</p><p>If this step-by-step guide was helpful to you, click the clap 👏 button and drop a comment below! I can’t wait to hear from you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=809214841538" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/how-to-deploy-a-high-available-and-auto-scale-apache-web-server-on-ec2-instances-using-aws-809214841538">How to deploy a high available and auto scale Apache Web Server on EC2 instances using AWS…</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Install an Apache Web Server on Ubuntu 18.04 LTS]]></title>
            <link>https://medium.com/@lucianobm/how-to-install-an-apache-web-server-on-ubuntu-18-04-lts-fd940100a4e2?source=rss-fd0eb59b1d88------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd940100a4e2</guid>
            <category><![CDATA[linux-tutorial]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[bash]]></category>
            <dc:creator><![CDATA[Luciano Marcondes]]></dc:creator>
            <pubDate>Fri, 18 Nov 2022 01:06:49 GMT</pubDate>
            <atom:updated>2022-11-21T14:16:41.516Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*YdhfWlvrMegJt9wUKBYcew.png" /></figure><h4>Introduction</h4><p>This article will guide you<strong> install the Apache web server on Ubuntu 18.04 LTS Server</strong> (it has also been tested on version 20.04).</p><p><strong>Apache web server</strong> is “an open-source web server creation, deployment and management software. Initially developed by a group of software programmers, it is now maintained by the Apache Software Foundation.” <em>(</em><a href="https://www.techopedia.com/definition/4851/apache-web-server"><em>Source</em></a><em>)</em></p><p><strong>Ubuntu</strong> “is a free operating system that uses the Linux kernel. It is one of the most popular Linux distributions and it is based on Debian Linux computer operating system. A new release of Ubuntu is released every six months, with long-term support (LTS) releases every two years.” <em>(</em><a href="https://simple.wikipedia.org/wiki/Ubuntu"><em>Source</em></a><em>)</em></p><h4>Prerequisites</h4><ul><li>A system running Ubuntu 18.04 LTS (Bionic Beaver) or Ubuntu 20.04 LTS (Focal Fossa)</li><li>A terminal or command line interface (CLI)</li><li>Access to a user account with sudo privileges</li></ul><h4><strong>Summary</strong></h4><ol><li>Update all packages on the server</li><li>Install an Apache Web Server</li><li>Check Apache installation</li><li>Enable Apache Web Server</li><li>Configure the firewall</li><li>Personalize the HTML page</li><li>Create and run a Bash Script to automate the installation (optional)</li></ol><h4>Let the fun begin!</h4><p><strong>Step 1: Update all packages on the server</strong></p><p>Before installing a new software, it’s a best practice to fetch the latest version of the package list from your distro’s software repository with the command below:</p><pre>sudo apt update -y</pre><p><em>The </em><strong><em>-y</em></strong><em> option will automatically agree to user prompts generated by this command.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*HdV-RHaUvL1TduCViMOBKw.png" /></figure><p>After that we can go to the next commands. The first one is to list the packages that can be upgraded and the second one to actually download and upgrade them.</p><pre>sudo apt list --upgradable<br>sudo apt upgrade -y</pre><p><strong>Step 2: Install an Apache Web Server</strong></p><p>Now we can move forward and install Apache with the following command:</p><pre>sudo apt install apache2 -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPxL8jBlZSzc7_LaREMLEQ.png" /><figcaption>Apache installed</figcaption></figure><p><strong>Step 3: Check Apache installation</strong></p><p>We can confirm it by checking the version of the installed package:</p><pre>apache2 -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*wjEPLH25t56tZdUVhjv1WA.png" /></figure><p>And the status of the service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*bEok9LZ7MmU9ROC4h7V7BQ.png" /><figcaption>“active” and “running”</figcaption></figure><p>Also we can open the Apache2 Ubuntu default page on the browser and confirm it’s working: <a href="http://ip_of_the_server/">http://ip_of_the_server</a></p><p>To grab the public IP of the server try the command below:</p><pre>curl ifconfig.me; echo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*6WwV45S7G4dejdz2KXSYNg.png" /><figcaption>public IP address of the server</figcaption></figure><p>Depending on your network you might want the private IP of the server. If this is your case, you can get the IP using the following command:</p><pre>hostname -I</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*KXRe1yoUa7VHftEJjgWjVg.png" /><figcaption>private IP address of the server</figcaption></figure><p>We should be able to see the following page on the browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*SNxSNpGYSAA2Sv8uTWTuOw.png" /></figure><p><strong>Step 4: Enable Apache Web Server</strong></p><p>If we want to start Apache Web Server as a service on the boot of the server, we should go through the command below:</p><pre>systemctl enable apache2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*awpq6G4GXxbdFj8059v2tg.png" /><figcaption>Apache will run on system startup</figcaption></figure><p><strong>Step 5: Configure the firewall</strong></p><p>We can install and configure a firewall on the server to expose to the internet only the needed ports. To do that we will use UFW (Uncomplicated Firewall).</p><p>Since we are currently connected to the server through ssh, our connection will be blocked preventing us from accessing the server if we enable ufw before allowing the ssh.</p><p>Start by checking the status of the firewall:</p><pre>sudo ufw status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*4Q8TqUo3ANBblugaWQokiQ.png" /><figcaption>ufw currently inactive</figcaption></figure><p>Then display the available applications:</p><pre>sudo ufw app list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*bKybW-cznemyvaqvpr85aw.png" /><figcaption>list of all available apps</figcaption></figure><p>Use the following command to allow access to ssh:</p><pre>sudo ufw allow ssh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*ktPw8df6F8J9dC4yC1W1GA.png" /><figcaption>ssh allowed on ufw</figcaption></figure><p>And the following command to allow access to port 80:</p><pre>sudo ufw allow Apache</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*Lj2w2bQCRcwJXIHc2QO0uw.png" /><figcaption>Apache allowed on ufw</figcaption></figure><p>Now we are safe to enable it and check the status again:</p><pre>echo &quot;y&quot; | sudo ufw enable</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VuC8Db7cAIscTWRiCh6Yrg.png" /><figcaption>ufw enabled</figcaption></figure><p><strong>Step 6: Personalize the HTML page</strong></p><p>Now that we have our Apache Web Server up and running, we can edit the index.html file and change the default page of our server.</p><p>First we need to change the owner of the file:</p><pre>sudo chown -R $USER:$USER /var/www/html/index.html</pre><p>And then we will be able to edit:</p><pre>sudo cat &gt; /var/www/html/index.html &lt;&lt;- &quot;EOF&quot;<br><br>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;&lt;head&gt;<br>&lt;title&gt;Apache Web Server&lt;/title&gt;<br>&lt;/head&gt;&lt;body&gt;<br>&lt;h1&gt;Welcome to our Apache Web Server&lt;/h1&gt;<br>&lt;/body&gt;&lt;/html&gt;<br><br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*yjgYpZrA59rHOurKNfT9Kw.png" /></figure><p>If we try again the page on the browser it will show “Welcome to our Apache Web Server”: <a href="http://ip_of_the_server/">http://ip_of_the_server</a></p><h4>Success!</h4><p>We have successfully installed the Apache Web Server software on our Ubuntu, configured the firewall and personalized the default index page.</p><p><strong>Step 7: Create and run a Bash Script to automate the installation (optional)</strong></p><p>Copy and paste the text below on the terminal of the server and then execute the script with the next command.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c506ce4d6eed74f1f891acdc9648b17a/href">https://medium.com/media/c506ce4d6eed74f1f891acdc9648b17a/href</a></iframe><pre>sudo bash apache.sh</pre><p>If this step-by-step guide was helpful to you, click the clap 👏 button and drop a comment below! I can’t wait to hear from you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd940100a4e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>