OpenMCF logoOpenMCF

Loading...

AWS Memcached ElastiCache

Deploys a fully managed AWS ElastiCache cluster running the Memcached engine with automatic subnet group and parameter group management. Memcached provides a simple, high-throughput distributed cache using consistent hashing across nodes, with no replication, no persistence, and no authentication — security relies entirely on VPC network isolation.

What Gets Created

When you deploy an AwsMemcachedElasticache resource, OpenMCF provisions:

  • ElastiCache Memcached Cluster — an aws_elasticache_cluster with the memcached engine, placed in the specified subnets with attached security groups
  • Subnet Group — created automatically when subnetIds are provided, grouping the subnets for cluster node placement
  • Parameter Group — created automatically when parameters are provided along with a parameterGroupFamily, enabling custom Memcached engine tuning

Prerequisites

  • AWS credentials configured via environment variables or OpenMCF provider config
  • A VPC with private subnets for cluster node placement (subnets in at least two AZs when using cross-az mode)
  • A security group allowing inbound traffic on the Memcached port (default 11211) — since Memcached has no authentication, security groups are the primary access control mechanism

Quick Start

Create a file memcached.yaml:

apiVersion: aws.openmcf.org/v1
kind: AwsMemcachedElasticache
metadata:
  name: my-cache
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.AwsMemcachedElasticache.my-cache
spec:
  region: us-west-2
  engineVersion: "1.6.22"
  nodeType: cache.t3.micro
  numCacheNodes: 1
  subnetIds:
    - subnet-0a1b2c3d4e5f00001
    - subnet-0a1b2c3d4e5f00002
  securityGroupIds:
    - sg-0a1b2c3d4e5f00001

Deploy:

openmcf apply -f memcached.yaml

This creates a single-node Memcached cluster on port 11211 in the specified subnets.

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
regionstringAWS region where the ElastiCache cluster will be deployed (e.g., "us-west-2", "us-east-1").Required
engineVersionstringMemcached engine version. Uses three-part versioning (e.g., "1.6.22", "1.6.17", "1.5.16"). Transit encryption requires 1.6.12 or later.Required
nodeTypestringElastiCache node type determining CPU, memory, and network capacity. Examples: cache.t3.micro (dev), cache.r7g.large (production). Changing this forces cluster recreation.Required

Optional Fields

FieldTypeDefaultDescription
numCacheNodesint1Number of cache nodes in the cluster (1–40). Keys are distributed across nodes via consistent hashing.
azModestring"single-az"AZ distribution mode. "single-az" places all nodes in one AZ. "cross-az" distributes across AZs (requires numCacheNodes > 1).
portint11211Port the cluster accepts connections on. ForceNew — changing this destroys and recreates the cluster.
transitEncryptionEnabledboolfalseEnable TLS encryption for all client connections. Requires engine version 1.6.12 or later. Memcached does not support encryption at rest.
subnetIdsStringValueOrRef[][]Subnet IDs for the ElastiCache subnet group. Provide subnets in at least two AZs when using cross-az mode. Can reference AwsVpc resources via valueFrom.
securityGroupIdsStringValueOrRef[][]VPC security groups to attach to the cluster nodes. Can reference AwsSecurityGroup resources via valueFrom.
parameterGroupFamilystring—Parameter group family (e.g., "memcached1.6", "memcached1.5"). Required when parameters is provided.
parameters[].namestring—Parameter name (e.g., "chunk_size", "binding_protocol").
parameters[].valuestring—Parameter value (e.g., "96", "auto").
maintenanceWindowstringAWS-assignedWeekly maintenance window in UTC. Format: "ddd:hh24:mi-ddd:hh24:mi" (e.g., "sun:05:00-sun:06:00").
applyImmediatelyboolfalseApply changes immediately instead of waiting for the next maintenance window. May cause brief downtime.
autoMinorVersionUpgradeboolfalseAutomatically apply minor engine version upgrades during maintenance windows. Recommended: true.
notificationTopicArnStringValueOrRef—SNS topic ARN for cluster event notifications. Can reference an AwsSnsTopic resource via valueFrom.
preferredAvailabilityZonesstring[][]Preferred AZs for cache nodes. When provided, list length must match numCacheNodes.

Examples

Multi-Node Cross-AZ Cluster

A production cache spread across Availability Zones for resilience:

apiVersion: aws.openmcf.org/v1
kind: AwsMemcachedElasticache
metadata:
  name: prod-cache
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.AwsMemcachedElasticache.prod-cache
spec:
  region: us-east-1
  engineVersion: "1.6.22"
  nodeType: cache.r7g.large
  numCacheNodes: 3
  azMode: cross-az
  transitEncryptionEnabled: true
  autoMinorVersionUpgrade: true
  maintenanceWindow: "sun:05:00-sun:06:00"
  subnetIds:
    - subnet-private-az1
    - subnet-private-az2
    - subnet-private-az3
  securityGroupIds:
    - sg-memcached-prod
  preferredAvailabilityZones:
    - us-east-1a
    - us-east-1b
    - us-east-1c

Custom Parameter Tuning

A cluster with custom Memcached engine parameters and SNS notifications:

apiVersion: aws.openmcf.org/v1
kind: AwsMemcachedElasticache
metadata:
  name: tuned-cache
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: staging.AwsMemcachedElasticache.tuned-cache
spec:
  region: us-west-2
  engineVersion: "1.6.22"
  nodeType: cache.m7g.large
  numCacheNodes: 2
  azMode: cross-az
  applyImmediately: true
  parameterGroupFamily: memcached1.6
  parameters:
    - name: chunk_size
      value: "96"
    - name: chunk_size_growth_factor
      value: "1.5"
    - name: binding_protocol
      value: auto
  subnetIds:
    - subnet-private-az1
    - subnet-private-az2
  securityGroupIds:
    - sg-memcached-staging
  notificationTopicArn: arn:aws:sns:us-east-1:123456789012:cache-events

Using Foreign Key References

Reference other OpenMCF-managed resources instead of hardcoding IDs:

apiVersion: aws.openmcf.org/v1
kind: AwsMemcachedElasticache
metadata:
  name: ref-cache
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.AwsMemcachedElasticache.ref-cache
spec:
  region: us-west-2
  engineVersion: "1.6.22"
  nodeType: cache.r7g.large
  numCacheNodes: 2
  azMode: cross-az
  transitEncryptionEnabled: true
  subnetIds:
    - valueFrom:
        kind: AwsVpc
        name: my-vpc
        field: status.outputs.private_subnets[0].id
    - valueFrom:
        kind: AwsVpc
        name: my-vpc
        field: status.outputs.private_subnets[1].id
  securityGroupIds:
    - valueFrom:
        kind: AwsSecurityGroup
        name: memcached-sg
        field: status.outputs.security_group_id
  notificationTopicArn:
    valueFrom:
      kind: AwsSnsTopic
      name: cache-events
      field: status.outputs.topic_arn

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
cluster_idstringIdentifier of the ElastiCache cluster
cluster_addressstringDNS name of the Memcached auto-discovery endpoint (without port). Empty for single-node clusters.
configuration_endpointstringFull configuration endpoint in address:port format. Recommended connection endpoint for multi-node clusters.
arnstringAmazon Resource Name of the ElastiCache cluster
portintPort on which the cluster accepts connections
subnet_group_namestringName of the ElastiCache subnet group. Only populated when subnetIds were provided.
parameter_group_namestringName of the custom parameter group. Only populated when parameters were provided.

Related Components

  • AwsVpc — provides the subnets for cluster node placement
  • AwsSecurityGroup — controls network-level access to the Memcached endpoint
  • AwsSnsTopic — receives cluster event notifications
  • AwsRedisElasticache — alternative cache engine with replication, persistence, and authentication

Next article

AWS MemoryDB Cluster

AWS MemoryDB Cluster Deploys an Amazon MemoryDB cluster — a fully managed, Redis-compatible, durable in-memory database with microsecond reads, single-digit millisecond writes, and Multi-AZ durability via a distributed transaction log. The component provisions the cluster with optional subnet group and parameter group management, ACL-based authentication, and always-on encryption at rest. What Gets Created When you deploy an AwsMemorydbCluster resource, OpenMCF provisions: MemoryDB Cluster — a...
Read next article
Presets
3 ready-to-deploy configurationsView presets →