使用 Bitbucket 流水线进行部署 Amazon SAM - Amazon Serverless Application Model
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 Bitbucket 流水线进行部署 Amazon SAM

要将 Bitbucket Pipelin e 配置为自动构建和部署 Amazon SAM 应用程序,您的bitbucket-pipelines.yml文件必须包含执行以下操作的行:

  1. 从可用映像中引用具有必要运行时的构建容器映像。以下示例使用 public.ecr.aws/sam/build-nodejs20.x 构建容器映像。

  2. 配置管道阶段以运行必要的 Amazon SAM 命令行界面 (CLI) 命令。以下示例运行两个 Amazon SAM CLI 命令:sam buildsam deploy(带有必要的选项)。

此示例假设您已使用声明 Amazon SAM 模板文件中的所有函数和层runtime: nodejs20.x

image: public.ecr.aws/sam/build-nodejs20.x pipelines: branches: main: # branch name - step: name: Build and Package script: - sam build - sam deploy --no-confirm-changeset --no-fail-on-empty-changeset

有关不同运行时的可用 Amazon Elastic Container Registry (Amazon ECR) 构建容器映像的列表,请参阅 的图像存储库 Amazon SAM