-2

Scenario: If we have a single EC2 instance registered in loadbalancer (Target group) then it works fine. But registering another instance on Target Group breaks the Application.

If we deregister one of the instances then again works fine.

Both instances have a similar codebase and it works perfectly fine while testing individually and on loadbalancer as well.

Any Suggestions and feedbacks are much more appreciated.

kissu
  • 40,416
  • 14
  • 65
  • 133
dil pila
  • 3
  • 2
  • 2
    You have to be more specific than simply say "breaks the application". The application can "break" for countless reasons in countless ways and the solution will depend on those reasons – apokryfos Dec 29 '21 at 14:10

1 Answers1

-1

What you described looks like a problem with sessions, which means that your requests can jump from one to another server, losing the session data and breaking the application (seen this happening multiple times).

In order to fix that, you can enable Stickiness on your target group:

  1. Go to the target group
  2. Open Attributes tab
  3. Click on Edit button
  4. Check Stickiness checkbox and for type choose Load balancer generated cookie
  5. Set the duration that you want
  6. Click Save changes button
Caldazar
  • 2,801
  • 13
  • 21