AWS Classroomnotes 12/Feb/2023

AWS Networking Workshop – Part 1

Enabling DNS Names in VPC

  • Create a VPC with atleast one public subnet.
  • Create an ec2 instance in public subnet, ensure the security group rule is open for 22 and 80
  • By default in vpc the Public DNS Names are not enabled
    Preview
  • To enable public DNS names
    Preview
    Preview
    Preview

DHCP Options Set

  • DHCP Options set is used to set the DNS Servers in VPC
    Preview

Create an ec2 instance with some predefined private ip.

  • Create a Network interface in the subnet (zone) where your ec2 instance is running.
  • Choose Custom for private ip address.
  • Attach this network interface to your ec2 instance
    Preview
    Preview
    Preview
    Preview

Lab Prep

  • Create an ec2 instance and ensure you execute the following steps
sudo apt update
sudo apt install apache2 stress -y
sudo apt install php libapache2-mod-php php-mysql -y
sudo -i 
echo "<?php phpinfo(); ?>" > /var/www/html/info.php
  • Navigate to http://publicip/info.php
  • Create an AMI
    Preview
    Preview
    Preview
    Preview
  • Wait till the AMI creation is completed
  • Delete the ec2 instance

Load Balancing

OSI Model of Networking

  • Layers
    Preview
  • Layers & Protocols
    Preview

Layer 4 and Layer 7 LoadBalancing

  • Load Balancing can be done at Layer 4 and Layer 7
  • Layer 4:
    • Aware: IP, Port, TCP/UDP, MAC
  • Layer 7:
    • Aware: IP, Port, TCP/UDP, MAC, HTTP, SSL/TLS (security)

Load Balancers in AWS

  • In AWS we have following load balancers
    • AWS classic Load Balancer:
      • Both L4 and L7 loadbalancing
    • AWS Network Load Balancer:
      • Works on Layer 4
    • AWS Application Load Balancer
      • Works on Layer 7

Layer 4 load balancing

  • Create a VPC with two subnets in two different zones
  • Create an ec2 instance in subnet 1 and subnet2
  • Ensure 80 and 22 ports are opened in securty group for all.
    Preview
  • Create a Layer 4 load balancer using Network Load Balancer
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
  • Now access by using `http:///info.php
    Preview

Layer 7 loadbalancing

  • AWS has Application Load Balancer which can perform layer 7 load balancing
    Preview
  • login into web1 and execute the following
# web1
# root
mkdir -p /var/www/html/images
echo "<h1>images</h1>" > /var/www/html/images/index.html
  • access the application by using http://publicip/images/index.html
  • login into web2 and execute the following
# web2
# root
mkdir -p /var/www/html/music
echo "<h1>music</h1>" > /var/www/html/music/index.html
  • access the application by using http://publicip/music/index.html
  • http health checks:
    • Status Codes
      Preview
    • Interval: how frequently load balancer will perform health checks?
    • Healthy threshold: How many consecutive health checks should be passed to consider the instance healthy
    • UnHeathy threshold: How many consecutive health checks should be failed to consider the instance unhealthy
  • Target Group for every application component running independently i.e. we will be creating two target groups images and music
  • Lets create a Application Load Balancer
    Preview
    Preview
    Preview
    Preview
  • Select the default target group for now
    Preview
  • Complete the creation
  • Path Based Routing: Refer Here
  • Now lets manage rules in listener
    Preview
    Preview
    Preview

Aws Options Load Balancing in Single Region

  • Layer 4 Load Balancing using Network load balancer
  • Layer 7 load balancing uing ALB using path based Routing

Lab Setup for Next Set of Activities

  • We have AMI in a Region, lets copy that to other region
    Preview
    Preview
  • Create a vpc with two public subnets and create web1 and web2 in the other region as well

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner