AWS ElastiCache Global Replication Group

This page shows how to write Terraform and CloudFormation for ElastiCache Global Replication Group and write them securely.

aws_elasticache_global_replication_group (Terraform)

The Global Replication Group in ElastiCache can be configured in Terraform with the resource name aws_elasticache_global_replication_group. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L49
resource "aws_elasticache_global_replication_group" "this" {
  global_replication_group_id_suffix = "ha"
  primary_replication_group_id       = module.redis_main.elasticache_replication_group_id
}

module "redis_replica" {

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

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.

Tips: Best Practices for The Other AWS ElastiCache Resources

In addition to the aws_elasticache_cluster, AWS ElastiCache has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_elasticache_cluster

Ensure to enable backup retention of Elasitcache

It's better to take snapshots of Redis clusters to improve data availability.

risk-label

aws_elasticache_replication_group

Ensure to enable in-transit encryption of ElastiCache

It's better to enable in-transit encryption of ElastiCahe. If the ElastiCache replication group uses unencrypted traffic, it is vulnerable to meet-in-the-middle (MITM) attacks.

Review your AWS ElastiCache settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::ElastiCache::GlobalReplicationGroup (CloudFormation)

The GlobalReplicationGroup in ElastiCache can be configured in CloudFormation with the resource name AWS::ElastiCache::GlobalReplicationGroup. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

Consists of a primary cluster that accepts writes and an associated secondary cluster that resides in a different Amazon region. The secondary cluster accepts only reads. The primary cluster automatically replicates updates to the secondary cluster.

  • The GlobalReplicationGroupIdSuffix represents the name of the Global datastore, which is what you use to associate a secondary cluster.

Frequently asked questions

What is AWS ElastiCache Global Replication Group?

AWS ElastiCache Global Replication Group is a resource for ElastiCache of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS ElastiCache Global Replication Group?

For Terraform, the umotif-public/terraform-aws-elasticache-redis source code example is useful. See the Terraform Example section for further details.