I want to resolve discontinued Lambda function runtime issues in AWS CloudFormation.
Resolution
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshoot AWS CLI errors. Also, make sure that you use the most recent AWS CLI version.
When you update a Lambda function from a discontinued runtime in your CloudFormation stack, make sure that you don't update additional resources in your template. This might result in a failed update that initiates a rollback. Stack rollbacks attempt to perform a rollback update on your Lambda function resource to return the runtime version back to the discontinued value. Because the value is no longer accepted, the stack reaches an UPDATE_ROLLBACK_FAILED status. The API call lambda:UpdateFunctionConfiguration fails with the following error:
Error while updating function configuration: InvalidParameterValueException: The runtime parameter of xxxxxxx is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (xxxxxx) while creating or updating functions.
To bring your stack back to a stable state, follow these steps:
- Continue the stack rollback and skip the impacted resources in an UPDATE_FAILED status. You can use either the AWS Management Console or the AWS CLI to complete this step. Your Lambda function uses the attempted value from your stack.
- Address the root cause of the UPDATE_FAILED status in your stack. Make sure that the CloudFormation template references the desired runtime version in the template.
- To bring the stack to an UPDATE_COMPLETE status, perform a new CloudFormation stack update with the template.
For more troubleshooting tips, see How can I get my CloudFormation stack to update if it's stuck in the UPDATE_ROLLBACK_FAILED state?