GlobalReplicationGroup class
Provides an ElastiCache Global Replication Group resource, which manages replication between two or more Replication Groups in different regions. For more information, see the ElastiCache User Guide.
Example Usage
Global replication group with one secondary replication group
The global replication group depends on the primary group existing. Secondary replication groups depend on the global replication group. the provider dependency management will handle this transparently using resource value references.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const primary = new aws.elasticache.ReplicationGroup("primary", {
replicationGroupId: "example-primary",
description: "primary replication group",
engine: "redis",
engineVersion: "5.0.6",
nodeType: "cache.m5.large",
numCacheClusters: 1,
});
const example = new aws.elasticache.GlobalReplicationGroup("example", {
globalReplicationGroupIdSuffix: "example",
primaryReplicationGroupId: primary.id,
});
const secondary = new aws.elasticache.ReplicationGroup("secondary", {
replicationGroupId: "example-secondary",
description: "secondary replication group",
globalReplicationGroupId: example.globalReplicationGroupId,
numCacheClusters: 1,
});
import pulumi
import pulumi_aws as aws
primary = aws.elasticache.ReplicationGroup("primary",
replication_group_id="example-primary",
description="primary replication group",
engine="redis",
engine_version="5.0.6",
node_type="cache.m5.large",
num_cache_clusters=1)
example = aws.elasticache.GlobalReplicationGroup("example",
global_replication_group_id_suffix="example",
primary_replication_group_id=primary.id)
secondary = aws.elasticache.ReplicationGroup("secondary",
replication_group_id="example-secondary",
description="secondary replication group",
global_replication_group_id=example.global_replication_group_id,
num_cache_clusters=1)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var primary = new Aws.ElastiCache.ReplicationGroup("primary", new()
{
ReplicationGroupId = "example-primary",
Description = "primary replication group",
Engine = "redis",
EngineVersion = "5.0.6",
NodeType = "cache.m5.large",
NumCacheClusters = 1,
});
var example = new Aws.ElastiCache.GlobalReplicationGroup("example", new()
{
GlobalReplicationGroupIdSuffix = "example",
PrimaryReplicationGroupId = primary.Id,
});
var secondary = new Aws.ElastiCache.ReplicationGroup("secondary", new()
{
ReplicationGroupId = "example-secondary",
Description = "secondary replication group",
GlobalReplicationGroupId = example.GlobalReplicationGroupId,
NumCacheClusters = 1,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/elasticache"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := elasticache.NewReplicationGroup(ctx, "primary", &elasticache.ReplicationGroupArgs{
ReplicationGroupId: pulumi.String("example-primary"),
Description: pulumi.String("primary replication group"),
Engine: pulumi.String("redis"),
EngineVersion: pulumi.String("5.0.6"),
NodeType: pulumi.String("cache.m5.large"),
NumCacheClusters: pulumi.Int(1),
})
if err != nil {
return err
}
example, err := elasticache.NewGlobalReplicationGroup(ctx, "example", &elasticache.GlobalReplicationGroupArgs{
GlobalReplicationGroupIdSuffix: pulumi.String("example"),
PrimaryReplicationGroupId: primary.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
_, err = elasticache.NewReplicationGroup(ctx, "secondary", &elasticache.ReplicationGroupArgs{
ReplicationGroupId: pulumi.String("example-secondary"),
Description: pulumi.String("secondary replication group"),
GlobalReplicationGroupId: example.GlobalReplicationGroupId,
NumCacheClusters: pulumi.Int(1),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_elasticache_globalreplicationgroup" "example" {
global_replication_group_id_suffix = "example"
primary_replication_group_id = aws_elasticache_replicationgroup.primary.id
}
resource "aws_elasticache_replicationgroup" "primary" {
replication_group_id = "example-primary"
description = "primary replication group"
engine = "redis"
engine_version = "5.0.6"
node_type = "cache.m5.large"
num_cache_clusters = 1
}
resource "aws_elasticache_replicationgroup" "secondary" {
replication_group_id = "example-secondary"
description = "secondary replication group"
global_replication_group_id = aws_elasticache_globalreplicationgroup.example.global_replication_group_id
num_cache_clusters = 1
}
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 java.util.ArrayList;
import java.util.Arrays;
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()
.replicationGroupId("example-primary")
.description("primary replication group")
.engine("redis")
.engineVersion("5.0.6")
.nodeType("cache.m5.large")
.numCacheClusters(1)
.build());
var example = new GlobalReplicationGroup("example", GlobalReplicationGroupArgs.builder()
.globalReplicationGroupIdSuffix("example")
.primaryReplicationGroupId(primary.id())
.build());
var secondary = new ReplicationGroup("secondary", ReplicationGroupArgs.builder()
.replicationGroupId("example-secondary")
.description("secondary replication group")
.globalReplicationGroupId(example.globalReplicationGroupId())
.numCacheClusters(1)
.build());
}
}
resources:
example:
type: aws:elasticache:GlobalReplicationGroup
properties:
globalReplicationGroupIdSuffix: example
primaryReplicationGroupId: ${primary.id}
primary:
type: aws:elasticache:ReplicationGroup
properties:
replicationGroupId: example-primary
description: primary replication group
engine: redis
engineVersion: 5.0.6
nodeType: cache.m5.large
numCacheClusters: 1
secondary:
type: aws:elasticache:ReplicationGroup
properties:
replicationGroupId: example-secondary
description: secondary replication group
globalReplicationGroupId: ${example.globalReplicationGroupId}
numCacheClusters: 1
Managing Redis OOS/Valkey Engine Versions
The initial Redis version is determined by the version set on the primary replication group. However, once it is part of a Global Replication Group, the Global Replication Group manages the version of all member replication groups.
The provider is configured to ignore changes to engine, engineVersion and parameterGroupName inside aws.elasticache.ReplicationGroup resources if they belong to a global replication group.
In this example, the primary replication group will be created with Redis 6.0, and then upgraded to Redis 6.2 once added to the Global Replication Group. The secondary replication group will be created with Redis 6.2.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const primary = new aws.elasticache.ReplicationGroup("primary", {
replicationGroupId: "example-primary",
description: "primary replication group",
engine: "redis",
engineVersion: "6.0",
nodeType: "cache.m5.large",
numCacheClusters: 1,
});
const example = new aws.elasticache.GlobalReplicationGroup("example", {
globalReplicationGroupIdSuffix: "example",
primaryReplicationGroupId: primary.id,
engineVersion: "6.2",
});
const secondary = new aws.elasticache.ReplicationGroup("secondary", {
replicationGroupId: "example-secondary",
description: "secondary replication group",
globalReplicationGroupId: example.globalReplicationGroupId,
numCacheClusters: 1,
});
import pulumi
import pulumi_aws as aws
primary = aws.elasticache.ReplicationGroup("primary",
replication_group_id="example-primary",
description="primary replication group",
engine="redis",
engine_version="6.0",
node_type="cache.m5.large",
num_cache_clusters=1)
example = aws.elasticache.GlobalReplicationGroup("example",
global_replication_group_id_suffix="example",
primary_replication_group_id=primary.id,
engine_version="6.2")
secondary = aws.elasticache.ReplicationGroup("secondary",
replication_group_id="example-secondary",
description="secondary replication group",
global_replication_group_id=example.global_replication_group_id,
num_cache_clusters=1)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var primary = new Aws.ElastiCache.ReplicationGroup("primary", new()
{
ReplicationGroupId = "example-primary",
Description = "primary replication group",
Engine = "redis",
EngineVersion = "6.0",
NodeType = "cache.m5.large",
NumCacheClusters = 1,
});
var example = new Aws.ElastiCache.GlobalReplicationGroup("example", new()
{
GlobalReplicationGroupIdSuffix = "example",
PrimaryReplicationGroupId = primary.Id,
EngineVersion = "6.2",
});
var secondary = new Aws.ElastiCache.ReplicationGroup("secondary", new()
{
ReplicationGroupId = "example-secondary",
Description = "secondary replication group",
GlobalReplicationGroupId = example.GlobalReplicationGroupId,
NumCacheClusters = 1,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/elasticache"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
primary, err := elasticache.NewReplicationGroup(ctx, "primary", &elasticache.ReplicationGroupArgs{
ReplicationGroupId: pulumi.String("example-primary"),
Description: pulumi.String("primary replication group"),
Engine: pulumi.String("redis"),
EngineVersion: pulumi.String("6.0"),
NodeType: pulumi.String("cache.m5.large"),
NumCacheClusters: pulumi.Int(1),
})
if err != nil {
return err
}
example, err := elasticache.NewGlobalReplicationGroup(ctx, "example", &elasticache.GlobalReplicationGroupArgs{
GlobalReplicationGroupIdSuffix: pulumi.String("example"),
PrimaryReplicationGroupId: primary.ID().ToIDOutput().ToStringOutput(),
EngineVersion: pulumi.String("6.2"),
})
if err != nil {
return err
}
_, err = elasticache.NewReplicationGroup(ctx, "secondary", &elasticache.ReplicationGroupArgs{
ReplicationGroupId: pulumi.String("example-secondary"),
Description: pulumi.String("secondary replication group"),
GlobalReplicationGroupId: example.GlobalReplicationGroupId,
NumCacheClusters: pulumi.Int(1),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_elasticache_globalreplicationgroup" "example" {
global_replication_group_id_suffix = "example"
primary_replication_group_id = aws_elasticache_replicationgroup.primary.id
engine_version = "6.2"
}
resource "aws_elasticache_replicationgroup" "primary" {
replication_group_id = "example-primary"
description = "primary replication group"
engine = "redis"
engine_version = "6.0"
node_type = "cache.m5.large"
num_cache_clusters = 1
}
resource "aws_elasticache_replicationgroup" "secondary" {
replication_group_id = "example-secondary"
description = "secondary replication group"
global_replication_group_id = aws_elasticache_globalreplicationgroup.example.global_replication_group_id
num_cache_clusters = 1
}
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 java.util.ArrayList;
import java.util.Arrays;
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()
.replicationGroupId("example-primary")
.description("primary replication group")
.engine("redis")
.engineVersion("6.0")
.nodeType("cache.m5.large")
.numCacheClusters(1)
.build());
var example = new GlobalReplicationGroup("example", GlobalReplicationGroupArgs.builder()
.globalReplicationGroupIdSuffix("example")
.primaryReplicationGroupId(primary.id())
.engineVersion("6.2")
.build());
var secondary = new ReplicationGroup("secondary", ReplicationGroupArgs.builder()
.replicationGroupId("example-secondary")
.description("secondary replication group")
.globalReplicationGroupId(example.globalReplicationGroupId())
.numCacheClusters(1)
.build());
}
}
resources:
example:
type: aws:elasticache:GlobalReplicationGroup
properties:
globalReplicationGroupIdSuffix: example
primaryReplicationGroupId: ${primary.id}
engineVersion: '6.2'
primary:
type: aws:elasticache:ReplicationGroup
properties:
replicationGroupId: example-primary
description: primary replication group
engine: redis
engineVersion: '6.0'
nodeType: cache.m5.large
numCacheClusters: 1
secondary:
type: aws:elasticache:ReplicationGroup
properties:
replicationGroupId: example-secondary
description: secondary replication group
globalReplicationGroupId: ${example.globalReplicationGroupId}
numCacheClusters: 1
Import
Using pulumi import, import ElastiCache Global Replication Groups using the globalReplicationGroupId. For example:
$ pulumi import aws:elasticache/globalReplicationGroup:GlobalReplicationGroup my_global_replication_group okuqm-global-replication-group-1
Constructors
- GlobalReplicationGroup(String name, {GlobalReplicationGroupArgs? args, CustomResourceOptions? options})
-
Creates a new GlobalReplicationGroup.
nameThe Pulumi resource name.argsArguments used to configure this GlobalReplicationGroup. The set of arguments for GlobalReplicationGroup.optionsResource options controlling this resource's behavior. - GlobalReplicationGroup.reference(String urn)
- Creates a typed reference to an existing GlobalReplicationGroup resource.
Properties
-
arn
↔ Output<
String> -
The ARN of the ElastiCache Global Replication Group.
latefinal
-
atRestEncryptionEnabled
↔ Output<
bool> -
A flag that indicate whether the encryption at rest is enabled.
latefinal
-
authTokenEnabled
↔ Output<
bool> -
A flag that indicate whether AuthToken (password) is enabled.
latefinal
-
automaticFailoverEnabled
↔ Output<
bool> -
Specifies whether read-only replicas will be automatically promoted to read/write primary if the existing primary fails.
When creating, by default the Global Replication Group inherits the automatic failover setting of the primary replication group.
latefinal
-
cacheNodeType
↔ Output<
String> -
The instance class used.
See AWS documentation for information on supported node types
and guidance on selecting node types.
When creating, by default the Global Replication Group inherits the node type of the primary replication group.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
clusterEnabled
↔ Output<
bool> -
Indicates whether the Global Datastore is cluster enabled.
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
engine
↔ Output<
String> -
The name of the cache engine to be used for the clusters in this global replication group.
When creating, by default the Global Replication Group inherits the engine of the primary replication group.
If an engine is specified, the Global Replication Group and all member replication groups will be upgraded to this engine.
Valid values are
redisorvalkey. Default isredisifengineVersionis specified.latefinal -
engineVersion
↔ Output<
String> -
Engine version to use for the Global Replication Group.
When creating, by default the Global Replication Group inherits the version of the primary replication group.
If a version is specified, the Global Replication Group and all member replication groups will be upgraded to this version.
Cannot be downgraded without replacing the Global Replication Group and all member replication groups.
When the version is 7 or higher, the major and minor version should be set, e.g.,
7.2. When the version is 6, 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. The actual engine version used is returned in the attributeengineVersionActual, see Attribute Reference below.latefinal -
engineVersionActual
↔ Output<
String> -
The full version number of the cache engine running on the members of this global replication group.
latefinal
-
globalNodeGroups
↔ Output<
List< GlobalReplicationGroupGlobalNodeGroup> > -
Set of node groups (shards) on the global replication group.
Has the values:
latefinal
-
globalReplicationGroupDescription
↔ Output<
String?> -
A user-created description for the global replication group.
latefinal
-
globalReplicationGroupId
↔ Output<
String> -
The full ID of the global replication group.
latefinal
-
globalReplicationGroupIdSuffix
↔ Output<
String> -
The suffix name of a Global Datastore. If
globalReplicationGroupIdSuffixis changed, creates a new resource.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
numNodeGroups
↔ Output<
int> -
The number of node groups (shards) on the global replication group.
latefinal
-
parameterGroupName
↔ Output<
String?> -
An ElastiCache Parameter Group to use for the Global Replication Group.
Required when upgrading an engine or major engine version, but will be ignored if left configured after the upgrade is complete.
Specifying without a major version upgrade will fail.
Note that ElastiCache creates a copy of this parameter group for each member replication group.
latefinal
-
primaryReplicationGroupId
↔ Output<
String> -
The ID of the primary cluster that accepts writes and will replicate updates to the secondary cluster. If
primaryReplicationGroupIdis changed, creates a new resource.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
transitEncryptionEnabled
↔ Output<
bool> -
A flag that indicates whether the encryption in transit is enabled.
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {GlobalReplicationGroupState? state, CustomResourceOptions? options}) → GlobalReplicationGroup -
Gets an existing GlobalReplicationGroup resource's state with the given
nameandid.