AWS.ElastiCache reference
CacheCluster
Section titled “CacheCluster”Source:
src/AWS/ElastiCache/CacheCluster.ts
A provisioned Memcached cluster. Use ReplicationGroup for Valkey or Redis.
CacheCluster: Creating a Memcached Cluster
Section titled “CacheCluster: Creating a Memcached Cluster”const cache = yield* CacheCluster("Cache", { subnetGroupName: subnets.subnetGroupName, securityGroupIds: [cacheSecurityGroup.groupId], numCacheNodes: 2,});Connect
Section titled “Connect”Source:
src/AWS/ElastiCache/Connect.ts
Runtime binding that resolves connection settings for an ElastiCache serverless cache.
This is an environment-only binding: ElastiCache has no IAM-gated data
plane for classic (non-RBAC) access, so the binding injects the cache’s
endpoint host/port as environment variables on the host Function and
returns a typed CacheConnectionInfo at runtime. Network access is
governed by VPC security groups, NOT IAM — the host Function must:
- be attached to the cache’s VPC (
vpc: { subnetIds, securityGroupIds }), and - have a security group allowed ingress on the cache’s port by one of the
cache’s
securityGroupIds.
Connect: Connecting to a Cache
Section titled “Connect: Connecting to a Cache”const connect = yield* ElastiCache.Connect(cache);// inside a handler:const { host, port, tls } = yield* connect;ConnectCacheCluster
Section titled “ConnectCacheCluster”Source:
src/AWS/ElastiCache/ConnectCacheCluster.ts
Runtime binding for a provisioned Memcached cluster.
At deploy time it publishes all node endpoints as
ELASTICACHE_{LOGICAL_ID}_ENDPOINTS on the host Function. Passing VPC
options attaches the host Lambda to the cache network. ElastiCache data
plane access is controlled by security groups, not IAM.
ConnectCacheCluster: Connecting from a Lambda
Section titled “ConnectCacheCluster: Connecting from a Lambda”const connect = yield* AWS.ElastiCache.ConnectCacheCluster(cache, { subnetIds: privateSubnetIds, securityGroupIds: [functionSecurityGroup.groupId],});
// inside the handler:const { endpoints } = yield* connect;const endpoint = endpoints[0];ConnectReplicationGroup
Section titled “ConnectReplicationGroup”Source:
src/AWS/ElastiCache/ConnectReplicationGroup.ts
Runtime binding for a provisioned Valkey or Redis OSS replication group.
At deploy time it publishes the primary endpoint and TLS setting as
ELASTICACHE_{LOGICAL_ID}_{HOST,PORT,TLS} variables on the host Function.
When replicas exist, it also publishes the reader endpoint. Passing VPC
options attaches the host Lambda to the cache network. ElastiCache data
plane access is controlled by security groups, not IAM.
ConnectReplicationGroup: Connecting from a Lambda
Section titled “ConnectReplicationGroup: Connecting from a Lambda”const connect = yield* AWS.ElastiCache.ConnectReplicationGroup(cache, { subnetIds: privateSubnetIds, securityGroupIds: [functionSecurityGroup.groupId],});
// inside the handler:const { host, port, tls } = yield* connect;const client = new Valkey({ host, port, ...(tls ? { tls: {} } : {}) });CopyServerlessCacheSnapshot
Section titled “CopyServerlessCacheSnapshot”Source:
src/AWS/ElastiCache/CopyServerlessCacheSnapshot.ts
Runtime binding for the CopyServerlessCacheSnapshot operation (IAM
actions elasticache:CopyServerlessCacheSnapshot +
elasticache:AddTagsToResource).
Copies an existing serverless cache snapshot, optionally re-encrypting it
under a different KMS key — e.g. duplicating a nightly backup before a
risky migration. Available for valkey, redis, and serverless memcached.
Provide the implementation with
Effect.provide(AWS.ElastiCache.CopyServerlessCacheSnapshotHttp).
CopyServerlessCacheSnapshot: Managing Snapshots
Section titled “CopyServerlessCacheSnapshot: Managing Snapshots”const copySnapshot = yield* ElastiCache.CopyServerlessCacheSnapshot();
const result = yield* copySnapshot({ SourceServerlessCacheSnapshotName: "nightly", TargetServerlessCacheSnapshotName: "pre-migration",});CreateServerlessCacheSnapshot
Section titled “CreateServerlessCacheSnapshot”Source:
src/AWS/ElastiCache/CreateServerlessCacheSnapshot.ts
Runtime binding for the CreateServerlessCacheSnapshot operation (IAM
actions elasticache:CreateServerlessCacheSnapshot +
elasticache:AddTagsToResource), scoped to one ServerlessCache.
Takes an on-demand snapshot of the bound serverless cache — e.g. a
pre-migration backup from an operational Lambda. Available for valkey,
redis, and serverless memcached. Provide the implementation with
Effect.provide(AWS.ElastiCache.CreateServerlessCacheSnapshotHttp).
CreateServerlessCacheSnapshot: Managing Snapshots
Section titled “CreateServerlessCacheSnapshot: Managing Snapshots”const createSnapshot = yield* ElastiCache.CreateServerlessCacheSnapshot(cache);
const result = yield* createSnapshot({ ServerlessCacheSnapshotName: "pre-migration",});// result.ServerlessCacheSnapshot.Status → "creating"DeleteServerlessCacheSnapshot
Section titled “DeleteServerlessCacheSnapshot”Source:
src/AWS/ElastiCache/DeleteServerlessCacheSnapshot.ts
Runtime binding for the DeleteServerlessCacheSnapshot operation (IAM
action elasticache:DeleteServerlessCacheSnapshot).
Deletes a serverless cache snapshot by name — e.g. rotating out old manual
backups from a maintenance Lambda. Available for valkey, redis, and
serverless memcached. Provide the implementation with
Effect.provide(AWS.ElastiCache.DeleteServerlessCacheSnapshotHttp).
DeleteServerlessCacheSnapshot: Managing Snapshots
Section titled “DeleteServerlessCacheSnapshot: Managing Snapshots”const deleteSnapshot = yield* ElastiCache.DeleteServerlessCacheSnapshot();
yield* deleteSnapshot({ ServerlessCacheSnapshotName: "pre-migration" }).pipe( Effect.catchTag("ServerlessCacheSnapshotNotFoundFault", () => Effect.void),);DescribeEvents
Section titled “DescribeEvents”Source:
src/AWS/ElastiCache/DescribeEvents.ts
Runtime binding for the DescribeEvents operation (IAM action
elasticache:DescribeEvents).
Returns events related to caches, replication groups, 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.ElastiCache.DescribeEventsHttp).
DescribeEvents: Monitoring Caches
Section titled “DescribeEvents: Monitoring Caches”const describeEvents = yield* ElastiCache.DescribeEvents();
const page = yield* describeEvents({ SourceIdentifier: cacheName, SourceType: "serverless-cache",});for (const event of page.Events ?? []) { yield* Effect.logInfo(`${event.Date}: ${event.Message}`);}DescribeServerlessCaches
Section titled “DescribeServerlessCaches”Source:
src/AWS/ElastiCache/DescribeServerlessCaches.ts
Runtime binding for the DescribeServerlessCaches operation (IAM action
elasticache:DescribeServerlessCaches).
Reads the current status, endpoint, and configuration of the account’s
serverless caches — e.g. an operational health check that verifies a cache
is available before routing traffic. Provide the implementation with
Effect.provide(AWS.ElastiCache.DescribeServerlessCachesHttp).
DescribeServerlessCaches: Monitoring Caches
Section titled “DescribeServerlessCaches: Monitoring Caches”const describeCaches = yield* ElastiCache.DescribeServerlessCaches();
const result = yield* describeCaches({ ServerlessCacheName: name });// result.ServerlessCaches?.[0]?.Status → "available"DescribeServerlessCacheSnapshots
Section titled “DescribeServerlessCacheSnapshots”Source:
src/AWS/ElastiCache/DescribeServerlessCacheSnapshots.ts
Runtime binding for the DescribeServerlessCacheSnapshots operation (IAM
action elasticache:DescribeServerlessCacheSnapshots).
Lists serverless cache snapshots — all of them, one by name, or those of a
particular cache. Available for valkey, redis, and serverless memcached.
Provide the implementation with
Effect.provide(AWS.ElastiCache.DescribeServerlessCacheSnapshotsHttp).
DescribeServerlessCacheSnapshots: Managing Snapshots
Section titled “DescribeServerlessCacheSnapshots: Managing Snapshots”const describeSnapshots = yield* ElastiCache.DescribeServerlessCacheSnapshots();
const result = yield* describeSnapshots({ ServerlessCacheName: name });for (const snapshot of result.ServerlessCacheSnapshots ?? []) { yield* Effect.logInfo(`${snapshot.ServerlessCacheSnapshotName}: ${snapshot.Status}`);}ExportServerlessCacheSnapshot
Section titled “ExportServerlessCacheSnapshot”Source:
src/AWS/ElastiCache/ExportServerlessCacheSnapshot.ts
Runtime binding for the ExportServerlessCacheSnapshot operation (IAM
action elasticache:ExportServerlessCacheSnapshot).
Exports a serverless cache snapshot’s data to an S3 bucket — e.g. shipping
a backup out of ElastiCache for offline analysis or cross-account
restore. Available for valkey and redis only. The target bucket must grant
the ElastiCache service access via its bucket policy. Provide the
implementation with
Effect.provide(AWS.ElastiCache.ExportServerlessCacheSnapshotHttp).
ExportServerlessCacheSnapshot: Managing Snapshots
Section titled “ExportServerlessCacheSnapshot: Managing Snapshots”const exportSnapshot = yield* ElastiCache.ExportServerlessCacheSnapshot();
yield* exportSnapshot({ ServerlessCacheSnapshotName: "nightly", S3BucketName: "my-backup-bucket",});ReplicationGroup
Section titled “ReplicationGroup”Source:
src/AWS/ElastiCache/ReplicationGroup.ts
A provisioned Valkey or Redis OSS replication group.
ReplicationGroup: Creating a Highly Available Cache
Section titled “ReplicationGroup: Creating a Highly Available Cache”const cache = yield* ReplicationGroup("Cache", { description: "application cache", engine: "valkey", subnetGroupName: subnets.subnetGroupName, securityGroupIds: [cacheSecurityGroup.groupId], replicasPerNodeGroup: 1, automaticFailoverEnabled: true, multiAzEnabled: true, transitEncryptionEnabled: true,});ServerlessCache
Section titled “ServerlessCache”Source:
src/AWS/ElastiCache/ServerlessCache.ts
An Amazon ElastiCache serverless cache (valkey, redis, or memcached).
Serverless caches scale storage and compute automatically and are only
reachable from inside a VPC. They are metered while they exist (with a
monthly minimum), so set cacheUsageLimits and destroy caches you are
not using.
ServerlessCache: Creating a Serverless Cache
Section titled “ServerlessCache: Creating a Serverless Cache”Valkey Cache with Cost-Control Limits
const cache = yield* ServerlessCache("SessionCache", { engine: "valkey", cacheUsageLimits: { dataStorage: { maximum: 1 }, ecpuPerSecond: { maximum: 1000 }, },});Redis Cache in Specific Subnets
const cache = yield* ServerlessCache("Cache", { engine: "redis", majorEngineVersion: "7", subnetIds: [subnetA.subnetId, subnetB.subnetId], securityGroupIds: [cacheSecurityGroup.securityGroupId],});ServerlessCache: Connecting from a Lambda Function
Section titled “ServerlessCache: Connecting from a Lambda Function”const connect = yield* ElastiCache.Connect(cache);// inside a handler:const { host, port, tls } = yield* connect;SubnetGroup
Section titled “SubnetGroup”Source:
src/AWS/ElastiCache/SubnetGroup.ts
A VPC subnet group for provisioned ElastiCache resources.
SubnetGroup: Creating a Subnet Group
Section titled “SubnetGroup: Creating a Subnet Group”const subnets = yield* SubnetGroup("CacheSubnets", { description: "cache subnets", subnetIds: [subnetA.subnetId, subnetB.subnetId],});