@amazon-codecatalyst/blueprints.sam-serverless-application

中文文档
0.3.159发布于 2026/08/24Apache-2.0TypeScriptCommonJS近 30 天下载 7171

This blueprint creates a project that leverages a serverless application model (SAM) to quickly create and deploy an API. You can choose Java, TypeScript, or Python as the programming language

原始使用文档
文档目录8 节
  1. This Blueprint
  2. Architecture overview
  3. Connections and permissions
  4. IAM role trust policy
  5. Deploy role policy
  6. Build role policy
  7. Project resources
  8. Additional resources

This Blueprint

This Blueprint generates an AWS Serverless Application Model (SAM) project.

A serverless application is a combination of AWS Lambda functions, event sources, and other resources that work together to perform tasks. A serverless application can also include additional resources such as APIs, databases, and event source mappings. For more information on serverless applications, see the AWS Serverless Application Model (SAM) Developer Guide

The project uses an Amazon CodeCatalyst environment to deploy a SAM application with AWS Lambda and Amazon API Gateway to an Amazon CloudFront URL. After you create your project, you can view the repository, source code, and continuous integration and continuous delivery (CI/CD) workflow for your project. After your workflow runs successfully, your deployed AWS Cloud Development Kit (CDK) application URL is available under the output for your workflow.

Architecture overview

This project uses:

  • Node.js 14
  • Java 11
  • Python 3.9

You can choose any of the above as the programming language.

Architecture diagram

Connections and permissions

Configure your AWS account connection from the AWS accounts tab in your Amazon CodeCatalyst space. Add AWS IAM roles to the account extension to authorize project workflows to access AWS account resources.

The SAM application requires the following IAM roles to build and deploy the application:

IAM role trust policy

{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Sid": "CodeCatalyst",
          "Effect": "Allow",
          "Principal": {
              "Service": [
                  "codecatalyst-runner.amazonaws.com",
                  "codecatalyst.amazonaws.com"
              ]
          },
          "Action": "sts:AssumeRole"
      }
  ]
}

Deploy role policy

Create a role based on the trust policy above, and add the following inline policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "iam:PassRole",
                "iam:DeleteRole",
                "iam:GetRole",
                "iam:TagRole",
                "iam:CreateRole",
                "iam:AttachRolePolicy",
                "iam:DetachRolePolicy",
                "cloudformation:*",
                "lambda:*",
                "apigateway:*"
            ],
            "Resource": "*"
        }
    ]
}

_Note: You must update the policy if you add more resources.

Build role policy

Create a role based on the trust policy above, and add the following inline policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:*",
                "cloudformation:*"
            ],
            "Resource": "*"
        }
    ]
}

Project resources

After being successfully created, this project deploys the following AWS resources:

  • AWS Lambda function(s) - A resource that invokes your code on a high-availability compute infrastructure without provisioning or managing servers. For more information on AWS Lambda, see the AWS Lambda Developer Guide

  • Amazon API Gateway - A resource that creates, publishes, maintains, monitors, and secures REST, HTTP, and WebSocket APIs at any scale. For more information on API Gateway, see the AWS API Gateway Developer Guide

  • IAM role(s) - A resource that secures controlled access to AWS resources such as the AWS Lambda function(s). For more information on IAM, see the AWS IAM User Guide

The deployment status can be viewed in the project's workflow.

This blueprint creates the following Amazon CodeCatalyst resources:

  • Source repository named HelloWorld - A Git repository to store, version, and manage project assets.

    • template.yaml - The template that defines the application's AWS resources, including AWS Lambda functions, Amazon API Gateways, and IAM roles.
    • devfile.yaml - A devfile that defines Dev Environments or development environments that have been built for the cloud.

    For more information on source repositories, see the Working with source repositories section in the Amazon CodeCatalyst User Guide.

  • Workflows defined in .codecatalyst/workflows/build-and-release.yaml

    A workflow is an automated procedure that defines how to build, test, and deploy the serverless application. For more information, see the Build, test, and deploy with workflows section of the Amazon CodeCatalyst User Guide.

  • Environment(s) - An abstraction of infrastructure resources that deploy applications. You can use environments can be used to organize deployment actions into a production or non-production environment.

    For more information on environments, see the Organizing deployments using environments section in the Amazon CodeCatalyst User Guide.

  • Dev Environment - A cloud-based development environment. A Dev Environment must be manually created with the generated devfile using the Create Dev Environment operation in Amazon CodeCatalyst.

    For more information on creating Dev Environments, see the Working with Dev Environments section in the Amazon CodeCatalyst User Guide.

Additional resources

See the Amazon CodeCatalyst User Guide for additional information on using the features and resources of Amazon CodeCatalyst.

版本与发布记录

@amazon-codecatalyst/blueprints.sam-serverless-application 共发布 158 个版本,首次发布于 2023/09/26;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.3.159latest2026/08/242 个月前
0.3.1582026/08/222 个月前
0.3.1572026/08/152 个月前
0.3.1562026/07/074 个月前
0.3.1552025/01/081.8 年前
0.3.1542024/10/022 年前

关于 @amazon-codecatalyst/blueprints.sam-serverless-application 的常见问题

@amazon-codecatalyst/blueprints.sam-serverless-application 是什么?

This blueprint creates a project that leverages a serverless application model (SAM) to quickly create and deploy an API. You can choose Java, TypeScript, or Python as the programming language

如何安装 @amazon-codecatalyst/blueprints.sam-serverless-application?

在项目目录运行 npm install @amazon-codecatalyst/blueprints.sam-serverless-application,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@amazon-codecatalyst/blueprint-util.cli(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@amazon-codecatalyst/blueprints.sam-serverless-application 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@amazon-codecatalyst/blueprints.sam-serverless-application 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@amazon-codecatalyst/blueprints.sam-serverless-application 可以商用吗?

@amazon-codecatalyst/blueprints.sam-serverless-application 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@amazon-codecatalyst/blueprints.sam-serverless-application 的下载量有多少?

根据 npm 官方下载统计,@amazon-codecatalyst/blueprints.sam-serverless-application 在 2026/10/06 – 2026/11/04 这 30 天内被下载 7,171 次,日均约 239 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@amazon-codecatalyst/blueprints.sam-serverless-application 还在维护吗?

最新版本 0.3.159 发布于 2026/08/24(2 个月前);至今共发布 158 个版本,其中过去 12 个月发布了 4 个;首次发布于 2023/09/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。