AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Creates a Redis (cluster mode disabled) or a Redis (cluster mode enabled) replication group.

A Redis (cluster mode disabled) replication group is a collection of cache clusters, where one of the cache clusters is a read/write primary and the others are read-only replicas. Writes to the primary are asynchronously propagated to the replicas.

A Redis (cluster mode enabled) replication group is a collection of 1 to 15 node groups (shards). Each node group (shard) has one read/write primary node and up to 5 read-only replica nodes. Writes to the primary are asynchronously propagated to the replicas. Redis (cluster mode enabled) replication groups partition the data across node groups (shards).

When a Redis (cluster mode disabled) replication group has been successfully created, you can add one or more read replicas to it, up to a total of 5 read replicas. You cannot alter a Redis (cluster mode enabled) replication group after it has been created. However, if you need to increase or decrease the number of node groups (console: shards), you can avail yourself of ElastiCache for Redis' enhanced backup and restore. For more information, see Restoring From a Backup with Cluster Resizing in the ElastiCache User Guide.

This operation is valid for Redis only.

Note:

For PCL this operation is only available in asynchronous form. Please refer to CreateReplicationGroupAsync.

Namespace: Amazon.ElastiCache
Assembly: AWSSDK.ElastiCache.dll
Version: 3.x.y.z

Syntax

C#
public virtual CreateReplicationGroupResponse CreateReplicationGroup(
         CreateReplicationGroupRequest request
)
Parameters
request
Type: Amazon.ElastiCache.Model.CreateReplicationGroupRequest

Container for the necessary parameters to execute the CreateReplicationGroup service method.

Return Value
The response from the CreateReplicationGroup service method, as returned by ElastiCache.

Exceptions

ExceptionCondition
CacheClusterNotFoundException The requested cache cluster ID does not refer to an existing cache cluster.
CacheParameterGroupNotFoundException The requested cache parameter group name does not refer to an existing cache parameter group.
CacheSecurityGroupNotFoundException The requested cache security group name does not refer to an existing cache security group.
CacheSubnetGroupNotFoundException The requested cache subnet group name does not refer to an existing cache subnet group.
ClusterQuotaForCustomerExceededException The request cannot be processed because it would exceed the allowed number of cache clusters per customer.
InsufficientCacheClusterCapacityException The requested cache node type is not available in the specified Availability Zone.
InvalidCacheClusterStateException The requested cache cluster is not in the available state.
InvalidParameterCombinationException Two or more incompatible parameters were specified.
InvalidParameterValueException The value for a parameter is invalid.
InvalidVPCNetworkStateException The VPC network is in an invalid state.
NodeGroupsPerReplicationGroupQuotaExceededException The request cannot be processed because it would exceed the maximum of 15 node groups (shards) in a single replication group.
NodeQuotaForClusterExceededException The request cannot be processed because it would exceed the allowed number of cache nodes in a single cache cluster.
NodeQuotaForCustomerExceededException The request cannot be processed because it would exceed the allowed number of cache nodes per customer.
ReplicationGroupAlreadyExistsException The specified replication group already exists.
TagQuotaPerResourceExceededException The request cannot be processed because it would cause the resource to have more than the allowed number of tags. The maximum number of tags permitted on a resource is 50.

Examples

Creates a Redis replication group with 3 nodes.

CreateCacheReplicationGroup


var response = client.CreateReplicationGroup(new CreateReplicationGroupRequest 
{
    AutomaticFailoverEnabled = true,
    CacheNodeType = "cache.m3.medium",
    Engine = "redis",
    EngineVersion = "2.8.24",
    NumCacheClusters = 3,
    ReplicationGroupDescription = "A Redis replication group.",
    ReplicationGroupId = "my-redis-rg",
    SnapshotRetentionLimit = 30
});

ReplicationGroup replicationGroup = response.ReplicationGroup;

            

Creates a Redis (cluster mode enabled) replication group with two shards. One shard has one read replica node and the other shard has two read replicas.

CreateReplicationGroup


var response = client.CreateReplicationGroup(new CreateReplicationGroupRequest 
{
    AutoMinorVersionUpgrade = true,
    CacheNodeType = "cache.m3.medium",
    CacheParameterGroupName = "default.redis3.2.cluster.on",
    Engine = "redis",
    EngineVersion = "3.2.4",
    NodeGroupConfiguration = new List {
        new NodeGroupConfiguration {
            PrimaryAvailabilityZone = "us-east-1c",
            ReplicaAvailabilityZones = new List {
                "us-east-1b"
            },
            ReplicaCount = 1,
            Slots = "0-8999"
        },
        new NodeGroupConfiguration {
            PrimaryAvailabilityZone = "us-east-1a",
            ReplicaAvailabilityZones = new List {
                "us-east-1a",
                "us-east-1c"
            },
            ReplicaCount = 2,
            Slots = "9000-16383"
        }
    },
    NumNodeGroups = 2,
    ReplicationGroupDescription = "A multi-sharded replication group",
    ReplicationGroupId = "clustered-redis-rg",
    SnapshotRetentionLimit = 8
});

ReplicationGroup replicationGroup = response.ReplicationGroup;

            

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also