Skip to content

Conversation

@mazyu36
Copy link
Contributor

@mazyu36 mazyu36 commented Dec 19, 2025

Issue # (if applicable)

Closes #36458

Reason for this change

When deploying an ElastiCache ServerlessCache or UserGroup without explicitly specifying a serverlessCacheName or userGroupId, the auto-generated name can exceed AWS ElastiCache's 40-character limit, causing deployment failures.

The current implementation uses Names.uniqueId() which generates names without length constraints. With longer stack names or construct paths, the generated identifier exceeds the service's maximum allowed length.

Description of changes

Replace the name generation logic with Names.uniqueResourceName(this, { maxLength: 40 }) to ensure generated names respect the AWS limit:

Description of how you validated changes

Added integration test integ.serverless-cache-auto-generate-name.ts that creates a ServerlessCache and UserGroup without specifying names.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team December 19, 2025 13:13
@github-actions github-actions bot added bug This issue is a bug. p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Dec 19, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@aws-cdk-automation aws-cdk-automation dismissed their stale review December 23, 2025 14:11

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results50 ran50 passed
TestResult
No test annotations available

@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates50 ran50 passed
TestResult
No test annotations available

@mazyu36 mazyu36 marked this pull request as ready for review December 23, 2025 14:16
@github-actions github-actions bot added the effort/medium Medium work item – several days of effort label Dec 23, 2025
@mazyu36
Copy link
Contributor Author

mazyu36 commented Dec 23, 2025

Exemption Request: Existing unit tests already cover auto-generated names, and the integration test validates the 40-character limit in the generated snapshot.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue is a bug. distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/medium Medium work item – several days of effort p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-elasticache-alpha): ServerlessCache deployment fails when serverlessCacheName is not specified

2 participants