Building a Versioned Lambda Deployment Script With the AWS CLI

You've got a Lambda running in production and a shiny new image sitting in ECR. The lazy move is to update the image URI, walk away, and hope for the best. The problem is that this swaps the code for everyone, instantly, with no safety net. If the new version is broken, congratulations, it's broken for 100% of your traffic before you even finish your coffee. What you might be looking for is to publish an immutable version, then shift traffic onto it in a controlled way, all from a single script and preferably in an automated manner. The script set -euo pipefail aws lambda wait function-updated-v2 --function-name "$1" aws lambda update-function-code --function-name "$1" --image-uri "$3" aws
…