Using custom resource names in CloudFormation can potentially cause resources' physical ids to exceed the allowed limit of 64 characters. Especially with nested stacks, as AWS::CloudFormation::Stack
does not support custom names causing nested stacks to always be named automatically in the format <logical-id>-XXXXXXXXXXXX
, with XXXXXXXXXXXX
being a autogenerated identifier.
Below is an example of AWS::Lambda::Function
within a nested CloudFormation stack.
Physical resource id is generated using the following format.
<root-stack-name>-XXXXXXXXXXXX-<lambda-function-name>
Quickly exceeds max length 64 characters.
1 validation error detected:
Value 'MyStackDev-MyNestedApplicationStack-K87FLFVLYVQJ-MyLambdaFunctionName'
at 'functionName' failed to satisfy constraint:
Member must have length less than or equal to 64
(
Service: AWSLambda;
Status Code: 400;
Error Code: InvalidParameterValueException;
Request ID: eab56570-8aaa-11e8-9306-c996c69bdf46
)
Physical resource id generated using the following format and trimmed to maximum of 64 characters.
<root-stack-name>-<nested-stack-logical-id>-XXXXXXXXXXXX
Automatic resource ID too long (70 characters)
MyStackDev-MyNestedApplicationStack-MyLambdaFunctionName-1U44TLUZ7OR55
Actual resource ID (64 characters)
MyStackDev-MyNestedApplicatio-MyLambdaFunctionName-1U44TLUZ7OR55