确保您的 CDK 版本和 AWS 代码管道不会发生兼容性问题。最好使用最新版本。
确保您的代码库中包括所需的依赖项,以便通过运行 npm install 安装。
确保您的封送列表中包含 .jsii 文件。
确保您的 IAM 角色被授权发布到 CloudFormation。
以下是一个示例 CDK 项目的构建规范:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
build:
commands:
- npm install -g aws-cdk
- npm install
- cdk synth
artifacts:
files:
- lib/**/*
- cdk.out/**
discard-paths: yes