Skip to content

Cluster.AWS reference

Source: packages/effect-cluster/src/AWS/Database.ts

The database an Effect Cluster coordinates through, on AWS, as a Cluster.Database Layer: Postgres on RDS, in a VPC of its own that the runners join. Every runner joins one security group, which reaches the database and the other runners on the runner port; nothing else does.

Postgres for the cluster

export const Database = ClusterAWS.Database("Cluster");

A larger instance with a standby

export const Database = ClusterAWS.Database("Cluster", {
instanceClass: "db.m7g.large",
multiAZ: true,
});

Source: packages/effect-cluster/src/AWS/EcsPool.ts

Run a pool of Effect Cluster runners on ECS Fargate: an ECS service whose tasks host every class given this pool, in the database’s VPC, behind a load balancer that serves their gateway to callers anywhere. Requires a database in an AWS VPC — ClusterAWS.Database.

Runners reach each other and the database through the cluster’s runner security group; the load balancer only reaches the gateway, which checks every call’s token.

Two runners on Fargate

export const Database = ClusterAWS.Database("Cluster");
export const Default = ClusterAWS.EcsPool("Default", { replicas: 2 }).pipe(
Layer.provide(Database),
);

Larger Graviton runners

export const Default = ClusterAWS.EcsPool("Default", {
cpu: 2048,
memory: 4096,
architecture: "ARM64",
}).pipe(Layer.provide(Database));