Search code examples
aws-lambda

Deploying the AWS lambda from VS Code: ValidationError in DescribeStacks - must satisfy regular expression


  1. Coded an AWS lambda function in Python3.12 on my local VS Code.
  2. Successful with $ sam build and $ sam local invoke
  3. An error encountered at the $ sam deploy --guided step. The error is:
Error: An error occurred (ValidationError) when calling the DescribeStacks operation: 1 validation error detected: Value 'lambda-python3.12-fa47e7c4-CompanionStack' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*

I'm looking for a quick-fix resolution to this error and the lambda to get deployed.


Solution

  • To resolve this note that the stack name lambda-python3.12 does not satisfy the regular expression pattern given. The decimal in 3.12 does not fit the pattern. For a quick fix, redo the $ sam deploy --guided again, but this time for the answer to Stack Name [lambda-python3.12]: don't just accept the default, rather change to lambda-python3 and move on with the rest. Good luck!