AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

AWS::ElastiCache::CacheCluster

The AWS::ElastiCache::CacheCluster type creates an Amazon ElastiCache cache cluster.

Syntax

{
   "Type" : "AWS::ElastiCache::CacheCluster",
   "Properties" :
   {
      "AutoMinorVersionUpgrade" : Boolean,
      "CacheNodeType" : String,
      "CacheParameterGroupName" : String,
      "CacheSecurityGroupNames" : [ String, ... ],
      "Engine" : String,
      "EngineVersion" : String,
      "NotificationTopicArn" : String,
      "NumCacheNodes" : String,
      "Port" : Integer,
      "PreferredAvailabilityZone" : String,
      "PreferredMaintenanceWindow" : String
   }
}  

Properties

AutoMinorVersionUpgrade

Indicates that minor engine upgrades will be applied automatically to the cache cluster during the maintenance window.

Required: No

Type: Boolean

Default: true

Update requires: replacement

CacheNodeType

The compute and memory capacity of nodes in a cache cluster.

Required: Yes

Type: String

Update requires: replacement

CacheParameterGroupName

The name of the cache parameter group that is associated with this cache cluster.

Required: No

Type: String

Update requires: no interruption

CacheSecurityGroupNames

A list of cache security group names that are associated with this cache cluster.

Required: Yes

Type: List of Strings

Update requires: no interruption

Engine

The name of the cache engine to be used for this cache cluster.

Required: Yes

Type: String

Update requires: replacement

EngineVersion

The version of the cache engine to be used for this cluster.

Required: No

Type: String

Update requires: some interruptions

NotificationTopicArn

The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications will be sent.

Required: No

Type: String

Update requires: no interruption

NumCacheNodes

The number of cache nodes that the cache cluster should have.

Required: No

Type: String

Update requires: some interruptions

Port

The port number on which each of the cache nodes will accept connections.

Required: No

Type: Integer

Update requires: no interruption

PreferredAvailabilityZone

The EC2 Availability Zone that the cache cluster will be created in.

Required: No

Type: String

Update requires: replacement

PreferredMaintenanceWindow

The weekly time range (in UTC) during which system maintenance can occur.

Required: No

Type: String

Update requires: no interruption

Notes

Update Behavior

When updates are made to the following properties, AWS CloudFormation creates a replacement cache cluster resource first, changes references from other dependent resources to point to the replacement resource, and then deletes the old resource.

  • CacheNodeType

  • Engine

  • Port

  • PreferredAvailabilityZone

Obtaining the Cache Cluster Node Addresses

The ElastiCache cache cluster does not have a single endpoint, but you can obtain the endpoints for individual cache nodes by defining a get-cache-nodes script and installing it in the AWS::CloudFormation::Init section of the template. Full implementation details can be viewed in the ElastiCache template example at: https://s3.amazonaws.com/cloudformation-templates-us-east-1/ElastiCache.template.

The Amazon ElastiCache template uses the AWS CloudFormation bootstrap script cfn-hup to detect changes to the Amazon ElastiCache cache cluster configuration, such as the number of instances in the cache cluster. It then runs a script to update the on-host configuration for the application.

Here is the code that demonstrates obtaining the cache node information with cfn-list-stack-resources:

"/etc/cfn/get-cache-nodes" : {
   "content" : {
      "Fn::Join" : [
         "",
         [
            "# Define environment variables for command line tools\n",
            "export AWS_ELASTICACHE_HOME=/home/ec2-user/elasticache/AmazonElastiCacheCli-1.5.000\n",
            "export AWS_CLOUDFORMATION_HOME=/opt/aws/apitools/cfn\n",
            "export PATH=$AWS_CLOUDFORMATION_HOME/bin:$AWS_ELASTICACHE_HOME/bin:$PATH\n",
            "export AWS_CREDENTIAL_FILE=/etc/cfn/cfn-credentials\n",
            "export JAVA_HOME=/usr/lib/jvm/jre\n",
            "\n",
            "# Grab the Cache node names and configure the PHP page\n",
            "cfn-list-stack-resources ",
            { "Ref" : "AWS::StackName" },
            " --region ",
            { "Ref" : "AWS::Region" },
            " | grep CacheCluster | awk '{print $3}' | xargs -I {} elasticache-describe-cache-clusters {} --region ",
            { "Ref" : "AWS::Region" },
            " --show-cache-node-info | grep CACHENODE | awk '{print $4 \",\" $5}' > /var/www/html/nodelist\n"
         ]
      ]
   },
   "mode"    : "000500",
   "owner"   : "root",
   "group"   : "root"
}        

Return Values

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, it returns the resource name.

For more information about using the Ref function, see Ref.

Fn::GetAtt

Fn::GetAtt returns a value for a specified attribute of this type. This section lists the available attributes and corresponding return values.

ConfigurationEndpoint.Address

The DNS address of the configuration endpoint for the cache cluster.

ConfigurationEndpoint.Port

The port number of the configuration endpoint for the cache cluster.

For more information about using Fn:GetAtt, see Fn::GetAtt.

See Also