Course contentsShow
← Cloud and Infrastructure
Lesson 486 of 2,9899. Serverless ComputeFree lesson

Function Versions and Aliases

Managing multiple function versions and using aliases to enable safe deployments and traffic shifting.

Function Versions and Aliases

You'll learn how to manage multiple versions of your serverless functions and use aliases to route traffic safely between them.

What Are Function Versions?

Every time you deploy changes to your serverless function, you can publish a version — an immutable snapshot of your function's code, configuration, and environment variables. Think of versions like published book editions: once printed, they can't be changed. The function you're actively working on is called $LATEST (the unpublished draft), while each version gets a number like 1, 2, 3, etc.

What Are Aliases?

An alias is a friendly pointer or label that references a specific function version. Instead of invoking myFunction:3, you might invoke myFunction:prod. Aliases are mutable — you can change which version they point to without changing the code that calls your function.

Think of an alias like a bookmark: the bookmark (alias) stays the same, but you can move it to point at different pages (versions) in your book.

Why Use Them Together?

This combination enables safe deployments:

  • Deploy new code as version 4
  • Keep your prod alias pointing at version 3
  • Test version 4 thoroughly using a test alias
  • When ready, update prod to point at version 4
  • If problems arise, instantly roll back prod to version 3

Advanced aliases even support traffic shifting — splitting traffic between two versions (e.g., 90% to version 3, 10% to version 4) for gradual rollouts and A/B testing.

This versioning strategy prevents breaking production deployments and gives you precise control over which code runs in each environment.

Key Takeaway: Function versions create immutable snapshots of your code, while aliases provide stable names that can point to different versions, enabling safe deployments, instant rollbacks, and controlled traffic shifting.