Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticache replication group id in CloudFormation template

How do you set the Redis ReplicationGroup ID when using a CloudFormation template? All the options in the docs show no way to do that and the CLI you can do this easily. My end goal is to have a Redis replication group with 3 cluster members but I want to choose the name rather than AWS set a unique name for me.

Here's a snippet of my template:

  "Resources": {
    "mqpReplicationGroup": {
      "Type": "AWS::ElastiCache::ReplicationGroup",
      "Properties": {
        "CacheNodeType": {
          "Ref": "CacheNodeType"
        },
        "CacheSubnetGroupName": {
          "Ref": "CacheSubnets"
        },
        "ReplicationGroupDescription": "Redis Replication Group",
        "Engine": "redis",
        "EngineVersion": {
          "Ref": "RedisVersion"
        },
        "NumCacheClusters": {
          "Ref": "NumberOfCacheNodes"
        },
        "AutoMinorVersionUpgrade": "true",
        "AutomaticFailoverEnabled": "true",
        "PreferredMaintenanceWindow": "sat:09:25-sat:22:30",
        "SnapshotRetentionLimit": "4",
        "SnapshotWindow": "00:05-05:30",
        "NotificationTopicArn": {
          "Fn::Join" :[":",["arn:aws:sns",{ "Ref" : "AWS::Region" },{ "Ref" : "AWS::AccountId" },"service-aws"]]
        },
        "SecurityGroupIds": [
          {
            "Fn::Join": [
              ",",
              {
                "Ref": "VpcSecurityGroupIds"
              }
            ]
          }
        ]
      }
    },
    "CacheSubnets": {
      "Type": "AWS::ElastiCache::SubnetGroup",
      "Properties": {
        "Description": "mqp-cache-subnet",
        "SubnetIds": {
          "Ref": "SubnetIds"
        }
      }
    }
  }
like image 858
occasl Avatar asked Sep 11 '15 18:09

occasl


People also ask

What is AWS ElastiCache replication group?

The AWS::ElastiCache::ReplicationGroup resource creates an Amazon ElastiCache Redis replication group. A Redis (cluster mode disabled) replication group is a collection of cache clusters, where one of the clusters is a primary read-write cluster and the others are read-only replicas.

What is replication group?

Replication groups are designed to support multi-data center deployments and disaster recovery scenarios. Replication groups are defined by a group ID. A group ID is a unique number that is assigned to a replicated domain on a directory server (one group ID per replicated domain).

How do I view ElastiCache contents?

To view events using the ElastiCache consoleSign in to the AWS Management Console and open the ElastiCache console at https://console.aws.amazon.com/elasticache/ . To see a list of all available events, in the navigation pane, choose Events.

What are 2 types of Amazon ElastiCache?

Amazon ElastiCache supports two major open source in-memory caching engines: Memcached and Redis. ElastiCache users typically select between the two caching engines, depending on the design of the corresponding application.


2 Answers

As of 2017, this is now possible using ReplicationGroupId property.

Since it is optional, AWS CloudFormation will still generate an unique physical ID when not specified.

Restrictions for Name Type:

  • Must contain from 1 to 20 alphanumeric characters or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.
like image 148
Razvan Grigore Avatar answered Nov 12 '22 07:11

Razvan Grigore


This cannot currently be done with CloudFormation.

like image 26
DrStrangepork Avatar answered Nov 12 '22 06:11

DrStrangepork