CloudArcade

Guided architecture tour · 6–8 min

Share a toolkit between functions — Lambda and Layers

Plan how two functions can share the same helper library.

This tour teaches architecture decisions. Its services are not provisioned in the emulator.

Your goal

Plan how two functions can share the same helper library.

Why this matters

Two functions need the same image tools. You will package the tools once, choose a tested version, and plan an update without breaking both functions.

Words you will use

A dependency is code your code uses. A layer is a versioned package of files that can be attached to compatible ZIP-based Lambda functions.

How to proceed

Read each situation and choose an answer. The lesson explains the result. Try again if needed, then continue through all three decisions and finish the tour.

Play this architecture tour

1. Choose the shared package

Two ZIP-based functions use the same image library. Copying files by hand has left them with different versions. Choose a reusable package.

Where can shared dependencies live?

In a Lambda layer compatible with both functions.

A layer can hold shared libraries and other files. It must match the function runtime and processor architecture. Sharing a package does not remove the need to test it with each function.

Both functions have a common source for their tools.

Compatible dependencies → layer package → publish version

2. Choose an exact version

A new layer version has just been published. Your working function should keep using the version that passed its tests until you choose to update it.

What should the function reference?

A specific published layer version.

Layer versions are separate, fixed releases. Attaching an exact version makes the dependency choice clear. Publishing a new version does not silently update every function that used the old one.

The function keeps a known set of dependencies.

Function configuration → layer version 3

3. Roll out a change carefully

Version 4 changes how a helper reads images. One function may handle inputs differently from the other. Choose a safe rollout.

How should you adopt version 4?

Test each function, then update its layer reference.

Test the real input shapes each function expects. Update references after those checks pass and keep a working rollback option. A shared library can spread a bug just as easily as a useful fix.

The update has evidence and a way back.

Test new layer → update references → watch results

Practice, then check your understanding

In the interactive tour, make each decision before seeing the outcome. Wrong answers receive coaching, and replay gives you a fresh attempt without duplicating earned XP.

Read the official AWS documentation for service behavior and production details.

Continue with another AWS learning guide