-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-elasticache: In-transit encryption is not supported for Redis? #27379
Comments
The workaround seems to be using a Something like: const redis = new CfnReplicationGroup(this, 'APICacheV2', {
engine: 'redis',
replicationGroupDescription: 'Cache for the API',
cacheNodeType: 'cache.t4g.micro',
cacheSubnetGroupName: redisSubnetGroup.ref,
securityGroupIds: [redisSecurityGroup.securityGroupId],
transitEncryptionEnabled: true,
// As minimal of a cache cluster as I can make.
clusterMode: 'Disabled',
numCacheClusters: 1,
automaticFailoverEnabled: false,
}) |
Yup, this looks like an oversight somewhere.
There's a few other checks that have to be made as well here. |
Agreed. I also realized that I included the link to the ReplicationGroup documentation instead of the CacheCluster documentation in my OP. I've fixed this. Here's the current documentation for CacheCluster + in-transit encryption: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-transitencryptionenabled It doesn't mention any stipulations at all, which is rather surprising given the stipulations that exist on ReplicationGroup. |
I think I have a similar issue when trying to create ElastiCache with TerraForm
|
Yeah, I'm starting to wonder if this isn't a CDK issue at all, and is in fact an underlying "service doesn't meet documentation" issue. |
CloudFormation template has this, too, so not an SDK problem. The "encryption at rest" feature is also missing entirely. |
looks like the issue is still opened, I just ran into the same using Terraform |
For the encryption in transit, using the properties from here works fine, and for the encryption at rest, you can use auto-generated KMS managed by AWS doing Example: // this = your stack if within its declaration, otherwise change it to its instantiated obj
// Redis Security Group
const redisSecurityGroup = new ec2.SecurityGroup(this, `${serviceName}-redis-sg`, {
securityGroupName: `${serviceName}-redis-security-group`,
description: `Security group for ${serviceName} Redis cluster`,
allowAllOutbound: true,
vpc: this.vpc, // your vpc object or variable
});
this.exportValue(redisSecurityGroup.securityGroupId, { name: `${serviceName}-redis-security-group-id` });
// Elasticache Subnet Group
const redisSubnetGroup = new elasticache.CfnSubnetGroup(this, `${serviceName}-redis-subnet`, {
cacheSubnetGroupName: `${serviceName}-redis-subnet-group`,
description: `Subnet group for ${serviceName} Redis cluster`,
subnetIds: this.vpc.privateSubnets.map(subnet => subnet.subnetId),
});
// Redis Replication Group - Elasticache
const redisCluster = new elasticache.CfnReplicationGroup(this, `${serviceName}-redis-cluster`, {
replicationGroupId: `${serviceName}`,
replicationGroupDescription: `Redis cluster for ${serviceName} application`,
cacheNodeType: redisInstance, // 'cache.r7g.2xlarge'
engine: 'redis',
engineVersion: engineVersion, // '7.1'
cacheParameterGroupName: paramGroup, // 'default.redis7.cluster.on' (you may use existing ones or create new ones)
numNodeGroups: numShards, // 1
replicasPerNodeGroup: nodesPerShard, // 2 (this will create 1 shard with 3 nodes, being 1 as replica, auto managed as it is clusted mode on)
automaticFailoverEnabled: true,
securityGroupIds: [redisSecurityGroup.securityGroupId],
cacheSubnetGroupName: redisSubnetGroup.cacheSubnetGroupName,
port: 6379,
multiAzEnabled: true,
autoMinorVersionUpgrade: true,
atRestEncryptionEnabled: true,
transitEncryptionEnabled: true, // comment out to disable encryption in transit
transitEncryptionMode: 'required', // options of 'preferred' or 'required'
// kmsKeyId, // provide the KMS key id here, e.g. "arn:aws:kms:${region}:${accountId}:key/${hashId}"
clusterMode: 'enabled',
preferredMaintenanceWindow: 'tue:07:00-tue:08:00', // same as (00:00am PST = 03:00 EST)
});
redisCluster.cfnOptions.updatePolicy = {
useOnlineResharding: true
}
// Set DeletionPolicy to Retain
redisCluster.applyRemovalPolicy(cdk.RemovalPolicy.RETAIN);
// Create Redis only after the Redis Security Group is created
redisCluster.node.addDependency(redisSubnetGroup); |
Describe the bug
When attempting to create a Redis elasticache cluster that enables in-transit encryption, we receive the following error:
This doesn't make any sense though, as the public documentation clearly states that encryption is supported:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-cache-cluster.html#cfn-elasticache-cachecluster-transitencryptionenabled
In addition, we are using VPC, per the documentation.
Here's our code that should enable easy reproduction:
Expected Behavior
I am able to create a Redis Elasticache instance with transit encryption enabled.
Current Behavior
An error occurs (see description)
Reproduction Steps
Use the CDK code in the description to deploy a Redis cluster.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.92.0 (build bf62e55)
Framework Version
No response
Node.js Version
18
OS
Linux
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: