https://pulumi.com logo
#aws
Title
# aws
g

gray-translator-86978

07/18/2022, 10:23 AM
I am trying to set up Elasticache/Redis with auth and encryption. Is that possible? I am using TypeScript I can't see any options for those in the type definition (or the online docs!)
b

billowy-army-68599

07/18/2022, 2:38 PM
yes it’s possible, they’re part of the parameter group https://www.pulumi.com/registry/packages/aws/api-docs/elasticache/parametergroup/
g

gray-translator-86978

07/18/2022, 2:58 PM
Thanks for the reply. It's not obvious what the keys I need for parametergroup,
b

billowy-army-68599

07/18/2022, 3:04 PM
@gray-translator-86978 which language are you using?
g

gray-translator-86978

07/18/2022, 3:05 PM
I am using TypeScript.
they’re all in the replication group settings
g

gray-translator-86978

07/18/2022, 3:08 PM
OK, thanks. I will take a look. I'm not using replication groups fwiw.
It's not immediately clear to me how replication relates to client auth and encryption,
b

billowy-army-68599

07/18/2022, 3:22 PM
this is an aws thing, it’s only available on replication groups (ie multi node clusters) https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/auth.html
g

gray-translator-86978

07/18/2022, 3:25 PM
I don't think that's a true as I have the most vanilla Redis cluster (1 node, no replication) with auth and encryption.
b

billowy-army-68599

07/18/2022, 3:30 PM
how did you enable it?
g

gray-translator-86978

07/18/2022, 3:30 PM
Sorry - my bad
b

billowy-army-68599

07/18/2022, 3:31 PM
?
g

gray-translator-86978

07/18/2022, 3:31 PM
I am trying to ENABLE auth and encryption via pulumi.
(Sorry for the confusion)
b

billowy-army-68599

07/18/2022, 3:43 PM
Pulumi is just calling the AWS APIs. The SDK we generate comes from the AWS API. As far as I’m aware, the only way to enable encryption and auth for a redis elasticache is using a replication group. The fact that there’s a replication group doesn’t necessarily mean it’s not a one node cluster. I verified this by creating a redis cluster manually in the console (see screenshot) then looked at the configuration via the AWS CLI:
Copy code
aws elasticache describe-cache-clusters --cache-cluster-id lbriggs-single-001
{
    "CacheClusters": [
        {
            "CacheClusterId": "lbriggs-single-001",
            "ClientDownloadLandingPage": "<https://console.aws.amazon.com/elasticache/home#client-download>:",
            "CacheNodeType": "cache.t3.micro",
            "Engine": "redis",
            "EngineVersion": "6.2.6",
            "CacheClusterStatus": "creating",
            "NumCacheNodes": 1,
            "PreferredAvailabilityZone": "us-west-2a",
            "PreferredMaintenanceWindow": "thu:12:30-thu:13:30",
            "PendingModifiedValues": {},
            "CacheSecurityGroups": [],
            "CacheParameterGroup": {
                "CacheParameterGroupName": "default.redis6.x",
                "ParameterApplyStatus": "in-sync",
                "CacheNodeIdsToReboot": []
            },
            "CacheSubnetGroupName": "cachesubnets-69a1cf9",
            "AutoMinorVersionUpgrade": true,
            "ReplicationGroupId": "lbriggs-single",
            "SnapshotRetentionLimit": 1,
            "SnapshotWindow": "07:00-08:00",
            "AuthTokenEnabled": true,
            "AuthTokenLastModifiedDate": "2022-07-18T15:37:48.651000+00:00",
            "TransitEncryptionEnabled": true,
            "AtRestEncryptionEnabled": true,
            "ARN": "arn:aws:elasticache:us-west-2:616138583583:cluster:lbriggs-single-001",
            "ReplicationGroupLogDeliveryEnabled": false,
            "LogDeliveryConfigurations": []
        }
    ]
}
You can see behind the scenes it’s still created a replication group (see second screenshot) - so you just need to define your settings there
g

gray-translator-86978

07/18/2022, 3:44 PM
Thanks a lot. I will take a look
Though I am NOT using a replication group when I set up a vanilla redis cluster via the console
b

billowy-army-68599

07/18/2022, 3:48 PM
can you screenshot your redis cluster in the console? like the settings I posted above? or output the result of
aws elasticache describe-cache-clusters
g

gray-translator-86978

07/18/2022, 3:50 PM
That was setup via Pulumi I lied, manualy
b

billowy-army-68599

07/18/2022, 3:51 PM
okay, you see
ARN
in the third column?
see how it says “replicationgroup”
you might not have defined a replicationgroup, so one was created for you.
so when you keep saying “I’m not creating a replication group” that isn’t actually true, you are using a replication group. You just didn’t define one in the console, the AWS console hides it all from you. So if you want to set up a redis cluster with auth and encryption enabled, you need to define your own replication group
g

gray-translator-86978

07/18/2022, 3:53 PM
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import { ClusterArgs } from "@pulumi/aws/elasticache";

const config = new pulumi.Config();

const nodeType = "cache.t3.small";

const securityGroupIds = config.require(
  "securityGroupIds"
) as unknown as string[];
const subnetGroupName = config.require("subnetGroupName");

const params: ClusterArgs = {
  engine: "redis",
  nodeType,
  numCacheNodes: 1,
  parameterGroupName: "default.redis6.x",
  securityGroupIds,
  subnetGroupName,
};

new aws.elasticache.Cluster("example", params);
When I setup cluster manually, can set AUTH + encryption directly, no explicit replication
b

billowy-army-68599

07/18/2022, 3:57 PM
okay, I’m really not sure how better to explain this. is the screenshot I just posted showing you that there is a replication group not clear? You’re right there’s not explicit replication, but there IS a replication group
g

gray-translator-86978

07/19/2022, 9:31 AM
Thank you for your help - all working now
4 Views