You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于AWS Lambda函数中Deploy与Publish的差异及相关问题咨询

AWS Lambda: Deploy vs. Publish Explained

Great question—this is a super common point of confusion when working with Lambda, so let’s break down the differences and your follow-up questions clearly.

Core Definitions

First, let’s get the basics straight:

  • Deploy: This is the act of uploading your updated code (or container image) to Lambda. When you deploy, you’re updating the unpublished, mutable version of your function, known as $LATEST. Think of $LATEST as your "draft" version—you can overwrite it as many times as you want during development, and it’s not meant for production use (since it can change unexpectedly).
  • Publish: This turns a specific version of your function (usually $LATEST) into an immutable, numbered release (like v1, v2, etc.). Once published, this version can never be modified—each has a unique ARN, and it’s a fixed snapshot of your code at the time of publishing. This is what you’ll use for production, since it’s stable and predictable.

Your Follow-Up Questions

1. If I only run Deploy, will consuming services pointing to the "latest" function version use the updated code?

Yes—if those services are referencing either:

  • The $LATEST version directly, or
  • An alias that’s configured to point to $LATEST

When you deploy, you’re overwriting $LATEST with your new code, so any traffic targeting $LATEST will immediately start using the updated function. That said, if your consuming services are pointing to a specific numbered version (like v3), deploying won’t affect them at all—those immutable versions stay exactly as they were published.

2. If I only run Publish, will deployment happen automatically?

No—publishing alone doesn’t make your new version active for traffic. Publishing just creates a fixed snapshot of your code, but you still need to route traffic to it. For example:

  • If your API Gateway is configured to trigger v3 of your function, publishing v4 won’t change that—traffic will still go to v3.
  • To make the published version live, you’ll need to either:
    • Update your alias (like PROD) to point to the new numbered version, or
    • Reconfigure your triggers/consuming services to use the new version’s ARN.

Quick Real-World Example

Here’s how this flows in practice:

  1. You deploy updated code to $LATEST and test it manually.
  2. Once it’s working, you publish $LATEST as v4.
  3. You update your PROD alias from v3 to v4—now production traffic starts using the new version.
  4. If you find a bug, you can quickly switch the PROD alias back to v3 while you fix the issue.

内容的提问来源于stack exchange,提问作者variable

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 18:02:49