Enable stickiness for service@ecs

Hello!
I'm using ECS provider to configure services under my Traefik load balancer and everything works smoothly. Now I need to dynamically enable and disable stickiness to some services.

I've tried to create a {service-name}-stickiness.yml file under the watched directory with the following content:

http:
services:
{service-name}:
loadBalancer:
sticky:
cookie:
name: test-sticky
secure: true
httpOnly: true

I've noticed that in the services list exposed by the /api/http/services call the sticky configuration isn't added to the existing service@ecs but to another service-name@file service that doesn't exist.

I know that I cross-reference resources by appending "@provider-name" to the resource name, but if I do this in the yaml file key it won't work.

Any suggestions on how to enable and disable stickiness dynamically without touching ECS task definition?

Thank you

I don’t know ECS provider, but I would expect you create some Traefik settings there, like router.rule. I would assume you need to create the sticky config the same way (reference).

Thanks for the reply!

I know that I can configure stickiness directly with ECS provider, but in my case I need stickiness config to be indipendent from the rest of the service configuration.

How should that be possible? You need a Traefik router and a Traefik service, sometimes those are implicitly created by a provider. But a router always points to a single service.

My current docker labels are the following:

    "traefik.http.routers.router-website-prod.service": "service-polarity-website-prod",
    "traefik.http.routers.router-website-prod.tls": "true",
    "traefik.enable": "true",
    "traefik.http.services.service-website-prod.loadbalancer.server.port": "3000",
    "traefik.http.routers.router-website-prod.entrypoints": "websecure",
    "traefik.http.routers.router-website-prod.rule": "Host(`example.com`)"

My docker container is running as expected, but now I want to add stickiness.
As stated in Traefik Services Documentation - Traefik I can add stickiness to the service with the file provider, but it's not working because the other part of the dynamic service configuration is handled by the ECS provider.

I don't think it's possible to "split" a service definition into different places. Try to add the stickiness via labels.