Replication Group Args
Provides an ElastiCache Replication Group resource. For working with a Memcached cluster or a single-node Redis instance (Cluster Mode Disabled), see the aws.elasticache.Cluster
resource.
Note: When you change an attribute, such as
engine_version
, by default the ElastiCache API applies it in the next maintenance window. Because of this, this provider may report a difference in its planning phase because the actual modification has not yet taken place. You can use theapply_immediately
flag to instruct the service to apply the change immediately. Usingapply_immediately
can result in a brief downtime as servers reboots. See the AWS Documentation on Modifying an ElastiCache Cache Cluster for more information. Note: Any attribute changes that re-create the resource will be applied immediately, regardless of the value ofapply_immediately
. Note: Be aware of the terminology collision around "cluster" foraws.elasticache.ReplicationGroup
. For example, it is possible to create a "Cluster Mode Disabled Redis Cluster". With "Cluster Mode Enabled", the data will be stored in shards (called "node groups"). See Redis Cluster Configuration for a diagram of the differences. To enable cluster mode, use a parameter group that has cluster mode enabled. The default parameter groups provided by AWS end with ".cluster.on", for exampledefault.redis6.x.cluster.on
.
Example Usage
Redis Cluster Mode Disabled
To create a single shard primary with single read replica:
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.elasticache.ReplicationGroup;
import com.pulumi.aws.elasticache.ReplicationGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ReplicationGroup("example", ReplicationGroupArgs.builder()
.automaticFailoverEnabled(true)
.description("example description")
.nodeType("cache.m4.large")
.numCacheClusters(2)
.parameterGroupName("default.redis3.2")
.port(6379)
.preferredCacheClusterAzs(
"us-west-2a",
"us-west-2b")
.build());
}
}
Redis Cluster Mode Enabled
To create two shards with a primary and a single read replica each:
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.elasticache.ReplicationGroup;
import com.pulumi.aws.elasticache.ReplicationGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var baz = new ReplicationGroup("baz", ReplicationGroupArgs.builder()
.automaticFailoverEnabled(true)
.description("example description")
.nodeType("cache.t2.small")
.numNodeGroups(2)
.parameterGroupName("default.redis3.2.cluster.on")
.port(6379)
.replicasPerNodeGroup(1)
.build());
}
}
Redis Log Delivery configuration
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.elasticache.ReplicationGroup;
import com.pulumi.aws.elasticache.ReplicationGroupArgs;
import com.pulumi.aws.elasticache.inputs.ReplicationGroupLogDeliveryConfigurationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new ReplicationGroup("test", ReplicationGroupArgs.builder()
.description("test description")
.nodeType("cache.t3.small")
.port(6379)
.applyImmediately(true)
.autoMinorVersionUpgrade(false)
.maintenanceWindow("tue:06:30-tue:07:30")
.snapshotWindow("01:00-02:00")
.logDeliveryConfigurations(
ReplicationGroupLogDeliveryConfigurationArgs.builder()
.destination(aws_cloudwatch_log_group.example().name())
.destinationType("cloudwatch-logs")
.logFormat("text")
.logType("slow-log")
.build(),
ReplicationGroupLogDeliveryConfigurationArgs.builder()
.destination(aws_kinesis_firehose_delivery_stream.example().name())
.destinationType("kinesis-firehose")
.logFormat("json")
.logType("engine-log")
.build())
.build());
}
}
Creating a secondary replication group for a global replication group
A Global Replication Group can have one one two secondary Replication Groups in different regions. These are added to an existing Global Replication Group.
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.elasticache.ReplicationGroup;
import com.pulumi.aws.elasticache.ReplicationGroupArgs;
import com.pulumi.aws.elasticache.GlobalReplicationGroup;
import com.pulumi.aws.elasticache.GlobalReplicationGroupArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new ReplicationGroup("primary", ReplicationGroupArgs.builder()
.description("primary replication group")
.engine("redis")
.engineVersion("5.0.6")
.nodeType("cache.m5.large")
.numCacheClusters(1)
.build(), CustomResourceOptions.builder()
.provider(aws.other_region())
.build());
var example = new GlobalReplicationGroup("example", GlobalReplicationGroupArgs.builder()
.globalReplicationGroupIdSuffix("example")
.primaryReplicationGroupId(primary.id())
.build(), CustomResourceOptions.builder()
.provider(aws.other_region())
.build());
var secondary = new ReplicationGroup("secondary", ReplicationGroupArgs.builder()
.description("secondary replication group")
.globalReplicationGroupId(example.globalReplicationGroupId())
.numCacheClusters(1)
.build());
}
}
Import
ElastiCache Replication Groups can be imported using the replication_group_id
, e.g.,
$ pulumi import aws:elasticache/replicationGroup:ReplicationGroup my_replication_group replication-group-1
Constructors
Functions
Properties
Create a native Redis cluster. automatic_failover_enabled
must be set to true. Cluster Mode documented below. Only 1 cluster_mode
block is allowed. Note that configuring this block does not enable cluster mode, i.e., data sharding, this requires using a parameter group that has the parameter cluster-enabled
set to true.
Version number of the cache engine to be used for the cache clusters in this replication group. If the version is 6 or higher, the major and minor version can be set, e.g., 6.2
, or the minor version can be unspecified which will use the latest version at creation time, e.g., 6.x
. Otherwise, specify the full version desired, e.g., 5.0.6
. The actual engine version used is returned in the attribute engine_version_actual
, see Attributes Reference below.
The ID of the global replication group to which this replication group should belong. If this parameter is specified, the replication group is added to the specified global replication group as a secondary replication group; otherwise, the replication group is not part of any global replication group. If global_replication_group_id
is set, the num_node_groups
parameter (or the num_node_groups
parameter of the deprecated cluster_mode
block) cannot be set.
Specifies the destination and format of Redis SLOWLOG or Redis Engine Log. See the documentation on Amazon ElastiCache. See Log Delivery Configuration below for more details.
Instance class to be used. See AWS documentation for information on supported node types and guidance on selecting node types. Required unless global_replication_group_id
is set. Cannot be set if global_replication_group_id
is set.
Number of cache clusters (primary and replicas) this replication group will have. If Multi-AZ is enabled, the value of this parameter must be at least 2. Updates will occur before other modifications. Conflicts with num_node_groups
, the deprecatednumber_cache_clusters
, or the deprecated cluster_mode
. Defaults to 1
.
Number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of snapshot_retention_limit
is set to zero (0), backups are turned off. Please note that setting a snapshot_retention_limit
is not supported on cache.t1.micro cache nodes
Map of tags to assign to the resource. Adding tags to this resource will add or overwrite any existing tags on the clusters in the replication group and not to the group itself. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.