Bird
0
0

What is the best practice to update the shared code safely?

hard📝 Best Practice Q15 of 15
AWS - Lambda
You have two Lambda functions, both using a shared layer with version 3. You want to update the shared code without affecting the functions immediately. What is the best practice to update the shared code safely?
ADelete version 3 and create a new layer with the same version number
BOverwrite version 3 of the layer with new code so both functions get updates automatically
CPublish a new layer version 4 with updated code, then update each function to use version 4 when ready
DUpdate the functions' code directly instead of using layers
Step-by-Step Solution
Solution:
  1. Step 1: Understand layer version immutability

    Lambda layer versions are immutable; you cannot overwrite an existing version.
  2. Step 2: Apply best practice for safe updates

    Publish a new version with updated code and update functions individually to control rollout.
  3. Final Answer:

    Publish a new layer version 4 with updated code, then update each function to use version 4 when ready -> Option C
  4. Quick Check:

    New layer version + update functions individually = safe update [OK]
Quick Trick: Publish new layer version; update functions selectively [OK]
Common Mistakes:
MISTAKES
  • Trying to overwrite existing layer version
  • Deleting and recreating layers with same version
  • Updating function code instead of using layers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes