Skip to content

DAX

CloudMock emulates Amazon DynamoDB Accelerator (DAX), providing a fully in-memory mock of the DAX control plane API. DAX is an in-memory cache for DynamoDB that delivers up to 10x performance improvement. CloudMock supports cluster management, subnet groups, parameter groups, and tagging.

OperationStatusNotes
CreateClusterSupportedCreates a DAX cluster with proper ARN (arn:aws:dax:{region}:{account}:cache/{name})
DescribeClustersSupportedLists all clusters or filters by name
UpdateClusterSupportedUpdates description, maintenance window, notification topic
DeleteClusterSupportedDeletes a cluster (returns cluster in deleting state)
IncreaseReplicationFactorSupportedAdds nodes to an existing cluster
DecreaseReplicationFactorSupportedRemoves nodes from an existing cluster
CreateSubnetGroupSupportedCreates a subnet group
DescribeSubnetGroupsSupportedLists subnet groups
DeleteSubnetGroupSupportedDeletes a subnet group
CreateParameterGroupSupportedCreates a parameter group
DescribeParameterGroupsSupportedLists parameter groups
UpdateParameterGroupSupportedUpdates parameters in a parameter group
DeleteParameterGroupSupportedDeletes a parameter group
DescribeParametersSupportedReturns parameters for a given group
DescribeDefaultParametersSupportedReturns default DAX parameters
TagResourceSupportedAdds tags to a cluster by ARN
UntagResourceSupportedRemoves tags from a cluster
ListTagsSupportedLists tags for a cluster

DAX clusters progress through the following states:

StateDescription
creatingCluster is being provisioned
availableCluster is ready for use
modifyingCluster configuration is being updated
deletingCluster is being deleted

In CloudMock, clusters transition from creating to available nearly instantly (lifecycle machine with delays disabled in test mode).

import { DAXClient, CreateClusterCommand, DescribeClustersCommand } from '@aws-sdk/client-dax';
const client = new DAXClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
// Create a cluster
const { Cluster } = await client.send(new CreateClusterCommand({
ClusterName: 'my-dax-cluster',
NodeType: 'dax.r4.large',
ReplicationFactor: 3,
IamRoleArn: 'arn:aws:iam::123456789012:role/AmazonDAXFullAccess',
SubnetGroupName: 'my-subnet-group',
}));
console.log(Cluster.ClusterArn);
// arn:aws:dax:us-east-1:123456789012:cache/my-dax-cluster
// List clusters
const { Clusters } = await client.send(new DescribeClustersCommand({}));
console.log(Clusters.length);
import boto3
client = boto3.client('dax',
endpoint_url='http://localhost:4566',
region_name='us-east-1',
aws_access_key_id='test',
aws_secret_access_key='test')
# Create a cluster
response = client.create_cluster(
ClusterName='my-dax-cluster',
NodeType='dax.r4.large',
ReplicationFactor=3,
IamRoleArn='arn:aws:iam::123456789012:role/AmazonDAXFullAccess',
SubnetGroupName='my-subnet-group')
print(response['Cluster']['ClusterArn'])
# Create a parameter group
pg = client.create_parameter_group(
ParameterGroupName='my-params',
Description='Custom DAX parameters')
# Update a parameter
client.update_parameter_group(
ParameterGroupName='my-params',
ParameterNameValues=[
{'ParameterName': 'query-ttl-millis', 'ParameterValue': '600000'},
{'ParameterName': 'record-ttl-millis', 'ParameterValue': '600000'},
])
cloudmock.yml
services:
dax:
enabled: true

DAX cluster ARNs follow this format:

arn:aws:dax:{region}:{account-id}:cache/{cluster-name}

CloudMock provides the following default DAX parameters:

ParameterDefault ValueDescription
query-ttl-millis300000TTL for cached query results (5 minutes)
record-ttl-millis300000TTL for cached item records (5 minutes)
  • Cluster endpoints are synthetic DNS names and do not accept real DAX protocol connections
  • Node types are not validated against available DAX node type catalog
  • Availability zone placement is simulated
  • Cluster encryption (SSE) is tracked but not enforced
  • No VPC subnet validation is performed