Skip to main content

Command Palette

Search for a command to run...

13. Application Load Balancer (ALB)

Published
โ€ข2 min read
K

"Hello, I'm Kiran Pawar, a passionate Cloud and Devops Engineer with a strong background in cloud automation, configuration, and deployment. My journey in the world of technology has been a thrilling adventure, where I've had the privilege to work with cutting-edge tools and practices.

๐Ÿš€ As a DevOps Engineer:

I specialize in automating, configuring, and deploying instances in cloud environments and data centers. My expertise extends to DevOps, GitOps, CI/CD pipeline management, HashiCorp Terraform, and containerization. I'm proficient in AWS and Linux/Unix administration, ensuring robust infrastructure and application performance.

๐Ÿ”ง My Tech Stack:

Front-end skills: HTML, CSS, SCSS, Tailwind CSS, Bootstrap, React, Material-UI, JavaScript DevOps toolbox: GIT, OWASP,Nexus,Trivy, Github, Gitlab, Terraform, Ansible, Docker, Kubernetes, Helm, Jenkins, Prometheus, Grafana, Argo CD, AWS EKS.

๐ŸŒ My Cloud Expertise:

I have hands-on experience managing AWS services, including EC2, S3, EBS, VPC, ELB, RDS, IAM, Route53, and more.

๐Ÿ”’ Networking and Security:

My skills include managing networking concepts such as TCP/IP protocols, security policies, and subnet interfacing. I have a strong understanding of infrastructure and networking, covering topics like firewalls, IP addressing, DNS, and more.

๐Ÿ’ก What Sets Me Apart:

I bring a positive attitude, a strong work ethic, and a collaborative spirit to every project. I'm a self-starter, a fast learner, and an effective team player with strong interpersonal skills. In addition to my DevOps skills, I've developed shell scripts (Bash) for automating tasks and have proficiency in Python scripting. My ability to communicate and manage projects, along with a track record of resolving client issues, adds value to every team I work with. If you're looking for a DevOps engineer who is also well-versed in front-end technologies, feel free to connect with me. Let's explore new possibilities and create exceptional technical solutions together!"

Creating an Application Load Balancer (ALB) and configuring it with multiple target groups can significantly enhance your application's scalability and reliability. Here's a step-by-step guide along with a diagram:

Steps:

  1. Instance Setup:

    • Launch four EC2 instances with private subnets, placing two instances in subnet 1A and the remaining two in subnets 1B and 1C.

    • Ensure proper userdata configuration for each instance.

  2. Target Group Creation:

    • Create three target groups:

      • Home Page: HTTP 80, health check /homepage/, add all instances.

      • Movies: HTTP 80, health check /movies/, add movies server only.

      • Shows: HTTP 80, health check /shows/, add shows server only.

  3. Load Balancer Configuration:

    • Create an ALB (Internet-facing) in your VPC, selecting the public subnets and appropriate security group.

    • Configure two listeners: HTTP (80) and HTTPS (443).

    • Select the SSL certificate for your domain (e.g., www.cloudvishwakarma.in).

  4. Route 53 Setup:

    • Create a Route 53 record pointing to the ALB.
  5. HTTP to HTTPS Redirection:

    • Configure HTTP to HTTPS redirection:

      • Create a rule to redirect HTTP (80) traffic to HTTPS (443).

      • Ensure proper HTTPS redirection for all incoming traffic.

  6. Path-Based Routing:

    • Implement path-based routing for different content:

      • Create rules to direct traffic based on paths (e.g., /movies/*, /shows/*).

      • Ensure each rule forwards traffic to the corresponding target group.

  7. Error Handling:

    • Set up error handling rules:

      • Define rules for specific paths (e.g., /google/*) and provide appropriate responses (e.g., 503 error with a message).
  8. Virtual Hosting:

    • Optionally, configure virtual hosting for multiple hosts:

      • Utilize host headers to direct traffic to different backend services based on the requested host.

Diagram:

                  +---------+
                  |  ALB    |
                  |         |
                  +----+----+
                       |
          +------------+------------+
          |                         |
    +-----v-----+             +-----v-----+
    | Target    |             | Target    |
    | Group:    |             | Group:    |
    | Homepage  |             | Movies    |
    |           |             |           |
    +-----+-----+             +-----+-----+
          |                         |
          |                         |
    +-----v-----+             +-----v-----+
    | Target    |             | Target    |
    | Group:    |             | Group:    |
    | Shows     |             | ...       |
    |           |             |           |
    +-----------+             +-----------+

By following these steps and configuring your ALB accordingly, you can efficiently distribute incoming traffic across your EC2 instances and provide a seamless experience for your users.