AWS.DAX reference
Cluster
Section titled “Cluster”Source:
src/AWS/DAX/Cluster.ts
An Amazon DAX cluster — a fully managed, in-memory write-through cache for DynamoDB.
Clusters are VPC-only and take roughly 5-10 minutes to provision; they are
billed per node-hour while they exist. Place them in a SubnetGroup
and give them an IAM role that DAX assumes to reach DynamoDB. Destroy
clusters you are not using.
Cluster: Creating a Cluster
Section titled “Cluster: Creating a Cluster”const role = yield* IAM.Role("DaxRole", { assumeRolePolicyDocument: { Version: "2012-10-17", Statement: [{ Effect: "Allow", Principal: { Service: "dax.amazonaws.com" }, Action: ["sts:AssumeRole"], }], }, managedPolicyArns: ["arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess"],});const subnetGroup = yield* SubnetGroup("DaxSubnets", { subnetIds: [subnetA.subnetId, subnetB.subnetId],});const cluster = yield* Cluster("Cache", { nodeType: "dax.t3.small", replicationFactor: 1, iamRoleArn: role.roleArn, subnetGroupName: subnetGroup.subnetGroupName,});Cluster: Encryption
Section titled “Cluster: Encryption”const cluster = yield* Cluster("SecureCache", { nodeType: "dax.t3.small", replicationFactor: 3, iamRoleArn: role.roleArn, subnetGroupName: subnetGroup.subnetGroupName, sseEnabled: true, clusterEndpointEncryptionType: "TLS",});ConnectRead
Section titled “ConnectRead”Source:
src/AWS/DAX/Connect.ts
Read-only runtime access to a DAX Cluster’s data plane.
Grants the read-side DAX IAM actions (dax:GetItem, dax:BatchGetItem,
dax:Query, dax:Scan, plus the protocol actions every DAX client
needs) on the cluster ARN, publishes the discovery endpoint as environment
variables on the host Function, and resolves a typed
ClusterConnectionInfo at runtime.
The DAX data plane is VPC-only — the host Function must be attached to the
cluster’s VPC and allowed ingress by the cluster’s security groups.
Provide the implementation with Effect.provide(AWS.DAX.ConnectReadHttp).
ConnectRead: Connecting to a Cluster
Section titled “ConnectRead: Connecting to a Cluster”const connect = yield* DAX.ConnectRead(cluster);// inside a handler:const { url, tls } = yield* connect;DecreaseReplicationFactor
Section titled “DecreaseReplicationFactor”Source:
src/AWS/DAX/DecreaseReplicationFactor.ts
Runtime binding for the DecreaseReplicationFactor operation (IAM action
dax:DecreaseReplicationFactor), scoped to one Cluster.
Removes read-replica nodes from the bound DAX cluster — the scale-in half
of node-count automation (e.g. shrinking a cluster off-peak to cut
node-hour cost). Provide the implementation with
Effect.provide(AWS.DAX.DecreaseReplicationFactorHttp).
DecreaseReplicationFactor: Scaling a Cluster
Section titled “DecreaseReplicationFactor: Scaling a Cluster”const decreaseReplicationFactor = yield* DAX.DecreaseReplicationFactor(cluster);
const result = yield* decreaseReplicationFactor({ NewReplicationFactor: 1,});// result.Cluster?.TotalNodes → 1 once the removal completesDescribeClusters
Section titled “DescribeClusters”Source:
src/AWS/DAX/DescribeClusters.ts
Runtime binding for the DescribeClusters operation (IAM action
dax:DescribeClusters).
Lists the account’s DAX clusters (optionally filtered by name) with node
status, endpoints and configuration embedded — the building block of
cluster-health monitoring and node-reboot automation. Provide the
implementation with Effect.provide(AWS.DAX.DescribeClustersHttp).
DescribeClusters: Monitoring Clusters
Section titled “DescribeClusters: Monitoring Clusters”const describeClusters = yield* DAX.DescribeClusters();
const page = yield* describeClusters({ ClusterNames: [clusterName] });const available = page.Clusters?.[0]?.Nodes?.filter( (node) => node.NodeStatus === "available",);DescribeEvents
Section titled “DescribeEvents”Source:
src/AWS/DAX/DescribeEvents.ts
Runtime binding for the DescribeEvents operation (IAM action
dax:DescribeEvents).
Returns events related to DAX clusters and parameter groups from the last
24 hours (up to 14 days with an explicit time window) — node reboots,
failovers, configuration changes. Provide the implementation with
Effect.provide(AWS.DAX.DescribeEventsHttp).
DescribeEvents: Monitoring Clusters
Section titled “DescribeEvents: Monitoring Clusters”const describeEvents = yield* DAX.DescribeEvents();
const page = yield* describeEvents({ SourceName: clusterName, SourceType: "CLUSTER",});for (const event of page.Events ?? []) { yield* Effect.logInfo(`${event.Date}: ${event.Message}`);}IncreaseReplicationFactor
Section titled “IncreaseReplicationFactor”Source:
src/AWS/DAX/IncreaseReplicationFactor.ts
Runtime binding for the IncreaseReplicationFactor operation (IAM action
dax:IncreaseReplicationFactor), scoped to one Cluster.
Adds read-replica nodes to the bound DAX cluster — the building block of
scale-out automation (e.g. a Lambda reacting to a CloudWatch alarm on
cluster CPU or cache-miss rate). Provide the implementation with
Effect.provide(AWS.DAX.IncreaseReplicationFactorHttp).
IncreaseReplicationFactor: Scaling a Cluster
Section titled “IncreaseReplicationFactor: Scaling a Cluster”const increaseReplicationFactor = yield* DAX.IncreaseReplicationFactor(cluster);
const result = yield* increaseReplicationFactor({ NewReplicationFactor: 3,});// result.Cluster?.TotalNodes → 3 (new nodes provision asynchronously)ParameterGroup
Section titled “ParameterGroup”Source:
src/AWS/DAX/ParameterGroup.ts
A DAX parameter group — a named set of DAX engine parameters (item and
query cache TTLs) that can be attached to one or more DAX
Clusters.
Parameter groups are free and provision instantly. DAX does not support tags on parameter groups.
ParameterGroup: Creating a Parameter Group
Section titled “ParameterGroup: Creating a Parameter Group”const params = yield* ParameterGroup("DaxParams", { description: "5 minute item and query TTLs", parameters: { "query-ttl-millis": "300000", "record-ttl-millis": "300000", },});ParameterGroup: Attaching to a Cluster
Section titled “ParameterGroup: Attaching to a Cluster”const cluster = yield* Cluster("Cache", { nodeType: "dax.t3.small", replicationFactor: 1, iamRoleArn: role.roleArn, parameterGroupName: params.parameterGroupName,});RebootNode
Section titled “RebootNode”Source:
src/AWS/DAX/RebootNode.ts
Runtime binding for the RebootNode operation (IAM action
dax:RebootNode), scoped to one Cluster.
Reboots a single node of the bound DAX cluster — restarts the DAX engine
process without flushing the cache contents. The node id comes from
DescribeClusters (e.g. my-cluster-a). Provide the implementation with
Effect.provide(AWS.DAX.RebootNodeHttp).
RebootNode: Operating a Cluster
Section titled “RebootNode: Operating a Cluster”const rebootNode = yield* DAX.RebootNode(cluster);
const result = yield* rebootNode({ NodeId: nodeId });// result.Cluster?.Nodes → the node reports status "rebooting"SubnetGroup
Section titled “SubnetGroup”Source:
src/AWS/DAX/SubnetGroup.ts
A DAX subnet group — the set of VPC subnets a DAX cluster’s nodes are placed into.
Subnet groups are free and provision instantly. A Cluster
references one by name via subnetGroupName. DAX does not support tags on
subnet groups.
SubnetGroup: Creating a Subnet Group
Section titled “SubnetGroup: Creating a Subnet Group”const subnetGroup = yield* SubnetGroup("DaxSubnets", { description: "DAX cluster subnets", subnetIds: [subnetA.subnetId, subnetB.subnetId],});SubnetGroup: Placing a Cluster
Section titled “SubnetGroup: Placing a Cluster”const cluster = yield* Cluster("Cache", { nodeType: "dax.t3.small", replicationFactor: 1, iamRoleArn: role.roleArn, subnetGroupName: subnetGroup.subnetGroupName,});