Skip to content

AWS.MemoryDB reference

Source: src/AWS/MemoryDB/ACL.ts

A MemoryDB Access Control List (ACL) — a named collection of Users that a cluster authenticates against. Attach an ACL to a Cluster via aclName.

ACLs are free and provision quickly.

const appUser = yield* User("AppUser", {
authenticationMode: { type: "password", passwords: [appPassword] },
accessString: "on ~* +@all",
});
const acl = yield* ACL("AppAcl", {
userNames: [appUser.userName],
});

Source: src/AWS/MemoryDB/BatchUpdateCluster.ts

Runtime binding for the BatchUpdateCluster operation (IAM action memorydb:BatchUpdateCluster).

Applies a service update (security patch, engine upgrade) to a list of clusters — pair with DescribeServiceUpdates to build patch automation that applies available updates inside a maintenance window. Clusters that cannot take the update are returned in UnprocessedClusters (with the reason) rather than failing the call. Provide the implementation with Effect.provide(AWS.MemoryDB.BatchUpdateClusterHttp).

BatchUpdateCluster: Applying Service Updates

Section titled “BatchUpdateCluster: Applying Service Updates”
const batchUpdateCluster = yield* MemoryDB.BatchUpdateCluster();
const result = yield* batchUpdateCluster({
ClusterNames: [clusterName],
ServiceUpdate: { ServiceUpdateNameToApply: updateName },
});
// result.ProcessedClusters / result.UnprocessedClusters

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,
});

Source: src/AWS/MemoryDB/Connect.ts

Runtime binding that resolves connection settings for a MemoryDB Cluster.

At deploy time it publishes the cluster endpoint as MEMORYDB_{LOGICAL_ID}_{HOST,PORT,TLS} environment variables on the host Function and grants memorydb:Connect on the cluster (plus any IAM-auth Users passed via options.users); at runtime it resolves the same values into a typed ClusterConnectionInfo. Network access is governed by VPC security groups — the host Function must:

  1. be attached to the cluster’s VPC (vpc: { subnetIds, securityGroupIds } or the binding’s subnetIds/securityGroupIds options), and
  2. have a security group allowed ingress on the cluster’s port by one of the cluster’s securityGroupIds.

Provide the implementation with Effect.provide(AWS.MemoryDB.ConnectHttp).

// init — publishes env vars, grants memorydb:Connect, attaches the VPC
const connect = yield* AWS.MemoryDB.Connect(cluster, {
users: [appUser],
subnetIds: [subnetA.subnetId, subnetB.subnetId],
securityGroupIds: [appSecurityGroup.groupId],
});
// inside a handler:
const { host, port, tls } = yield* connect;

Source: src/AWS/MemoryDB/CopySnapshot.ts

Runtime binding for the CopySnapshot operation (IAM actions memorydb:CopySnapshot + memorydb:TagResource on the snapshot ARN wildcard — snapshot names are runtime data).

Makes a copy of an existing snapshot, optionally exporting it to an S3 bucket via TargetBucket. Provide the implementation with Effect.provide(AWS.MemoryDB.CopySnapshotHttp).

const copySnapshot = yield* MemoryDB.CopySnapshot();
const result = yield* copySnapshot({
SourceSnapshotName: "pre-migration",
TargetSnapshotName: "pre-migration-archive",
});
// result.Snapshot.Status → "creating"

Source: src/AWS/MemoryDB/CreateSnapshot.ts

Runtime binding for the CreateSnapshot operation (IAM actions memorydb:CreateSnapshot + memorydb:TagResource), scoped to one Cluster.

Takes an on-demand snapshot of the bound cluster — e.g. a pre-migration backup from an operational Lambda. Provide the implementation with Effect.provide(AWS.MemoryDB.CreateSnapshotHttp).

const createSnapshot = yield* MemoryDB.CreateSnapshot(cluster);
const result = yield* createSnapshot({ SnapshotName: "pre-migration" });
// result.Snapshot.Status → "creating"

Source: src/AWS/MemoryDB/DeleteSnapshot.ts

Runtime binding for the DeleteSnapshot operation (IAM action memorydb:DeleteSnapshot on the snapshot ARN wildcard — snapshot names are runtime data).

Deletes a snapshot by name — e.g. pruning old on-demand backups from a scheduled cleanup Lambda. Provide the implementation with Effect.provide(AWS.MemoryDB.DeleteSnapshotHttp).

const deleteSnapshot = yield* MemoryDB.DeleteSnapshot();
yield* deleteSnapshot({ SnapshotName: "pre-migration" }).pipe(
Effect.catchTag("SnapshotNotFoundFault", () => Effect.void),
);

Source: src/AWS/MemoryDB/DescribeClusters.ts

Runtime binding for the DescribeClusters operation (IAM action memorydb:DescribeClusters).

Lists the account’s MemoryDB clusters, or describes a single cluster by name — e.g. checking a cluster’s status or endpoint from an operational Lambda. Provide the implementation with Effect.provide(AWS.MemoryDB.DescribeClustersHttp).

const describeClusters = yield* MemoryDB.DescribeClusters();
const page = yield* describeClusters({ ClusterName: clusterName });
// page.Clusters[0].Status → "available"

Source: src/AWS/MemoryDB/DescribeEngineVersions.ts

Runtime binding for the DescribeEngineVersions operation (IAM action memorydb:DescribeEngineVersions).

Lists the engine versions MemoryDB supports (redis/valkey) and their parameter group families — e.g. upgrade automation that checks whether a newer engine version is available before scheduling a cluster update. Provide the implementation with Effect.provide(AWS.MemoryDB.DescribeEngineVersionsHttp).

DescribeEngineVersions: Applying Service Updates

Section titled “DescribeEngineVersions: Applying Service Updates”
const describeEngineVersions = yield* MemoryDB.DescribeEngineVersions();
const page = yield* describeEngineVersions({ Engine: "valkey" });
// page.EngineVersions[0].EngineVersion

Source: src/AWS/MemoryDB/DescribeEvents.ts

Runtime binding for the DescribeEvents operation (IAM action memorydb:DescribeEvents).

Returns events related to clusters, security groups, and parameter groups from the last hour (up to 14 days with an explicit time window) — snapshot completions, failovers, configuration changes. Provide the implementation with Effect.provide(AWS.MemoryDB.DescribeEventsHttp).

const describeEvents = yield* MemoryDB.DescribeEvents();
const page = yield* describeEvents({
SourceName: clusterName,
SourceType: "cluster",
});
for (const event of page.Events ?? []) {
yield* Effect.logInfo(`${event.Date}: ${event.Message}`);
}

Source: src/AWS/MemoryDB/DescribeServiceUpdates.ts

Runtime binding for the DescribeServiceUpdates operation (IAM action memorydb:DescribeServiceUpdates).

Lists the service updates (security patches, engine upgrades) available or scheduled for the account’s clusters — pair with BatchUpdateCluster to build patch automation. Provide the implementation with Effect.provide(AWS.MemoryDB.DescribeServiceUpdatesHttp).

DescribeServiceUpdates: Applying Service Updates

Section titled “DescribeServiceUpdates: Applying Service Updates”
const describeServiceUpdates = yield* MemoryDB.DescribeServiceUpdates();
const page = yield* describeServiceUpdates({ Status: ["available"] });
// page.ServiceUpdates[0].ServiceUpdateName

Source: src/AWS/MemoryDB/DescribeSnapshots.ts

Runtime binding for the DescribeSnapshots operation (IAM action memorydb:DescribeSnapshots).

Lists the account’s cluster snapshots, optionally filtered by cluster or snapshot name — e.g. verifying a backup completed before a migration. Provide the implementation with Effect.provide(AWS.MemoryDB.DescribeSnapshotsHttp).

const describeSnapshots = yield* MemoryDB.DescribeSnapshots();
const page = yield* describeSnapshots({ ClusterName: clusterName });
for (const snapshot of page.Snapshots ?? []) {
yield* Effect.logInfo(`${snapshot.Name}: ${snapshot.Status}`);
}

Source: src/AWS/MemoryDB/FailoverShard.ts

Runtime binding for the FailoverShard operation (IAM action memorydb:FailoverShard), scoped to one Cluster.

Fails over a shard’s primary node to a replica — designed for testing how your application behaves during a MemoryDB failover (chaos testing), not as a production remediation tool. Provide the implementation with Effect.provide(AWS.MemoryDB.FailoverShardHttp).

const failoverShard = yield* MemoryDB.FailoverShard(cluster);
const result = yield* failoverShard({ ShardName: "0001" });
// result.Cluster.Status → "updating"

Source: src/AWS/MemoryDB/ListAllowedNodeTypeUpdates.ts

Runtime binding for the ListAllowedNodeTypeUpdates operation (IAM action memorydb:ListAllowedNodeTypeUpdates), scoped to one Cluster.

Lists the node types the bound cluster can scale up or down to — e.g. right-sizing automation that checks the legal targets before calling UpdateCluster. Provide the implementation with Effect.provide(AWS.MemoryDB.ListAllowedNodeTypeUpdatesHttp).

ListAllowedNodeTypeUpdates: Monitoring Clusters

Section titled “ListAllowedNodeTypeUpdates: Monitoring Clusters”
const listAllowedNodeTypeUpdates =
yield* MemoryDB.ListAllowedNodeTypeUpdates(cluster);
const result = yield* listAllowedNodeTypeUpdates();
// result.ScaleUpNodeTypes / result.ScaleDownNodeTypes

Source: src/AWS/MemoryDB/ParameterGroup.ts

A MemoryDB parameter group — a named collection of engine parameter overrides applied to every node of any Cluster that references it via parameterGroupName.

Parameter groups are free and provision instantly. Parameters not listed keep their engine defaults; removing a parameter from parameters resets it to the default.

ParameterGroup: Creating a Parameter Group

Section titled “ParameterGroup: Creating a Parameter Group”
const params = yield* ParameterGroup("CacheParams", {
family: "memorydb_valkey7",
description: "LRU eviction for the session cache",
parameters: { "maxmemory-policy": "allkeys-lru" },
});
const cluster = yield* Cluster("Cache", {
aclName: acl.aclName,
parameterGroupName: params.parameterGroupName,
});

Source: src/AWS/MemoryDB/SubnetGroup.ts

A MemoryDB subnet group — the set of VPC subnets a MemoryDB cluster’s nodes are placed into.

Subnet groups are free and provision instantly. A cluster references one by name via subnetGroupName.

const subnetGroup = yield* SubnetGroup("CacheSubnets", {
description: "MemoryDB cluster subnets",
subnetIds: [subnetA.subnetId, subnetB.subnetId],
});

Source: src/AWS/MemoryDB/User.ts

A MemoryDB user — an RBAC identity that authenticates to a cluster and is granted permissions through an access string. Users are grouped into ACLs, which are attached to clusters.

Users are free and provision quickly. Passwords are write-only.

Password User with Full Access

const user = yield* User("AppUser", {
authenticationMode: { type: "password", passwords: [appPassword] },
accessString: "on ~* +@all",
});

IAM-Authenticated User

const user = yield* User("IamUser", {
userName: "iam-app-user",
authenticationMode: { type: "iam" },
accessString: "on ~* +@all",
});