1. How to enable cluster mode in Redis ElastiCache on AWS?


    In AWS ElastiCache for Redis, enabling cluster mode involves creating a Redis (cluster mode enabled) replication group. A replication group is a collection of one to six Redis clusters, where each Redis cluster has one to five and 0 to 40 read replica Nodes. But Pulumi's aws.elasticache.Cluster class does not directly support enabling the cluster mode.

    Below is a code block that explains how to create a Redis ElastiCache with basic configuration:

    import * as aws from "@pulumi/aws"; // Create a security group that allows inbound access on Redis port let secgrp = new aws.ec2.SecurityGroup("secgrp", { ingress: [{ protocol: "tcp", fromPort: 6379, toPort: 6379, cidrBlocks: [""], }] }); const cluster = new aws.elasticache.Cluster("cluster", { clusterId: "my-cluster", engine: "redis", nodeType: "cache.t2.micro", numCacheNodes: 1, parameterGroupName: "default.redis3.2", engineVersion: "3.2.10", port: 6379, subnetGroupName: "my-vpc", securityGroupIds: [ secgrp.id ] });

    In the above code, a new AWS ElastiCache Redis cluster is created with the help of the aws.elasticache.Cluster class. The engine property is set to "redis", nodeType is set to the type of Redis node that you'd like to launch, numCacheNodes indicates the initial number of cache nodes, subnetGroupName refers to the Name of the subnet group to be used for the cache cluster. Please replace "my-vpc" with the name of your VPC's subnet group and replace secgrp.id with your security group id you want to assign.

    Bear in mind that this code only creates a simple Redis ElastiCache Cluster and does not enable the cluster mode specifically. You might have to enable it manually via AWS Management Console.

    For more information about Elasticache Cluster properties, you can refer to the Pulumi Documentation.