Clustering Alloy on ECS

Is it possible to deploy Alloy as a cluster on ECS instead of a Kubernetes? It’s not clear on the docs.

Reference: Configure Grafana Alloy clustering in an existing installation | Grafana Alloy documentation

Thank you.

Yes, it can be done. There are two ways you can achieve this:

  1. Use AWS Cloud Map service discovery. You’ll need to make sure your Allow ECS service uses AWSVPC mode (so that each container has a unique IP), then create a Cloud Map service discovery record and make sure it’s A record. Then you can cluster your Alloy containers like so:
command = [
        "run",
        "--cluster.enabled=true",
        "--cluster.join-addresses=${service_discovery_a_record_name}",
        "--cluster.max-join-peers=0",
        "--cluster.name=${alloy_cluster_id}",
        "--server.http.listen-addr=0.0.0.0:${alloy_http_listen_port}",
        "--storage.path=${...}",
        "${config_path}/config.alloy"

Do note Cloud Map returns up to 8 DNS records, so you can at most run 8 Alloy containers in your cluster.

  1. There is a relatively new thing called AWS ECS service connect. My understanding is that it’s kinda like managed istio service mesh for ECS. This is probably a better solution, certainly so if you need more than 8 containers in your cluster. However I haven’t personally tried it so I can’t say whether it works or not.
1 Like