Resource: aws_elasticache_serverless_cache

Provides an ElastiCache Serverless Cache resource which manages memcached or redis.

Example Usage

Memcached Serverless

resource "aws_elasticache_serverless_cache" "example" {
  engine = "memcached"
  name   = "example"
  cache_usage_limits {
    data_storage {
      maximum = 10
      unit    = "GB"
    }
    ecpu_per_second {
      maximum = 5000
    }
  }
  description          = "Test Server"
  kms_key_id           = aws_kms_key.test.arn
  major_engine_version = "1.6"
  security_group_ids   = [aws_security_group.test.id]
  subnet_ids           = aws_subnet.test[*].id
}

Redis Serverless

resource "aws_elasticache_serverless_cache" "example" {
  engine = "redis"
  name   = "example"
  cache_usage_limits {
    data_storage {
      maximum = 10
      unit    = "GB"
    }
    ecpu_per_second {
      maximum = 5000
    }
  }
  daily_snapshot_time      = "09:00"
  description              = "Test Server"
  kms_key_id               = aws_kms_key.test.arn
  major_engine_version     = "7"
  snapshot_retention_limit = 1
  security_group_ids       = [aws_security_group.test.id]
  subnet_ids               = aws_subnet.test[*].id
}

Argument Reference

The following arguments are required:

The following arguments are optional:

CacheUsageLimits Configuration

DataStorage Configuration

ECPUPerSecond Configuration

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Endpoint Configuration

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import ElastiCache Serverless Cache using the name. For example:

import {
  to = aws_elasticache_serverless_cache.my_cluster
  id = "my_cluster"
}

Using terraform import, import ElastiCache Serverless Cache using the name. For example:

% terraform import aws_elasticache_serverless_cache.my_cluster my_cluster