2015-05-08 18:27:43 +02:00
---
layout: "aws"
2015-06-07 21:42:38 +02:00
page_title: "AWS: aws_elasticache_cluster"
2015-05-08 18:27:43 +02:00
sidebar_current: "docs-aws-resource-elasticache-cluster"
description: |-
2015-06-25 08:11:49 +02:00
Provides an ElastiCache Cluster resource.
2015-05-08 18:27:43 +02:00
---
# aws\_elasticache\_cluster
2015-05-14 05:23:37 +02:00
Provides an ElastiCache Cluster resource.
2015-05-08 18:27:43 +02:00
2015-12-18 18:43:33 +01:00
Changes to a Cache Cluster can occur when you manually change a
parameter, such as `node_type` , and are reflected in the next maintenance
2016-02-11 00:06:43 +01:00
window. Because of this, Terraform may report a difference in its planning
2015-12-18 18:43:33 +01:00
phase because a modification has not yet taken place. You can use the
2016-01-14 21:55:39 +01:00
`apply_immediately` flag to instruct the service to apply the change immediately
(see documentation below).
2015-12-18 18:43:33 +01:00
2016-01-14 21:55:39 +01:00
~> **Note:** using `apply_immediately` can result in a
brief downtime as the server reboots. See the AWS Docs on
2015-12-18 18:43:33 +01:00
[Modifying an ElastiCache Cache Cluster][2] for more information.
2015-05-08 18:27:43 +02:00
## Example Usage
```
resource "aws_elasticache_cluster" "bar" {
cluster_id = "cluster-example"
engine = "memcached"
node_type = "cache.m1.small"
2015-06-01 16:55:07 +02:00
port = 11211
2015-05-08 18:27:43 +02:00
num_cache_nodes = 1
parameter_group_name = "default.memcached1.4"
}
```
## Argument Reference
The following arguments are supported:
2016-02-11 00:06:43 +01:00
* `cluster_id` – (Required) Group identifier. ElastiCache converts
2015-09-15 01:50:53 +02:00
this name to lowercase
2015-05-08 18:27:43 +02:00
* `engine` – (Required) Name of the cache engine to be used for this cache cluster.
Valid values for this parameter are `memcached` or `redis`
* `engine_version` – (Optional) Version number of the cache engine to be used.
2016-01-14 21:55:39 +01:00
See [Selecting a Cache Engine and Version ](https://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/SelectEngine.html )
2015-05-14 05:23:37 +02:00
in the AWS Documentation center for supported versions
2015-05-08 18:27:43 +02:00
2016-02-11 00:06:43 +01:00
* `maintenance_window` – (Optional) Specifies the weekly time range for when maintenance
2016-01-14 21:55:39 +01:00
on the cache cluster is performed. The format is `ddd:hh24:mi-ddd:hh24:mi` (24H Clock UTC).
2015-07-07 18:41:46 +02:00
The minimum maintenance window is a 60 minute period. Example: `sun:05:00-sun:09:00`
2015-05-14 05:23:37 +02:00
* `node_type` – (Required) The compute and memory capacity of the nodes. See
2016-01-14 21:55:39 +01:00
[Available Cache Node Types ](https://aws.amazon.com/elasticache/details#Available_Cache_Node_Types ) for
2015-05-08 18:27:43 +02:00
supported node types
2015-05-14 05:23:37 +02:00
* `num_cache_nodes` – (Required) The initial number of cache nodes that the
2015-05-08 18:27:43 +02:00
cache cluster will have. For Redis, this value must be 1. For Memcache, this
2015-12-10 21:35:46 +01:00
value must be between 1 and 20. If this number is reduced on subsequent runs,
the highest numbered nodes will be removed.
2015-05-08 18:27:43 +02:00
2015-05-14 05:23:37 +02:00
* `parameter_group_name` – (Required) Name of the parameter group to associate
2015-05-08 18:27:43 +02:00
with this cache cluster
2015-06-01 16:55:07 +02:00
* `port` – (Required) The port number on which each of the cache nodes will
accept connections. For Memcache the default is 11211, and for Redis the default port is 6379.
2015-05-08 18:27:43 +02:00
2015-05-14 05:23:37 +02:00
* `subnet_group_name` – (Optional, VPC only) Name of the subnet group to be used
2015-05-08 18:27:43 +02:00
for the cache cluster.
2015-05-14 05:23:37 +02:00
* `security_group_names` – (Optional, EC2 Classic only) List of security group
2015-05-08 18:27:43 +02:00
names to associate with this cache cluster
2015-05-14 05:23:37 +02:00
* `security_group_ids` – (Optional, VPC only) One or more VPC security groups associated
2015-05-08 18:27:43 +02:00
with the cache cluster
2015-06-24 22:56:59 +02:00
* `apply_immediately` - (Optional) Specifies whether any database modifications
are applied immediately, or during the next maintenance window. Default is
`false` . See [Amazon ElastiCache Documentation for more information.][1]
2015-06-25 17:45:36 +02:00
(Available since v0.6.0)
2015-06-24 22:56:59 +02:00
2016-01-14 21:55:39 +01:00
* `snapshot_arns` – (Optional) A single-element string list containing an
Amazon Resource Name (ARN) of a Redis RDB snapshot file stored in Amazon S3.
2015-07-07 00:19:15 +02:00
Example: `arn:aws:s3:::my_bucket/snapshot1.rdb`
2016-02-11 00:06:43 +01:00
* `snapshot_window` - (Optional, Redis only) The daily time range (in UTC) during which ElastiCache will
begin taking a daily snapshot of your cache cluster. Example: 05:00-09:00
2015-10-31 00:55:00 +01:00
2016-02-11 00:06:43 +01:00
* `snapshot_retention_limit` - (Optional, Redis only) The number of days for which ElastiCache will
2016-01-14 21:55:39 +01:00
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
2016-02-11 00:06:43 +01:00
before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off
2015-10-31 00:55:00 +01:00
2016-01-14 21:55:39 +01:00
* `notification_topic_arn` – (Optional) An Amazon Resource Name (ARN) of an
SNS topic to send ElastiCache notifications to. Example:
2015-07-23 21:31:24 +02:00
`arn:aws:sns:us-east-1:012345678999:my_sns_topic`
2016-02-11 00:06:43 +01:00
* `az_mode` - (Optional, Memcached only) Specifies 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`
2016-01-11 15:45:07 +01:00
2016-02-11 00:06:43 +01:00
* `availability_zone` - (Optional) The Availability Zone for the cache cluster. If you want to create cache nodes in multi-az, use `availability_zones`
2016-01-11 15:45:07 +01:00
2016-02-11 00:06:43 +01:00
* `availability_zones` - (Optional, Memcached only) List of Availability Zones in which the cache nodes will be created. If you want to create cache nodes in single-az, use `availability_zone`
2016-01-11 15:33:21 +01:00
2016-02-11 00:06:43 +01:00
* `tags` - (Optional) A mapping of tags to assign to the resource
2015-06-02 00:05:07 +02:00
2015-11-06 12:16:51 +01:00
~> **NOTE:** Snapshotting functionality is not compatible with t2 instance types.
2015-05-08 18:27:43 +02:00
## Attributes Reference
The following attributes are exported:
2016-01-11 15:33:21 +01:00
* `cache_nodes` - List of node objects including `id` , `address` , `port` and `availability_zone` .
2015-06-13 15:06:14 +02:00
Referenceable e.g. as `${aws_elasticache_cluster.bar.cache_nodes.0.address}`
2016-01-14 21:55:39 +01:00
2015-09-16 18:15:31 +02:00
* `configuration_endpoint` - (Memcached only) The configuration endpoint to allow host discovery
2015-06-24 22:56:59 +02:00
2016-01-14 21:55:39 +01:00
[1]: https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_ModifyCacheCluster.html
[2]: https://docs.aws.amazon.com/fr_fr/AmazonElastiCache/latest/UserGuide/Clusters.Modify.html