This is not possible to delete stacks with name longer than 128 chars #6847
-
Describe the bugThis is possible to create stack with name longer than 128 chars through CDK, but this is not possible to delete stack with AWS cli with stack name longer than 128 chars. Probably this should be prohibited to create stacks with name longer than 128 char in CDK, but as soon as this is possible you should have chance to delete it, especially if you have ~100 such stacks, doing this through AWS Console manually is annoying. Expected BehaviorStack is successfully deleted. Current BehaviorAn error occurred (ValidationError) when calling the DeleteStack operation: Stack name cannot exceed 128 characters Reproduction StepsSteps to Reproduce:
Possible SolutionNo response Additional Information/ContextNo response CLI version usedaws --version aws-cli/1.20.6 Python/3.8.6 Darwin/21.3.0 botocore/1.21.7 Environment details (OS name and version, etc.)sw_vers ProductName: macOS ProductVersion: 12.2.1 BuildVersion: 21D62 |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
Hi @ikhvostenkov, Thanks for writing. According to the CloudFormation
It looks like that would be a server side Validation error (if you provide I'll check in with the CDK team for some more information. |
Beta Was this translation helpful? Give feedback.
-
While it appears that CDK does not check for this at synthesis time,, I wasn't able to get a test stack deployed with a really long name: #!/usr/bin/env node
import * as cdk from 'aws-cdk-lib';
import { CdkTestStack } from '../lib/cdk-test-stack';
const app = new cdk.App();
new CdkTestStack(app, 'LookAtMyReallyLongStackNameThisStackNameIsLongerThan128CharactersThatIsNutsIDontThinkThereIsEnoughAWSAvailableToLetEveryoneHaveStackNamesThisLong'); PS C:\Users\theto\Documents\GitHub\cdk-test> cdk deploy
✨ Synthesis time: 8.85s
Stack name cannot exceed 128 characters
PS C:\Users\theto\Documents\GitHub\cdk-test> It will actually Edit: After some digging it looks like this error is coming right from the CloudFormation service API. |
Beta Was this translation helpful? Give feedback.
-
@ikhvostenkov I'm curious how you initially deployed the stacks (i.e. |
Beta Was this translation helpful? Give feedback.
-
@kdaily @peterwoodworth @kellertk Sorry, I confused you. I just checked the code and these stacks were created with JAVA SDK, not with cdk, by some reason I thought these stacks were created with cdk. Here is the code snippet:
|
Beta Was this translation helpful? Give feedback.
-
Thanks @ikhvostenkov! I'll check with our Java team too, but since the error comes from the service, the Java SDK should now also error with the same response. |
Beta Was this translation helpful? Give feedback.
-
@kdaily I totally agree, that this is a bug in Java SDK, however, I think, this should be possible to delete any stack despite the stack's name length via AWS cli, as that might be other people having the same problem. And also this is possible to delete stack with name longer than 128 chars via AWS Console and then there is discrepancy between how AWS Console works and how AWS cli works. |
Beta Was this translation helpful? Give feedback.
-
Hi @ikhvostenkov, I'm checked with the Java team, and supplying a stack name greater than 128 characters fails with the following error, which is the same server side error received through the AWS CLI:
I also tried to create a stack with the AWS console, which failed as well: So, I think I'll need to see how you can reproduce this issue with a longer stack name! |
Beta Was this translation helpful? Give feedback.
-
Just a heads up that I'm going to migrate this question to the AWS CLI GitHub discussions to continue our conversation. Thanks! |
Beta Was this translation helpful? Give feedback.
Hi @ikhvostenkov,
Thanks for writing. According to the CloudFormation
CreateStack
documentation, stack names are limited to 128 characters:It looks like that would be a server side Validation error (if you provide
--debug
logs we can confirm), as the API does not model the length limitations for us to do validation on client side.I'll check in with the CDK team for some more information.