AWS CloudFormation implementing in UPDATE_ROLLBACK_FAILED State When Updating Lambda Function
I've searched everywhere and can't find a clear answer. I recently switched to I'm dealing with I'm working with an scenario where my CloudFormation stack is getting exploring in the `UPDATE_ROLLBACK_FAILED` state while trying to update an AWS Lambda function... My Lambda function is written in Python 3.8, and I'm attempting to update it with a new environment variable and a minor code change. The specific behavior message I see in the CloudFormation console is `The following resource(s) failed to update: [MyLambdaFunction]`. I've tried to manually update the Lambda function through the AWS console, and it works fine, but I need to resolve this through CloudFormation to maintain infrastructure as code. Here is the relevant part of my CloudFormation template: ```yaml Resources: MyLambdaFunction: Type: 'AWS::Lambda::Function' Properties: FunctionName: myLambdaFunction Handler: lambda_function.lambda_handler Runtime: python3.8 Role: arn:aws:iam::123456789012:role/service-role/MyLambdaExecutionRole Code: S3Bucket: mybucket S3Key: mylambda.zip Environment: MY_ENV_VAR: new_value ``` I also noticed that the stack events show `Resource update cancelled` due to the Lambda function failing to update. I tried rolling back the stack using the `aws cloudformation continue-update-rollback` command, but it returns an behavior indicating that the resource is in an invalid state. I've checked the IAM role permissions, and they seem fine. The Lambda function log shows no errors after the update attempt. Is there any way to diagnose what exactly is causing the rollback failure, or should I try deleting the stack entirely and recreating it? Any help would be appreciated! I recently upgraded to Python 3.9. I'd love to hear your thoughts on this. This is happening in both development and production on Ubuntu 20.04. Any suggestions would be helpful. I'm using Python latest in this project. Hoping someone can shed some light on this.