You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
This is not possible to delete stacks with name longer than 128 chars #6840
This 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 Behavior
Stack is successfully deleted.
Current Behavior
An error occurred (ValidationError) when calling the DeleteStack operation: Stack name cannot exceed 128 characters
Reproduction Steps
Steps to Reproduce:
Create any CFN stack with name longer than 128 characters, not from AWS console, but using cdk construct. This is possible to do it with cdk constructs.
Try to delete stack with aws cli: aws cloudformation delete-stack --stack-name {name}
The name that's associated with the stack. The name must be unique in the Region in which you are creating the stack.
Note
A stack name can contain only alphanumeric characters (case sensitive) and hyphens. It must start with an alphabetical character and can't be longer than 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.
@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:
createStackRequest = CreateStackRequest.builder()
.stackName({NAME})
.templateBody({BODY})
.roleARN({ROLE})
.parameters(parameters)
.build()
cloudFormationClient.createStack(createStackRequest)
```
These stacks were created ~ 6 months ago. I dropped everything, I can reproduce it later if required.
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.
@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.
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:
software.amazon.awssdk.services.cloudformation.model.CloudFormationException: Stack name cannot exceed 128 characters (Service: CloudFormation, Status Code: 400, Request ID: e4ae2cb4-2433-4654-9baa-ef7b0a618bdd)
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!
Activity
kdaily commentedon Apr 1, 2022
Hi @ikhvostenkov,
Thanks for writing. According to the CloudFormation
CreateStackdocumentation, stack names are limited to 128 characters:It looks like that would be a server side Validation error (if you provide
--debuglogs 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.
kellertk commentedon Apr 1, 2022
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:
It will actually
synthfine though. 🤔Edit: After some digging it looks like this error is coming right from the CloudFormation service API.
peterwoodworth commentedon Apr 1, 2022
@ikhvostenkov I'm curious how you initially deployed the stacks (i.e.
cdk deploy), and how long ago?ikhvostenkov commentedon Apr 1, 2022
@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:
kdaily commentedon Apr 2, 2022
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.
ikhvostenkov commentedon Apr 4, 2022
@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.
kdaily commentedon Apr 4, 2022
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!
kdaily commentedon Apr 4, 2022
Just a heads up that I'm going to migrate this question to the AWS CLI GitHub discussions to continue our conversation. Thanks!