- Newest
- Most votes
- Most comments
The error you're encountering is not due to a CloudFormation bug, but rather due to the way Valkey clusters need to be created in Amazon ElastiCache. Unlike Redis, Valkey clusters cannot be created using the CacheCluster resource type in CloudFormation.
For Valkey, you need to use the ReplicationGroup resource type instead of CacheCluster. This is because Valkey clusters are always created as replication groups, even if you're only creating a single-node cluster.
To create a Valkey cluster using CloudFormation, you should modify your template to use AWS::ElastiCache::ReplicationGroup instead of AWS::ElastiCache::CacheCluster. Here's an example of how you might modify your template:
ElastiCacheCluster: Type: AWS::ElastiCache::ReplicationGroup Properties: AutoMinorVersionUpgrade: Ref: AutoMinorVersionUpgrade Engine: valkey CacheNodeType: Ref: CacheNodeType ReplicationGroupId: Ref: ClusterName NumCacheClusters: 1 CacheSubnetGroupName: Ref: SubnetGroup SecurityGroupIds: - Fn::ImportValue: Fn::Sub: ${ECSResourcesStackName}:InternalSecurityGroup - Fn::ImportValue: Fn::Sub: ${LambdaResourcesStackName}:InternalSecurityGroup
Note the changes:
- The Type is now AWS::ElastiCache::ReplicationGroup
- ClusterName is replaced with ReplicationGroupId
- NumCacheNodes is replaced with NumCacheClusters
- VpcSecurityGroupIds is replaced with SecurityGroupIds
These changes should allow you to create a Valkey cluster using CloudFormation. Remember that Valkey clusters are always created as replication groups, which is why the API and resource type are different from what you might use for a single-node Redis cluster.
Sources
Creating a Valkey or Redis OSS replication group - Amazon ElastiCache
Creating a cluster for Valkey or Redis OSS - Amazon ElastiCache
Relevant content
- Accepted Answerasked 6 months ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 3 years ago