Skip to content

Cluster

Source: src/AWS/MemoryDB/Cluster.ts

An Amazon MemoryDB cluster — a durable, Redis/Valkey-compatible in-memory database.

Clusters take roughly 10-15 minutes to provision and are billed per node while they exist. They are reachable only from inside a VPC and require an ACL; place them in a SubnetGroup spanning multiple AZs for high availability. Destroy clusters you are not using.

const user = yield* User("CacheUser", {
authenticationMode: { type: "password", passwords: [cachePassword] },
accessString: "on ~* +@all",
});
const acl = yield* ACL("CacheAcl", { userNames: [user.userName] });
const subnetGroup = yield* SubnetGroup("CacheSubnets", {
subnetIds: [subnetA.subnetId, subnetB.subnetId],
});
const cluster = yield* Cluster("Cache", {
nodeType: "db.t4g.small",
aclName: acl.aclName,
subnetGroupName: subnetGroup.subnetGroupName,
numShards: 1,
numReplicasPerShard: 1,
});