Detect, troubleshoot & optimize AWS environments in real-time ->

Amazon Web Service (AWS)


Amazon ElastiCache is a fully managed in-memory data store and cache service, compatible with Redis and Memcached, that helps you deploy, manage and scale distributed in-memory cache environment in the cloud. It improves web applications' performance by retrieving information from managed in-memory caches rather than relying on slower disk-based databases.
The cost of using Amazon ElastiCache depends on several factors, including the type and number of cache nodes, the amount of memory used, and the amount of data transferred. For cache nodes, you are charged based on the hourly rate for the cache node type and the number of cache nodes you run. The cost of cache nodes varies depending on the cache node type and the region you are using. For memory usage, you are charged based on the amount of memory used by your cache nodes. The cost of memory usage varies depending on the cache node type and the region you are using. For data transfer, you are charged based on the amount of data transferred in and out of your cache nodes. The cost of data transfer varies depending on the region you are using.
Direct Cost


Indirect Cost
No items found.
Terraform Name

The following arguments are required:

  • cluster_id – (Required) Group identifier. ElastiCache converts this name to lowercase. Changing this value will re-create the resource.
  • engine – (Optional, Required if replication_group_id is not specified) Name of the cache engine to be used for this cache cluster. Valid values are memcached or redis.
  • node_type – (Required unless replication_group_id is provided) The instance class used. See AWS documentation for information on supported node types for Redis and guidance on selecting node types for Redis. See AWS documentation for information on supported node types for Memcached and guidance on selecting node types for Memcached. For Memcached, changing this value will re-create the resource.
  • num_cache_nodes – (Required unless replication_group_id is provided) The initial number of cache nodes that the cache cluster will have. For Redis, this value must be 1. For Memcached, this value must be between 1 and 40. If this number is reduced on subsequent runs, the highest numbered nodes will be removed.
  • parameter_group_name – (Required unless replication_group_id is provided) The name of the parameter group to associate with this cache cluster.

The following arguments are optional:

  • apply_immediately - (Optional) Whether any database modifications are applied immediately, or during the next maintenance window. Default is false. See Amazon ElastiCache Documentation for more information..
  • auto_minor_version_upgrade - (Optional) Specifies whether minor version engine upgrades will be applied automatically to the underlying Cache Cluster instances during the maintenance window. Only supported for engine type "redis" and if the engine version is 6 or higher. Defaults to true.
  • availability_zone - (Optional) Availability Zone for the cache cluster. If you want to create cache nodes in multi-az, use preferred_availability_zones instead. Default: System chosen Availability Zone. Changing this value will re-create the resource.
  • az_mode - (Optional, Memcached only) Whether the nodes in this Memcached node group are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region. Valid values for this parameter are single-az or cross-az, default is single-az. If you want to choose cross-az, num_cache_nodes must be greater than 1.
  • engine_version – (Optional) Version number of the cache engine to be used. If not set, defaults to the latest version. See Describe Cache Engine Versions in the AWS Documentation for supported versions. When engine is redis and the version is 6 or higher, the major and minor version can be set, e.g., 6.2, or the minor version can be unspecified which will use the latest version at creation time, e.g., 6.x. Otherwise, specify the full version desired, e.g., 5.0.6. The actual engine version used is returned in the attribute engine_version_actual, see Attributes Reference below.
  • final_snapshot_identifier - (Optional, Redis only) Name of your final cluster snapshot. If omitted, no final snapshot will be made.
  • log_delivery_configuration - (Optional, Redis only) Specifies the destination and format of Redis SLOWLOG or Redis Engine Log. See the documentation on Amazon ElastiCache. See Log Delivery Configuration below for more details.
  • maintenance_window – (Optional) Specifies the weekly time range for when maintenance on the cache cluster is performed. The format is ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example: sun:05:00-sun:09:00.
  • notification_topic_arn – (Optional) ARN of an SNS topic to send ElastiCache notifications to. Example: arn:aws:sns:us-east-1:012345678999:my_sns_topic.
  • port – (Optional) The port number on which each of the cache nodes will accept connections. For Memcached the default is 11211, and for Redis the default port is 6379. Cannot be provided with replication_group_id. Changing this value will re-create the resource.
  • preferred_availability_zones - (Optional, Memcached only) List of the Availability Zones in which cache nodes are created. If you are creating your cluster in an Amazon VPC you can only locate nodes in Availability Zones that are associated with the subnets in the selected subnet group. The number of Availability Zones listed must equal the value of num_cache_nodes. If you want all the nodes in the same Availability Zone, use availability_zone instead, or repeat the Availability Zone multiple times in the list. Default: System chosen Availability Zones. Detecting drift of existing node availability zone is not currently supported. Updating this argument by itself to migrate existing node availability zones is not currently supported and will show a perpetual difference.
  • replication_group_id - (Optional, Required if engine is not specified) ID of the replication group to which this cluster should belong. If this parameter is specified, the cluster is added to the specified replication group as a read replica; otherwise, the cluster is a standalone primary that is not part of any replication group.
  • security_group_ids – (Optional, VPC only) One or more VPC security groups associated with the cache cluster
  • security_group_names – (Optional, EC2 Classic only) List of security group names to associate with this cache cluster. Changing this value will re-create the resource.
  • snapshot_arns – (Optional, Redis only) Single-element string list containing an Amazon Resource Name (ARN) of a Redis RDB snapshot file stored in Amazon S3. The object name cannot contain any commas. Changing snapshot_arns forces a new resource.
  • snapshot_name - (Optional, Redis only) Name of a snapshot from which to restore data into the new node group. Changing snapshot_name forces a new resource.
  • snapshot_retention_limit - (Optional, Redis only) Number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. Please note that setting a snapshot_retention_limit is not supported on cache.t1.micro cache nodes
  • snapshot_window - (Optional, Redis only) Daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. Example: 05:00-09:00
  • subnet_group_name – (Optional, VPC only) Name of the subnet group to be used for the cache cluster. Changing this value will re-create the resource.
  • tags - (Optional) Map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Associating resources with a
Resources do not "belong" to a
Rather, one or more Security Groups are associated to a resource.
via Terraform:
The following HCL creates a cache cluster using the Redis engine

resource "aws_elasticache_cluster" "example" {
 cluster_id           = "cluster-example"
 engine               = "redis"
 node_type            = "cache.m4.large"
 num_cache_nodes      = 1
 parameter_group_name = "default.redis3.2"
 engine_version       = "3.2.10"
 port                 = 6379

via CLI:

--cache-cluster-id <value>
[--replication-group-id <value>]
[--az-mode <value>]
[--preferred-availability-zone <value>]
[--preferred-availability-zones <value>]
[--num-cache-nodes <value>]
[--cache-node-type <value>]
[--engine <value>]
[--engine-version <value>]
[--cache-parameter-group-name <value>]
[--cache-subnet-group-name <value>]
[--cache-security-group-names <value>]
[--security-group-ids <value>]
[--tags <value>]
[--snapshot-arns <value>]
[--snapshot-name <value>]
[--preferred-maintenance-window <value>]
[--port <value>]
[--notification-topic-arn <value>]
[--auto-minor-version-upgrade | --no-auto-minor-version-upgrade]
[--snapshot-retention-limit <value>]
[--snapshot-window <value>]
[--auth-token <value>]
[--outpost-mode <value>]
[--preferred-outpost-arn <value>]
[--preferred-outpost-arns <value>]
[--log-delivery-configurations <value>]
[--transit-encryption-enabled | --no-transit-encryption-enabled]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--endpoint-url <value>]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]


aws elasticache create-cache-cluster \
   --cache-cluster-id "cluster-test" \
   --engine redis \
   --cache-node-type cache.m5.large \
   --num-cache-nodes 1

Best Practices for

Categorized by Availability, Security & Compliance and Cost

Explore all the rules our platform covers
Related blog posts
All Resources