Tech Junkie Blog - Real World Tutorials, Happy Coding!

Latest Posts

Monday, January 11, 2021

Monday, January 4, 2021

 In the previous post we created four instances with a Launch Template. In this post we are going to add DNS records in Route 53 and configure our Application Load Balancer with our certificates.

Before we start creating stuff let's take a step back and look at how we want to configure the website.  Let's say a bank wants to branch out into investing, so it wants to dedicate to instances to it's investing arm.  In our architecture we would have two target groups, one target group handling traffic for https://acmebanking.com and the other target group handling traffic for https://investing.acmebanking.com

We are going to register all four instances on the load balancer.

1. So now we ready to create an Application Load Balancer, give it a name and for the listener add an HTTPS listener to the existing one


Monday, December 28, 2020

 In the previous post we created our certificates in the Certificate Manager, in this post we are going to create four instances using a Launch Template so that we could use it in our load balancer.  

1. We are actually going to use "Launch Template" to create our instances, so click on "Launch Templates" under "Instances" in the EC2 Dashboard

2.  Click on the "Create launch template" button
3. Give your template a name, then scroll down to AMI type


Monday, December 21, 2020

 In this post we are going to set up our website to serve up https traffic so that our traffic can be encrypted.  In this post the first part of the series we are going to request a certificate from the Certificate Manager in AWS.

1. The first thing we need to do is create a certificate, In the AWS search field search for Certificate Manager then click on the drop down auto complete choice.



2. Click on "Get started" under "Provision certificates"

Monday, December 14, 2020

 In this pose we are going to implement auto scaling on our instances.  Auto scaling is a feature on AWS that automatically scaled horizontally either based on metrics or the health of an instance. In this post we are going to setup auto scaling on an Application Load Balancer.  

1. The first thing we have to do is setup an Auto Scaling Group under "Auto Scaling" click on "Auto Scaling Groups"

2. Click on the "Create Auto Scaling group" button

3. Give your auto scaling group a name, then click on the "Create a launch template"


Monday, December 7, 2020

 In the previous post we went over how to create a Application Load Balancer, based on routes in the URL.  In this post we are going to change the rules so that it directs traffic based on host names.  For example we could have acmebanking.com route to target group 1 and accounts.acmebanking.com route to target group 2.  It's the same concept as the previous setup but instead of routes, we are using hostnames instead.

In order to implement this solution we need to setup a record in Route 53, which is AWS domain registration service.  You can follow along with the DNS names, but if you have a hostname registered with AWS that's even better.

1. So the first thing you want to do is go to Route 53 dashboard, go to Hosted Zones

2. Click on the hosted domain


Monday, November 30, 2020

 In the previous post we went over how to create a Network Load Balancer, in this post we are going to create one of types of load balancer AWS offers.  We are going to create a Application Load Balancer, this balancer  is designed to work best with the typical line of business web applications.  It deals mostly with the requests/response scenarios on the web, therefore it supports the HTTP, and HTTPS protocols exclusively.  It can be setup to respond to the routes that configured or the hosts.  It all depends on how your web applications serves the client.  In a way it's the easiest load balancer type to understand because it deals with headers, URLs,  routes,  parameters, query strings and etc.

Before we create the load balancer we need to create more than one instances with a web server because we need to test that the load balancer is able to switch.

1. Create four instances with the user data to create Apache Web Servers with these commands in the User Data for instance, if you need the full instruction on how to create instances with User Data you can read this post . 

#cloud-boothook
#!/bin/bash
#Use this for your user data (script without newlines)
# install httpd (Linux 2 version)

yum update -y 
yum install -y httpd.x86_64 
systemctl start httpd.service 
systemctl enable httpd.service 
echo "Hello world from $(hostname -f)" > /var/www/html/index.html
cd /var/www/html/
cp index.html contacts.html

We just created an index.html file to write out the hostname for testing later on, we also created a new file called contacts.html so that we can have different routes.

To create more than one instance at a time, type in the number of instances in the "Number of Instances" field.  Select no preferences for the subnets






Monday, November 23, 2020

 In the previous post we went over how to create a Classic Load Balancer, in this post we are going to create one of types of load balancer AWS offers.  We are going to create a Network Load Balancer, this balancer  is for websites that require high performance and low latency websites, think of streaming data.  If your website needs real time streaming data, this is probably the load balancer for you. It supports layer 4 protocols such as UDP, TLS and TCP protocols. If you need a static IP or Elastic IP assigned to your load balancer this is your only choice because the other two load balancer does not give you the option to assign Elastic IPs.

Before we create the load balancer we need to create more than one instances with a web server because we need to test that the load balancer is able to switch.

1. Create two instances with the user data to create Apache Web Servers with these commands in the User Data for instance, if you need the full instruction on how to create instances with User Data you can read this post

#cloud-boothook
#!/bin/bash
#Use this for your user data (script without newlines)
# install httpd (Linux 2 version)

yum update -y 
yum install -y httpd.x86_64 
systemctl start httpd.service 
systemctl enable httpd.service 
echo "Hello world from $(hostname -f)" > /var/www/html/index.html

We just created an index.html file to write out the hostname for testing later on


Monday, November 16, 2020

 In the previous post we went over what a load balancer is, in this post we are going to create one of types of load balancer AWS offers.  We are going to create a Classic Load Balancer, this balancer is not recommended by Amazon, you should only create this if you have to support EC2-Classic instances.

Before we create the load balancer we need to create more than one instances with a web server because we need to test that the load balancer is able to switch.

1. Create two instances with the user data to create Apache Web Servers with these commands in the User Data for instance, if you need the full instruction on how to create instances with User Data you can read this post

#cloud-boothook
#!/bin/bash
#Use this for your user data (script without newlines)
# install httpd (Linux 2 version)

yum update -y 
yum install -y httpd.x86_64 
systemctl start httpd.service 
systemctl enable httpd.service 
echo "Hello world from $(hostname -f)" > /var/www/html/index.html

We just created an index.html file to write out the hostname for testing later on


Monday, November 9, 2020

 If your website starts to become popular, especially if it's not static you might noticed that the performance is starting to degrade.  The most logical step is to scale your architecture with a load balancer.  AWS offers three types of load balancers, there are:

  • Application Load Balancer
    • Protocols (HTTP, HTTPS)
    • Specializes in web applications, deals with traffic at the request level (layer 7)
      • Supports query strings, path routing, parameter routing, IP routing
    • Supports IP addresses, Lamda Functions (serverless, microservices), and containers
  • Network Load Balancer
    • Protocols(TCP, TLS, UDP, TCP_UDP) - Layer 4
    • When high performance and low latency is required
    • TLS offloading
    • Elastic IPs can be assigned
  • Classic Load Balancer
    • Protocols (TCP, SSL, HTTP, HTTPS) - Layer 4, 7
      • Old generation, not recommended unless you are running EC2-Classic instance

    In a nutshell a load balancer distributes the client's traffic among the many instances that are available in your architecture to offload the traffic so that more than one instance can share the burden of the traffic.  A health check is setup so that only the health instances can serve up traffic.




    Search This Blog