Skip to content

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.

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: {} } : {}) });