Skip to content

Commit

Permalink
Automate Lambda image switchover
Browse files Browse the repository at this point in the history
If the Lambda is configured to use the image tagged latest, I think it
will automatically update on push. I discovered that from running the
added command. Therefore I think adding this bit isn't necessary, but
hey, it can't hurt.

Lifecycle rules can be configured in ECR to clean up old images, so that
should cover that. Deletion does not therefore need to be automated.
  • Loading branch information
rossjrw committed Feb 5, 2025
1 parent 1ba3193 commit 7d0263c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build_deploy_lambda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -e

docker build --target execute_lambda --tag notifier:execute_lambda --tag 288611151503.dkr.ecr.eu-west-2.amazonaws.com/wikidot_notifier:latest --provenance false .

aws ecr get-login-password --region eu-west-2 --profile notifier | docker login --username AWS --password-stdin 288611151503.dkr.ecr.eu-west-2.amazonaws.com

docker push 288611151503.dkr.ecr.eu-west-2.amazonaws.com/wikidot_notifier:latest

echo "Next steps:"
echo "In Lambda, re-select the new image as the Lambda image"
echo "In ECR, delete old untagged images"
aws lambda update-function-code --function-name WikidotNotifier --image-uri 288611151503.dkr.ecr.eu-west-2.amazonaws.com/wikidot_notifier:latest --region eu-west-2 --profile notifier

0 comments on commit 7d0263c

Please sign in to comment.