Enabling Sticky Sessions with an AWS Application Load Balancer (ALB) | AWS Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ค. 2024
  • In a prior video ( • Create an Application ... ), I introduced you to the basics of load balancing in AWS. We covered things like application load balancers (ALBs), target groups and more. In this video, we dig into a specific feature of an ALB, which is the concept of “stickiness” (otherwise known as “sticky sessions” or “session affinity”).
    After reviewing some basic concepts, I’ll show you in a hands-on demo how to enable stickiness on an ALB’s target group, and how to test it out in a browser.
    🌟🌟If you’re interested in getting AWS certifications, check out these full courses. They include lots of hands-on demos, quizzes and full practice exams. Use FRIENDS10 for a 10% discount!
    - AWS Certified Cloud Practitioner: academy.zerotomastery.io/a/af...
    - AWS Certified Solutions Architect Associate: academy.zerotomastery.io/a/af...
    You might also be interested in these videos:
    • Load balancing with multiple target groups: • Route Traffic to Multi...
    • Load balancing with the Elastic Container Service (ECS): • Amazon Elastic Contain...
    • Auto scaling groups: • Create an Auto Scaling...
    00:00 - A sticky load balancer-ewww!
    00:19 - How load balancing normally works in AWS (Round Robin)
    00:36 - What are sticky sessions (session affinity) and why would you use them?
    01:39 - Editing attributes on the target group to enable stickiness, with a load balancer-generated cookie
    02:13 - Testing the sticky session cookie (AWSALB) for 1 minute
    03:18 - Disabling stickiness on the load balancer’s target group
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    After watching so many videos in you tube. you were the best in explanation.

    • @TinyTechnicalTutorials
      @TinyTechnicalTutorials  17 วันที่ผ่านมา

      Yay! I'm so glad it helped. Thanks for watching and for such a nice comment!! 🙏🤓🌟

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

    Wow this information is pure gold, hope more people can watch this.

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

      Me too! 😄 Thanks so much for watching and for the nice comment!

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

    I love your videos. Thankyou so much Tiny!

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

    You deserve more subscribers and viewers - loved your content

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

    it is realy quick and to the point appreciate it :)

  • @user-ly4os3cv8k
    @user-ly4os3cv8k 8 หลายเดือนก่อน

    Simple and precise up to point with great example. Love your videos

    • @TinyTechnicalTutorials
      @TinyTechnicalTutorials  8 หลายเดือนก่อน

      I appreciate that! Thanks for supporting the channel! 🤓🙏🌟

  • @user-vh1bj8wb1d
    @user-vh1bj8wb1d ปีที่แล้ว

    this so helpful...get straight in my head....thnks a ton

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

    Very helpful, it saved my time, thank you

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

    simple and powerful tutorial

  • @ejyanezpvideo
    @ejyanezpvideo 9 หลายเดือนก่อน

    easy and to the point.😊

    • @TinyTechnicalTutorials
      @TinyTechnicalTutorials  9 หลายเดือนก่อน

      Yay! That's what I was going for! Thanks for watching! 🙏🌟🤓

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

    Hi Tina, my "target groups" don't even have "Attributes" tab shown. When I go by the "Actions" > "Edit attributes" from the dropdown menu, the popup box has "Stickiness" section but only "on/off" checkbox is inside. The stickiness "types" are entirely missing. (And the ELB itself has "Cross-zone load balancing" option enabled, even if that was the case)

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

      Hey Ark - So sorry for the delay on this. It looks like there have been some small UI changes, but the main "stickiness" options should still be there. I grabbed some screenshots here if this helps? drive.google.com/file/d/1G6JGhI6UVxlcdg-kqh9FyPNaoxU2e49Z/view?usp=share_link

  • @kinal37
    @kinal37 4 หลายเดือนก่อน +1

    Can we make that default stickyness cookies to non-persistent by update expire date to zero?

    • @TinyTechnicalTutorials
      @TinyTechnicalTutorials  4 หลายเดือนก่อน

      Hi Kinal! 👋 If you make the default cookies non-persistent, I'm wondering if you really need sticky sessions? Do you want requests to go to the same instance or the default round-robin approach?

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

    If there are multiple application server and sticky session off the sso stops working . How can we enable SSO with sticky session off

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

      Hi subhash! 😊 By default, sticky sessions are off, so in theory, shouldn't be affecting anything unless you enabled them. Also, sticky sessions are meant to save state within a session/application, not to be used for authentication across applications. But maybe I'm misunderstanding the question? 😊

  • @ankitagarwal6014
    @ankitagarwal6014 2 หลายเดือนก่อน +1

    What if my instances scale in and out? will it still maintain the stickiness?

    • @TinyTechnicalTutorials
      @TinyTechnicalTutorials  2 หลายเดือนก่อน

      Hi Ankit! 👋 Sorry for the delayed response. If you're still looking for an answer, maybe this will help?
      SCALING OUT (Adding Instances)
      -New Instances: When new instances are added to the pool due to scaling out, they start receiving new traffic. However, existing sessions (those already stickied to other instances) are not affected. Only new sessions can be directed to the new instances.
      -Sticky Sessions: Existing sticky sessions will continue to route to the same instances they were initially directed to, unless those instances are terminated or fail.
      SCALING IN (REMOVING INSTANCES)
      -Removing Instances: When instances are removed from the pool due to scaling in, this can affect sticky sessions. If an instance that is handling sticky sessions is terminated:
      --The sessions that were stickied to that instance will be interrupted.
      --The next time the client sends a request, the load balancer will select a new instance based on the current load balancing algorithm, and a new sticky session will start with the new instance.
      -Session Persistence: The key point is that sticky sessions do not migrate. If the instance to which they are stickied is removed, those sessions do not maintain their state but are rather reset and will need to re-establish on a new instance.

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

    Thanks for sharing the video. I was able to achieve the sticky session with AWS using a load balancer generated cookie. I am using ALB for navigating TCP requests to target groups. But I am facing issue with browser based application as I am unable to pass the cookie in headers section in websocket requests. Can you please suggest an alternative for achieving the stickyness with browser based applications

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

      Hi Pranith! 😊 Sorry for the delayed response. Were you able to sort this out? I haven't tried this with web sockets, but according to AWS, they're inherently sticky so you shouldn't need to implement anything? docs.aws.amazon.com/prescriptive-guidance/latest/load-balancer-stickiness/options.html

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

    I can't see option to "Edit Attributes" but "Edit Load Balancer Attributes" and clicking that doesn't show the options you are using. Is it dependent on region?

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

      Hi Kuldeep! Make sure you're editing the attributes for the target group, not the load balancer itself. I think that's probably the issue. 😊

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

      @@TinyTechnicalTutorials Thank you for the pin point help. I found it.

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

    please dont stop with aws .. love ur videos

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

      Awww, thanks so much, Syed! I plan to keep going! :)

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

      @@TinyTechnicalTutorials more power to u 🔥

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

      Wil u b able to upload realtime projects with AWS?

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

      Hey Syed! Can you clarify? Are you talking about doing live TH-cam sessions for AWS projects? Want to make sure I understand the question! :)

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

      @@TinyTechnicalTutorials yes basically AWS projects .. going from a small level to a good level where a person can say he is experienced in AWS after following ur tutorials .. if possible u can include docker and kubernetes.. if ur doing that I'll be fully committed to follow all those playlists u explain excellent I'm sure others wil also follow

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

    What a simple, clean and awesome looking presentation...What do you use to create it? Powerpoint (with some addons) or something else?

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

      Thanks for the nice comment, Amit! 😊 Yeah, it's just PowerPoint, with some animations. Nothing too fancy.

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

      @@TinyTechnicalTutorials Thats amazing eh!! Thanks from Canada.

  • @YourExcellency-gv3hl
    @YourExcellency-gv3hl ปีที่แล้ว

    Loved the video. Could you please share the Dockerfile script? I trying to create Docker image with "Hello World This is IP". So far no luck. Thank you in advance.

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

      Thank you, Your Excellency! :D I think you're talking about the User Data script that installs a web server and an index.html page? I put it into a Google Doc for you here: docs.google.com/document/d/1s8iNjZkDwq42fnpM-AeE27F1FEtbRYP24RicUi0VIbk/edit?usp=sharing. Hope that helps!

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

      And to get the IP address, in that script, update "$(hostname -f)" to "$(hostname -i)"

    • @YourExcellency-gv3hl
      @YourExcellency-gv3hl ปีที่แล้ว +1

      Thank you for your quick response. I appreciate it. In the video, you take the DNS record from load balancer and paste it into the browser. And you have the output that says "Hello World This is ip-172.31.22.245. internal, How I can have the same output?

    • @YourExcellency-gv3hl
      @YourExcellency-gv3hl ปีที่แล้ว +1

      I was creating load balancer for ECS Fargate

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

      Oh, gotcha. In that video, I was load balancing between EC2 instances, and used the User Data script to do the "hello world." I haven't done that with containers in ECS before, but I think this might get you started with the Dockerfile script? docs.aws.amazon.com/AmazonECS/latest/userguide/create-container-image.html. Or at least that should get you the static "Hello world" index.html page.
      Loading in a variable for IP address seems to be a bit more complicated. I found this example that displays hostname, using a Python script to get it (towards the end of the page): stackify.com/docker-tutorial/. Hope that sort of helps?

  • @edgardejesusmendozaortegon7655
    @edgardejesusmendozaortegon7655 8 หลายเดือนก่อน

    😍