CloudFormation

From DikapediaV2
Jump to: navigation, search

How to create Redis (cluster mode enabled) with 1 shard using YAML


CacheParameterGroupName is key to making it cluster mode enabled:

AWSTemplateFormatVersion: 2010-09-09
Resources:
    myReplicationGroup:
        Type: AWS::ElastiCache::ReplicationGroup
        DeletionPolicy: Retain
        Properties:
          AtRestEncryptionEnabled: true
          AutomaticFailoverEnabled: true
          CacheParameterGroupName: 'default.redis5.0.cluster.on'
          CacheNodeType: 'cache.t3.micro'
          Engine: redis
          EngineVersion: '5.0.6'
          NumNodeGroups: 1
          Port: 6379
          ReplicasPerNodeGroup: 1
          ReplicationGroupDescription: ElastiCache Redis Cluster
          ReplicationGroupId: replication-group-id
          SnapshotRetentionLimit: 5
          TransitEncryptionEnabled: true
          PreferredMaintenanceWindow: 'Sun:00:00-Sun:01:00'
        UpdatePolicy:
          UseOnlineResharding: true
Outputs:
    ReplicationGroup:
        Description: Information about the myReplicationGroup
        Value: !Ref myReplicationGroup
    ReplicationGroupAddress:
        Description: Information about the myReplicationGroup Address
        Value: !GetAtt myReplicationGroup.ConfigurationEndPoint.Address
    ReplicationGroupPort:
        Description: Information about the myReplicationGroup Port
        Value: !GetAtt myReplicationGroup.ConfigurationEndPoint.Port