Skip to content

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.

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,
});
const cluster = yield* Cluster("SecureCache", {
nodeType: "dax.t3.small",
replicationFactor: 3,
iamRoleArn: role.roleArn,
subnetGroupName: subnetGroup.subnetGroupName,
sseEnabled: true,
clusterEndpointEncryptionType: "TLS",
});