ElastiCache / Client / modify_replication_group
modify_replication_group#
- ElastiCache.Client.modify_replication_group(**kwargs)#
Modifies the settings for a replication group.
Scaling for Amazon ElastiCache for Redis (cluster mode enabled) in the ElastiCache User Guide
ModifyReplicationGroupShardConfiguration in the ElastiCache API Reference
Note
This operation is valid for Redis only.
See also: AWS API Documentation
Request Syntax
response = client.modify_replication_group( ReplicationGroupId='string', ReplicationGroupDescription='string', PrimaryClusterId='string', SnapshottingClusterId='string', AutomaticFailoverEnabled=True|False, MultiAZEnabled=True|False, NodeGroupId='string', CacheSecurityGroupNames=[ 'string', ], SecurityGroupIds=[ 'string', ], PreferredMaintenanceWindow='string', NotificationTopicArn='string', CacheParameterGroupName='string', NotificationTopicStatus='string', ApplyImmediately=True|False, EngineVersion='string', AutoMinorVersionUpgrade=True|False, SnapshotRetentionLimit=123, SnapshotWindow='string', CacheNodeType='string', AuthToken='string', AuthTokenUpdateStrategy='SET'|'ROTATE'|'DELETE', UserGroupIdsToAdd=[ 'string', ], UserGroupIdsToRemove=[ 'string', ], RemoveUserGroups=True|False, LogDeliveryConfigurations=[ { 'LogType': 'slow-log'|'engine-log', 'DestinationType': 'cloudwatch-logs'|'kinesis-firehose', 'DestinationDetails': { 'CloudWatchLogsDetails': { 'LogGroup': 'string' }, 'KinesisFirehoseDetails': { 'DeliveryStream': 'string' } }, 'LogFormat': 'text'|'json', 'Enabled': True|False }, ], IpDiscovery='ipv4'|'ipv6', TransitEncryptionEnabled=True|False, TransitEncryptionMode='preferred'|'required' )
- Parameters:
ReplicationGroupId (string) –
[REQUIRED]
The identifier of the replication group to modify.
ReplicationGroupDescription (string) – A description for the replication group. Maximum length is 255 characters.
PrimaryClusterId (string) – For replication groups with a single primary, if this parameter is specified, ElastiCache promotes the specified cluster in the specified replication group to the primary role. The nodes of all other clusters in the replication group are read replicas.
SnapshottingClusterId (string) – The cluster ID that is used as the daily snapshot source for the replication group. This parameter cannot be set for Redis (cluster mode enabled) replication groups.
AutomaticFailoverEnabled (boolean) –
Determines whether a read replica is automatically promoted to read/write primary if the existing primary encounters a failure.
Valid values:
true
|false
MultiAZEnabled (boolean) – A flag to indicate MultiAZ is enabled.
NodeGroupId (string) – Deprecated. This parameter is not used.
CacheSecurityGroupNames (list) –
A list of cache security group names to authorize for the clusters in this replication group. This change is asynchronously applied as soon as possible.
This parameter can be used only with replication group containing clusters running outside of an Amazon Virtual Private Cloud (Amazon VPC).
Constraints: Must contain no more than 255 alphanumeric characters. Must not be
Default
.(string) –
SecurityGroupIds (list) –
Specifies the VPC Security Groups associated with the clusters in the replication group.
This parameter can be used only with replication group containing clusters running in an Amazon Virtual Private Cloud (Amazon VPC).
(string) –
PreferredMaintenanceWindow (string) –
Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for
ddd
are:sun
mon
tue
wed
thu
fri
sat
Example:
sun:23:00-mon:01:30
NotificationTopicArn (string) –
The Amazon Resource Name (ARN) of the Amazon SNS topic to which notifications are sent.
Note
The Amazon SNS topic owner must be same as the replication group owner.
CacheParameterGroupName (string) – The name of the cache parameter group to apply to all of the clusters in this replication group. This change is asynchronously applied as soon as possible for parameters when the
ApplyImmediately
parameter is specified astrue
for this request.NotificationTopicStatus (string) –
The status of the Amazon SNS notification topic for the replication group. Notifications are sent only if the status is
active
.Valid values:
active
|inactive
ApplyImmediately (boolean) –
If
true
, this parameter causes the modifications in this request and any pending modifications to be applied, asynchronously and as soon as possible, regardless of thePreferredMaintenanceWindow
setting for the replication group.If
false
, changes to the nodes in the replication group are applied on the next maintenance reboot, or the next failure reboot, whichever occurs first.Valid values:
true
|false
Default:
false
EngineVersion (string) –
The upgraded version of the cache engine to be run on the clusters in the replication group.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version), but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing replication group and create it anew with the earlier engine version.
AutoMinorVersionUpgrade (boolean) – If you are running Redis engine version 6.0 or later, set this parameter to yes if you want to opt-in to the next auto minor version upgrade campaign. This parameter is disabled for previous versions.
SnapshotRetentionLimit (integer) –
The number of days for which ElastiCache retains automatic node group (shard) snapshots before deleting them. For example, if you set
SnapshotRetentionLimit
to 5, a snapshot that was taken today is retained for 5 days before being deleted.Important If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off.
SnapshotWindow (string) –
The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of the node group (shard) specified by
SnapshottingClusterId
.Example:
05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
CacheNodeType (string) – A valid cache node type that you want to scale this replication group to.
AuthToken (string) –
Reserved parameter. The password used to access a password protected server. This parameter must be specified with the
auth-token-update-strategy
parameter. Password constraints:Must be only printable ASCII characters
Must be at least 16 characters and no more than 128 characters in length
Cannot contain any of the following characters: ‘/’, ‘”’, or ‘@’, ‘%’
For more information, see AUTH password at AUTH.
AuthTokenUpdateStrategy (string) –
Specifies the strategy to use to update the AUTH token. This parameter must be specified with the
auth-token
parameter. Possible values:Rotate
Set
For more information, see Authenticating Users with Redis AUTH
UserGroupIdsToAdd (list) –
The ID of the user group you are associating with the replication group.
(string) –
UserGroupIdsToRemove (list) –
The ID of the user group to disassociate from the replication group, meaning the users in the group no longer can access the replication group.
(string) –
RemoveUserGroups (boolean) – Removes the user group associated with this replication group.
LogDeliveryConfigurations (list) –
Specifies the destination, format and type of the logs.
(dict) –
Specifies the destination, format and type of the logs.
LogType (string) –
Refers to slow-log or engine-log..
DestinationType (string) –
Specify either
cloudwatch-logs
orkinesis-firehose
as the destination type.DestinationDetails (dict) –
Configuration details of either a CloudWatch Logs destination or Kinesis Data Firehose destination.
CloudWatchLogsDetails (dict) –
The configuration details of the CloudWatch Logs destination.
LogGroup (string) –
The name of the CloudWatch Logs log group.
KinesisFirehoseDetails (dict) –
The configuration details of the Kinesis Data Firehose destination.
DeliveryStream (string) –
The name of the Kinesis Data Firehose delivery stream.
LogFormat (string) –
Specifies either JSON or TEXT
Enabled (boolean) –
Specify if log delivery is enabled. Default
true
.
IpDiscovery (string) – The network type you choose when modifying a cluster, either
ipv4
|ipv6
. IPv6 is supported for workloads using Redis engine version 6.2 onward or Memcached engine version 1.6.6 on all instances built on the Nitro system.TransitEncryptionEnabled (boolean) – A flag that enables in-transit encryption when set to true. If you are enabling in-transit encryption for an existing cluster, you must also set
TransitEncryptionMode
topreferred
.TransitEncryptionMode (string) –
A setting that allows you to migrate your clients to use in-transit encryption, with no downtime.
You must set
TransitEncryptionEnabled
totrue
, for your existing cluster, and setTransitEncryptionMode
topreferred
in the same request to allow both encrypted and unencrypted connections at the same time. Once you migrate all your Redis clients to use encrypted connections you can set the value torequired
to allow encrypted connections only.Setting
TransitEncryptionMode
torequired
is a two-step process that requires you to first set theTransitEncryptionMode
topreferred
first, after that you can setTransitEncryptionMode
torequired
.
- Return type:
dict
- Returns:
Response Syntax
{ 'ReplicationGroup': { 'ReplicationGroupId': 'string', 'Description': 'string', 'GlobalReplicationGroupInfo': { 'GlobalReplicationGroupId': 'string', 'GlobalReplicationGroupMemberRole': 'string' }, 'Status': 'string', 'PendingModifiedValues': { 'PrimaryClusterId': 'string', 'AutomaticFailoverStatus': 'enabled'|'disabled', 'Resharding': { 'SlotMigration': { 'ProgressPercentage': 123.0 } }, 'AuthTokenStatus': 'SETTING'|'ROTATING', 'UserGroups': { 'UserGroupIdsToAdd': [ 'string', ], 'UserGroupIdsToRemove': [ 'string', ] }, 'LogDeliveryConfigurations': [ { 'LogType': 'slow-log'|'engine-log', 'DestinationType': 'cloudwatch-logs'|'kinesis-firehose', 'DestinationDetails': { 'CloudWatchLogsDetails': { 'LogGroup': 'string' }, 'KinesisFirehoseDetails': { 'DeliveryStream': 'string' } }, 'LogFormat': 'text'|'json' }, ], 'TransitEncryptionEnabled': True|False, 'TransitEncryptionMode': 'preferred'|'required' }, 'MemberClusters': [ 'string', ], 'NodeGroups': [ { 'NodeGroupId': 'string', 'Status': 'string', 'PrimaryEndpoint': { 'Address': 'string', 'Port': 123 }, 'ReaderEndpoint': { 'Address': 'string', 'Port': 123 }, 'Slots': 'string', 'NodeGroupMembers': [ { 'CacheClusterId': 'string', 'CacheNodeId': 'string', 'ReadEndpoint': { 'Address': 'string', 'Port': 123 }, 'PreferredAvailabilityZone': 'string', 'PreferredOutpostArn': 'string', 'CurrentRole': 'string' }, ] }, ], 'SnapshottingClusterId': 'string', 'AutomaticFailover': 'enabled'|'disabled'|'enabling'|'disabling', 'MultiAZ': 'enabled'|'disabled', 'ConfigurationEndpoint': { 'Address': 'string', 'Port': 123 }, 'SnapshotRetentionLimit': 123, 'SnapshotWindow': 'string', 'ClusterEnabled': True|False, 'CacheNodeType': 'string', 'AuthTokenEnabled': True|False, 'AuthTokenLastModifiedDate': datetime(2015, 1, 1), 'TransitEncryptionEnabled': True|False, 'AtRestEncryptionEnabled': True|False, 'MemberClustersOutpostArns': [ 'string', ], 'KmsKeyId': 'string', 'ARN': 'string', 'UserGroupIds': [ 'string', ], 'LogDeliveryConfigurations': [ { 'LogType': 'slow-log'|'engine-log', 'DestinationType': 'cloudwatch-logs'|'kinesis-firehose', 'DestinationDetails': { 'CloudWatchLogsDetails': { 'LogGroup': 'string' }, 'KinesisFirehoseDetails': { 'DeliveryStream': 'string' } }, 'LogFormat': 'text'|'json', 'Status': 'active'|'enabling'|'modifying'|'disabling'|'error', 'Message': 'string' }, ], 'ReplicationGroupCreateTime': datetime(2015, 1, 1), 'DataTiering': 'enabled'|'disabled', 'AutoMinorVersionUpgrade': True|False, 'NetworkType': 'ipv4'|'ipv6'|'dual_stack', 'IpDiscovery': 'ipv4'|'ipv6', 'TransitEncryptionMode': 'preferred'|'required' } }
Response Structure
(dict) –
ReplicationGroup (dict) –
Contains all of the attributes of a specific Redis replication group.
ReplicationGroupId (string) –
The identifier for the replication group.
Description (string) –
The user supplied description of the replication group.
GlobalReplicationGroupInfo (dict) –
The name of the Global datastore and role of this replication group in the Global datastore.
GlobalReplicationGroupId (string) –
The name of the Global datastore
GlobalReplicationGroupMemberRole (string) –
The role of the replication group in a Global datastore. Can be primary or secondary.
Status (string) –
The current state of this replication group -
creating
,available
,modifying
,deleting
,create-failed
,snapshotting
.PendingModifiedValues (dict) –
A group of settings to be applied to the replication group, either immediately or during the next maintenance window.
PrimaryClusterId (string) –
The primary cluster ID that is applied immediately (if
--apply-immediately
was specified), or during the next maintenance window.AutomaticFailoverStatus (string) –
Indicates the status of automatic failover for this Redis replication group.
Resharding (dict) –
The status of an online resharding operation.
SlotMigration (dict) –
Represents the progress of an online resharding operation.
ProgressPercentage (float) –
The percentage of the slot migration that is complete.
AuthTokenStatus (string) –
The auth token status
UserGroups (dict) –
The user group being modified.
UserGroupIdsToAdd (list) –
The ID of the user group to add.
(string) –
UserGroupIdsToRemove (list) –
The ID of the user group to remove.
(string) –
LogDeliveryConfigurations (list) –
The log delivery configurations being modified
(dict) –
The log delivery configurations being modified
LogType (string) –
Refers to slow-log or engine-log..
DestinationType (string) –
Returns the destination type, either CloudWatch Logs or Kinesis Data Firehose.
DestinationDetails (dict) –
Configuration details of either a CloudWatch Logs destination or Kinesis Data Firehose destination.
CloudWatchLogsDetails (dict) –
The configuration details of the CloudWatch Logs destination.
LogGroup (string) –
The name of the CloudWatch Logs log group.
KinesisFirehoseDetails (dict) –
The configuration details of the Kinesis Data Firehose destination.
DeliveryStream (string) –
The name of the Kinesis Data Firehose delivery stream.
LogFormat (string) –
Returns the log format, either JSON or TEXT
TransitEncryptionEnabled (boolean) –
A flag that enables in-transit encryption when set to true.
TransitEncryptionMode (string) –
A setting that allows you to migrate your clients to use in-transit encryption, with no downtime.
MemberClusters (list) –
The names of all the cache clusters that are part of this replication group.
(string) –
NodeGroups (list) –
A list of node groups in this replication group. For Redis (cluster mode disabled) replication groups, this is a single-element list. For Redis (cluster mode enabled) replication groups, the list contains an entry for each node group (shard).
(dict) –
Represents a collection of cache nodes in a replication group. One node in the node group is the read/write primary node. All the other nodes are read-only Replica nodes.
NodeGroupId (string) –
The identifier for the node group (shard). A Redis (cluster mode disabled) replication group contains only 1 node group; therefore, the node group ID is 0001. A Redis (cluster mode enabled) replication group contains 1 to 90 node groups numbered 0001 to 0090. Optionally, the user can provide the id for a node group.
Status (string) –
The current state of this replication group -
creating
,available
,modifying
,deleting
.PrimaryEndpoint (dict) –
The endpoint of the primary node in this node group (shard).
Address (string) –
The DNS hostname of the cache node.
Port (integer) –
The port number that the cache engine is listening on.
ReaderEndpoint (dict) –
The endpoint of the replica nodes in this node group (shard).
Address (string) –
The DNS hostname of the cache node.
Port (integer) –
The port number that the cache engine is listening on.
Slots (string) –
The keyspace for this node group (shard).
NodeGroupMembers (list) –
A list containing information about individual nodes within the node group (shard).
(dict) –
Represents a single node within a node group (shard).
CacheClusterId (string) –
The ID of the cluster to which the node belongs.
CacheNodeId (string) –
The ID of the node within its cluster. A node ID is a numeric identifier (0001, 0002, etc.).
ReadEndpoint (dict) –
The information required for client programs to connect to a node for read operations. The read endpoint is only applicable on Redis (cluster mode disabled) clusters.
Address (string) –
The DNS hostname of the cache node.
Port (integer) –
The port number that the cache engine is listening on.
PreferredAvailabilityZone (string) –
The name of the Availability Zone in which the node is located.
PreferredOutpostArn (string) –
The outpost ARN of the node group member.
CurrentRole (string) –
The role that is currently assigned to the node -
primary
orreplica
. This member is only applicable for Redis (cluster mode disabled) replication groups.
SnapshottingClusterId (string) –
The cluster ID that is used as the daily snapshot source for the replication group.
AutomaticFailover (string) –
Indicates the status of automatic failover for this Redis replication group.
MultiAZ (string) –
A flag indicating if you have Multi-AZ enabled to enhance fault tolerance. For more information, see Minimizing Downtime: Multi-AZ
ConfigurationEndpoint (dict) –
The configuration endpoint for this replication group. Use the configuration endpoint to connect to this replication group.
Address (string) –
The DNS hostname of the cache node.
Port (integer) –
The port number that the cache engine is listening on.
SnapshotRetentionLimit (integer) –
The number of days for which ElastiCache retains automatic cluster snapshots before deleting them. For example, if you set
SnapshotRetentionLimit
to 5, a snapshot that was taken today is retained for 5 days before being deleted.Warning
If the value of
SnapshotRetentionLimit
is set to zero (0), backups are turned off.SnapshotWindow (string) –
The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your node group (shard).
Example:
05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
Note
This parameter is only valid if the
Engine
parameter isredis
.ClusterEnabled (boolean) –
A flag indicating whether or not this replication group is cluster enabled; i.e., whether its data can be partitioned across multiple shards (API/CLI: node groups).
Valid values:
true
|false
CacheNodeType (string) –
The name of the compute and memory capacity node type for each node in the replication group.
AuthTokenEnabled (boolean) –
A flag that enables using an
AuthToken
(password) when issuing Redis commands.Default:
false
AuthTokenLastModifiedDate (datetime) –
The date the auth token was last modified
TransitEncryptionEnabled (boolean) –
A flag that enables in-transit encryption when set to
true
.Required: Only available when creating a replication group in an Amazon VPC using redis version
3.2.6
,4.x
or later.Default:
false
AtRestEncryptionEnabled (boolean) –
A flag that enables encryption at-rest when set to
true
.You cannot modify the value of
AtRestEncryptionEnabled
after the cluster is created. To enable encryption at-rest on a cluster you must setAtRestEncryptionEnabled
totrue
when you create a cluster.Required: Only available when creating a replication group in an Amazon VPC using redis version
3.2.6
,4.x
or later.Default:
false
MemberClustersOutpostArns (list) –
The outpost ARNs of the replication group’s member clusters.
(string) –
KmsKeyId (string) –
The ID of the KMS key used to encrypt the disk in the cluster.
ARN (string) –
The ARN (Amazon Resource Name) of the replication group.
UserGroupIds (list) –
The ID of the user group associated to the replication group.
(string) –
LogDeliveryConfigurations (list) –
Returns the destination, format and type of the logs.
(dict) –
Returns the destination, format and type of the logs.
LogType (string) –
Refers to slow-log or engine-log.
DestinationType (string) –
Returns the destination type, either
cloudwatch-logs
orkinesis-firehose
.DestinationDetails (dict) –
Configuration details of either a CloudWatch Logs destination or Kinesis Data Firehose destination.
CloudWatchLogsDetails (dict) –
The configuration details of the CloudWatch Logs destination.
LogGroup (string) –
The name of the CloudWatch Logs log group.
KinesisFirehoseDetails (dict) –
The configuration details of the Kinesis Data Firehose destination.
DeliveryStream (string) –
The name of the Kinesis Data Firehose delivery stream.
LogFormat (string) –
Returns the log format, either JSON or TEXT.
Status (string) –
Returns the log delivery configuration status. Values are one of
enabling
|disabling
|modifying
|active
|error
Message (string) –
Returns an error message for the log delivery configuration.
ReplicationGroupCreateTime (datetime) –
The date and time when the cluster was created.
DataTiering (string) –
Enables data tiering. Data tiering is only supported for replication groups using the r6gd node type. This parameter must be set to true when using r6gd nodes. For more information, see Data tiering.
AutoMinorVersionUpgrade (boolean) –
If you are running Redis engine version 6.0 or later, set this parameter to yes if you want to opt-in to the next auto minor version upgrade campaign. This parameter is disabled for previous versions.
NetworkType (string) –
Must be either
ipv4
|ipv6
|dual_stack
. IPv6 is supported for workloads using Redis engine version 6.2 onward or Memcached engine version 1.6.6 on all instances built on the Nitro system.IpDiscovery (string) –
The network type you choose when modifying a cluster, either
ipv4
|ipv6
. IPv6 is supported for workloads using Redis engine version 6.2 onward or Memcached engine version 1.6.6 on all instances built on the Nitro system.TransitEncryptionMode (string) –
A setting that allows you to migrate your clients to use in-transit encryption, with no downtime.
Exceptions
ElastiCache.Client.exceptions.ReplicationGroupNotFoundFault
ElastiCache.Client.exceptions.InvalidReplicationGroupStateFault
ElastiCache.Client.exceptions.InvalidUserGroupStateFault
ElastiCache.Client.exceptions.UserGroupNotFoundFault
ElastiCache.Client.exceptions.InvalidCacheClusterStateFault
ElastiCache.Client.exceptions.InvalidCacheSecurityGroupStateFault
ElastiCache.Client.exceptions.InsufficientCacheClusterCapacityFault
ElastiCache.Client.exceptions.CacheClusterNotFoundFault
ElastiCache.Client.exceptions.NodeQuotaForClusterExceededFault
ElastiCache.Client.exceptions.NodeQuotaForCustomerExceededFault
ElastiCache.Client.exceptions.CacheSecurityGroupNotFoundFault
ElastiCache.Client.exceptions.CacheParameterGroupNotFoundFault
ElastiCache.Client.exceptions.InvalidVPCNetworkStateFault
ElastiCache.Client.exceptions.InvalidKMSKeyFault
ElastiCache.Client.exceptions.InvalidParameterValueException
ElastiCache.Client.exceptions.InvalidParameterCombinationException
Examples
response = client.modify_replication_group( ApplyImmediately=True, ReplicationGroupDescription='Modified replication group', ReplicationGroupId='my-redis-rg', SnapshotRetentionLimit=30, SnapshottingClusterId='my-redis-rg-001', ) print(response)
Expected Output:
{ 'ReplicationGroup': { 'AutomaticFailover': 'enabled', 'Description': 'Modified replication group', 'MemberClusters': [ 'my-redis-rg-001', 'my-redis-rg-002', 'my-redis-rg-003', ], 'NodeGroups': [ { 'NodeGroupId': '0001', 'NodeGroupMembers': [ { 'CacheClusterId': 'my-redis-rg-001', 'CacheNodeId': '0001', 'CurrentRole': 'primary', 'PreferredAvailabilityZone': 'us-east-1b', 'ReadEndpoint': { 'Address': 'my-redis-rg-001.abcdef.0001.use1.cache.amazonaws.com', 'Port': 6379, }, }, { 'CacheClusterId': 'my-redis-rg-002', 'CacheNodeId': '0001', 'CurrentRole': 'replica', 'PreferredAvailabilityZone': 'us-east-1a', 'ReadEndpoint': { 'Address': 'my-redis-rg-002.abcdef.0001.use1.cache.amazonaws.com', 'Port': 6379, }, }, { 'CacheClusterId': 'my-redis-rg-003', 'CacheNodeId': '0001', 'CurrentRole': 'replica', 'PreferredAvailabilityZone': 'us-east-1c', 'ReadEndpoint': { 'Address': 'my-redis-rg-003.abcdef.0001.use1.cache.amazonaws.com', 'Port': 6379, }, }, ], 'PrimaryEndpoint': { 'Address': 'my-redis-rg.abcdef.ng.0001.use1.cache.amazonaws.com', 'Port': 6379, }, 'Status': 'available', }, ], 'PendingModifiedValues': { }, 'ReplicationGroupId': 'my-redis-rg', 'SnapshottingClusterId': 'my-redis-rg-002', 'Status': 'available', }, 'ResponseMetadata': { '...': '...', }, }