Application Load Balancers | How to create an internet facing load balancer in AWS?

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • This video explains how to setup an Application load balancer in AWS and load balance the data between servers behind private subnets.
    start-up script:
    #!/bin/bash
    yum install httpd -y
    systemctl enable httpd
    echo "This is instance1" (greater than symbol) /var/www/html/index.html
    systemctl start httpd
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 79

  • @jacqueskoorts9968
    @jacqueskoorts9968 2 ปีที่แล้ว +6

    I'm going to try this out now. What I like about this video is that its recent with the latest AWS console. Also it uses the ALB where other videos use the CLB. And lastly it explains why a public subnet is used in this video if mostly what this video is about is the private subnet. Well done!

  • @Vmr48765
    @Vmr48765 ปีที่แล้ว +2

    Hi there, I followed your video step by step and got both EC2 instances as failed helth checks. Here is what I did, I used the new console to setup a VPC of 2 public and 2 private subnets. The security group on the private subnets are:
    Inbound:
    1. ssh port 22 inbound from my IP
    2. TCP 80 inbound from ALB security group
    Outbound
    1. Allow alltraffic outbound 0.0.0.0/0
    ALB security group
    Inbound
    1. inbound allow all traffic 0..0.0.0/0
    outbound:
    1. outbound all all traffic 0.0.0.0/0
    2. outbound TCP 80 to webserver 1 security group
    3. outbound TCP 80 to webserver 2 security group
    Health check status is as follows
    Protocol HTTP
    Port 80
    Path /
    Healthy Threshold: 5 consecutive health check successes
    Unhealthy Threshold 2 consecutive health check fails
    Timeout 5 seconds
    Interval 30 seconds
    success code :200
    The NAT gateway is in public subnet 1
    IGW is associated with the VPC
    The route table associated with private subnet 1 has the following entries
    1. 10.0.0.0/16 local
    2. 0.0.0.0/0 Nat-gateway
    The route table associated with private subnet 2 has the following entries
    1. 10.0.0.0/16 local
    2. 0.0.0.0/0 Nat gateway
    The route table associated with the public subnet 1 has the following entries
    1. 10.0.0.0/16 local
    2. 0.0.0.0/0 internet gateway
    The route table associated with the public subnet 2 has the following entries
    1. 10.0.0.0/16
    2. 0.0.0.0/0 internet gateway
    ALB is associated with the two public subnets
    ALB;s target group is the intsaces in the private subnet
    I get both instances as unhealthy. Please could you help me? Thanks Happy to even share my WS account credentials for you to jump in and have a look.

    • @listentolearn2363
      @listentolearn2363  ปีที่แล้ว +1

      Hi Vinay,
      Apologies for the delayed response, I dint notice your comment earlier..
      You seem to have done everything correctly.
      The only thing am doubting is the startup script in the EC2 instance. If you had copied the contents in the description, please ensure that you did replace '(greater than symbol)' with the actual symbol. TH-cam wouldn't allow be to use '>' symbol in the description (i think it might mess up their html tags).
      Let me know if that makes it work.
      You could even try looking at the ec2 instance logs, that could give more information on the startup script execution.

    • @Vmr48765
      @Vmr48765 ปีที่แล้ว +1

      @@listentolearn2363 spot on troubleshooting this 2 weeks ago I realised there was something wrong with the script upon fixing this it worked. You earned a new subscriber :) can you also make video of deploying in cloudformation and terraform instead of manually it will help greatly :)

    • @listentolearn2363
      @listentolearn2363  ปีที่แล้ว

      great, thanks for letting me know.. :) sure..

  • @mathisart
    @mathisart 2 ปีที่แล้ว +4

    The explanation is such high quality and no-nonsense. This channel deserves more views.

  • @rolandoperez7688
    @rolandoperez7688 ปีที่แล้ว +2

    Excellent tutorial; you clearly explained the NAT and IGW components, as well as how to configure all routes 👍, Thank you; this tutorial has been greatly useful to me.

  • @valo9883
    @valo9883 2 ปีที่แล้ว +2

    This is the best video I’ve come across that does an excellent job explaining this topic. You’re amazing

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว

      Wow, thank you! :)

    • @valo9883
      @valo9883 2 ปีที่แล้ว +1

      Your video was very thorough in explaining this. I have a question for you, 1-Would this have worked without the NATG?
      2-Would this be possible with using an Gateway Endpoint instead of the NATG? and lastly
      3-What if I decided not to use either the NATG or Gateway Endpoint, would it have still worked?
      I appreciate your insight and I just subscribed and turned on notifications for all your posts. Please do be encouraged and continue to deliver amazing videos with clear and detailed descriptions.

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว +1

      Thanks again! :) and here are my thoughts on your questions -
      1. No, because the instances are in private subnets and it needs internet connectivity to install the start up script.
      2. No, because the gateway endpoint allows connectivity only to s3 and dynamodb from a vpc but not to internet.
      3. The problem would have been with the start up script. However, this is just a demo and in real world, if you are not actually initiating any internet connection and you are communicating only through the LB (which will be the case most the times) then you wouldn't need either of them. Also, if you want to avoid the start up script, you could use a pre built image with the required softwares installed to provision the instance.
      Let me know if you have any follow up questions :)

    • @valo9883
      @valo9883 2 ปีที่แล้ว

      @@listentolearn2363 Thank you so much. this makes perfect sense. Thank you. Looking forward to more videos.

  • @MaHa63b
    @MaHa63b ปีที่แล้ว +1

    Excellent and especially clear tutorial. A lot of thanks for instructor. This tutorial was very useful for me.

  • @juliuscaeser9834
    @juliuscaeser9834 2 ปีที่แล้ว

    wow! entire AWS ALB demystified in 15mins such that even my 12 yo can understand. Thank
    you so much for explaining this in a simple and easy approach.

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว

      Thank you so much for your support! Glad it was helpful! :)

  • @laurentsantiago3087
    @laurentsantiago3087 11 หลายเดือนก่อน +1

    Thank you very much for this excellent tutorial! It helped me a lot 👍

    • @listentolearn2363
      @listentolearn2363  11 หลายเดือนก่อน

      Glad to hear that! You're welcome :)

  • @JohnSmithhh
    @JohnSmithhh 29 วันที่ผ่านมา

    Thank you but in the begining of the video you're talking about private subnet but we doesn't link EC2 to them, so I'm a little bit lost. Why we create EC2 instance in public subnet?

  • @mohitwasnik9356
    @mohitwasnik9356 2 ปีที่แล้ว +1

    You just saved my motivation from assassination by frustration !!! 🐱‍👤 It was beautifully explained, cleared my doubts :)

  • @tamilpattucassette6859
    @tamilpattucassette6859 2 ปีที่แล้ว

    Thanks for sharing this video. The concept has been covered but not with clear information's. say example - EC2 instance has created without adding tag , NAT gateway has not used too but it's created in this video.

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว +1

      you're welcome.. NAT gateway is indeed used to establish network connectivity from private subnets.

  • @stephenadams5334
    @stephenadams5334 ปีที่แล้ว +1

    Well Done LTL!

  • @terrences6776
    @terrences6776 2 ปีที่แล้ว +1

    This was a great explanation! So what could be the issue if the target group is reporting unhealthy instances. Thanx.

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว +3

      Could you please check the below settings -
      1. The security group associated with the servers allows port 80 access from LB security group
      2. The security group associated with the LB allows port 80 access from 0.0.0.0
      3. The NAT gateway and Internet gateways are attached to the private and public subnets respectively
      4. The health checks are configured correctly with appropriate settings as shown

    • @terrences6776
      @terrences6776 2 ปีที่แล้ว +1

      @@listentolearn2363 Thank you for your feedback. I actually figured it out. I hadn't launched my instances separately. Once I did that everything started to report healthy.

  • @RuznyAhamed-v4x
    @RuznyAhamed-v4x ปีที่แล้ว +1

    Great! I have a question, what if you created those four subnets within four different availability zones ? will it work?

    • @listentolearn2363
      @listentolearn2363  ปีที่แล้ว

      sure, you can extend this to 4 azs and 4 subnets.

    • @RuznyAhamed-v4x
      @RuznyAhamed-v4x ปีที่แล้ว

      @@listentolearn2363yes, it may involve cross-AZ traffic. Cross-AZ traffic can incur additional data transfer costs compared to instances within the same AZ If I am not wrong

  • @etza
    @etza ปีที่แล้ว +1

    Yeah, is amazing tutorial, thank you very much!

  • @chandansharma9758
    @chandansharma9758 2 ปีที่แล้ว +1

    Really Very Nice explained 😊

  • @malicksylla886
    @malicksylla886 ปีที่แล้ว +1

    Great presentation :)! Subscribed ;)

  • @malicksylla886
    @malicksylla886 ปีที่แล้ว

    Have a question! Since we're not using the public subnet except for the ALB (and of course NAT Gw for EC2 in Private Subnets to get access to Internet...), I am wondering the need of the Internet GW? For me the IGW would be usefull if we need internet access for EC2 in public Sub... but in this case there is no EC2 in pub sub

    • @listentolearn2363
      @listentolearn2363  ปีที่แล้ว

      Good question!
      NAT gw is still dependent on the IGW for internet access (reference: aws.amazon.com/premiumsupport/knowledge-center/nat-gateway-vpc-private-subnet/)
      AWS has removed IGW dependency on NAT only for private communications (reference: aws.amazon.com/about-aws/whats-new/2021/06/aws-removes-nat-gateways-dependence-on-internet-gateway-for-private-communications/)
      More about NAT gw here, if you are interested (th-cam.com/video/NLgiUuGEHlY/w-d-xo.html).

  • @christopherh2579
    @christopherh2579 3 ปีที่แล้ว +1

    👋 Covered topic nicely

  • @TomKatsiroubas
    @TomKatsiroubas 2 ปีที่แล้ว

    Excellent work.

  • @Mersal-tq9lm
    @Mersal-tq9lm 2 ปีที่แล้ว

    Excellent video 👍

  • @David-jf4ee
    @David-jf4ee ปีที่แล้ว

    You enabled load balancer in public subnet and registered target group in private subnets. Can you please explain this part

    • @David-jf4ee
      @David-jf4ee ปีที่แล้ว

      Please correct me if I am wrong.... Ignore my above comment. So basically where we have enabled our load balancer in an AZ, our target group instances should also remain in that particular AZ. Is it a correct understanding?

    • @listentolearn2363
      @listentolearn2363  ปีที่แล้ว +1

      yes, that's correct!

  • @pranav2019
    @pranav2019 2 ปีที่แล้ว

    Why you not used nacl here?
    Videos are good

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว

      thanks! sure, can use nacl. it's is an additional layer of network security. It's there by default and it allows all traffic by default.. We can adjust that as per our needs. However, here am just sticking to security groups.

  • @vsr1727
    @vsr1727 3 ปีที่แล้ว

    Simple n good 👌👍

  • @ivannadanielacevallos2371
    @ivannadanielacevallos2371 ปีที่แล้ว

    I am trying to access with putty to the instance to modify the HTML but it is not working, can you please help me I am working in the same IP address I specify in the Security Group.

    • @listentolearn2363
      @listentolearn2363  ปีที่แล้ว

      Hi Ivanna,
      Since the instances are in private subnet, you have to use a bastion host to ssh into the instance. Please refer th-cam.com/video/jndBMIJ9gOI/w-d-xo.html to know how to setup a bastion host.
      Thanks.

  • @truthofthedecade
    @truthofthedecade 2 ปีที่แล้ว

    Do you teach private online classes??

  • @DeiseZen
    @DeiseZen 3 ปีที่แล้ว +1

    Thank you ;)

  • @NguyenTung-bz3yr
    @NguyenTung-bz3yr 2 ปีที่แล้ว

    Thank you so much!

  • @jashwaaradhya2989
    @jashwaaradhya2989 2 ปีที่แล้ว

    Hi, i am running a simple php server on the ec2, not matter what i do, the load balancer health check always says unhealthy. I have the same setup as yours, but i am just running a index.php using apache2. Please help

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว

      Could you please check the below settings -
      1. The security group associated with the servers allows port 80 access from LB security group
      2. The security group associated with the LB allows port 80 access from 0.0.0.0
      3. The NAT gateway and Internet gateways are attached to the private and public subnets respectively
      4. The health checks are configured correctly with appropriate settings as shown

  • @koulassrinitha
    @koulassrinitha 11 หลายเดือนก่อน +1

    how to connect nat to private network

    • @listentolearn2363
      @listentolearn2363  11 หลายเดือนก่อน

      Please refer to th-cam.com/video/NLgiUuGEHlY/w-d-xo.html. This explains about NAT gateways and how to create one.

  • @cajetanrahul5747
    @cajetanrahul5747 ปีที่แล้ว +1

    haha that enough talking was cute

  • @adinarayanareddy416
    @adinarayanareddy416 2 ปีที่แล้ว

    i have configured same way, but it's didn't workout. Servers are being unhealthy if we give public subnet while creating Load Balancer.

    • @listentolearn2363
      @listentolearn2363  2 ปีที่แล้ว

      Could you please check the below settings -
      1. The security group associated with the servers allows port 80 access from LB security group
      2. The security group associated with the LB allows port 80 access from 0.0.0.0
      3. The NAT gateway and Internet gateways are attached to the private and public subnets respectively
      4. The health checks are configured correctly with appropriate settings as shown

    • @pranav2019
      @pranav2019 2 ปีที่แล้ว

      Yes, facing the same issue
      And can you make a video how to trouble shoot load balancer

    • @pranav2019
      @pranav2019 2 ปีที่แล้ว

      In health checks we not defined the path,that may be issue?

    • @AndyCutright
      @AndyCutright 2 ปีที่แล้ว

      @@pranav2019 Did y'all figure out the problem?

    • @pranav2019
      @pranav2019 2 ปีที่แล้ว +1

      @@AndyCutright here in this video path is not defined
      I also don't know exactly, but I raised the question