从更新 AMI 图像管道 AWS CLI - EC2 Image Builder

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

从更新 AMI 图像管道 AWS CLI

您可以使用 JSON 文件作为 AWS CLI中的 update-image-pipeline 命令的输入来更新 AMI 映像管道。要配置 JSON 文件,您必须有 Amazon 资源名称 (ARNs) 才能引用以下现有资源:

  • 要更新的映像管道

  • 映像配方

  • 基础设施配置

  • 分配设置

您可以使用中的update-image-pipeline命令更新 AMI 映像管道, AWS CLI 如下所示:

注意

UpdateImagePipeline 不支持对管道进行选择性更新。您必须在更新请求中指定所有必需的属性,而不仅仅是已更改的属性。

  1. 创建 CLI 输入 JSON 文件

    使用您常用的文件编辑工具创建 JSON 文件,其中包含以下密钥以及对您的环境有效的值。此示例使用名为 create-component.json 的文件:

    { "imagePipelineArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-pipeline/my-example-pipeline", "imageRecipeArn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-example-recipe/2019.12.08", "infrastructureConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:infrastructure-configuration/my-example-infrastructure-configuration", "distributionConfigurationArn": "arn:aws:imagebuilder:us-west-2:123456789012:distribution-configuration/my-example-distribution-configuration", "imageTestsConfiguration": { "imageTestsEnabled": true, "timeoutMinutes": 120 }, "schedule": { "scheduleExpression": "cron(0 0 * * MON *)", "pipelineExecutionStartCondition": "EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE" }, "status": "DISABLED" }
    注意
    • JSON 文件路径开头必须包含 file:// 符号。

    • JSON 文件的路径应遵循运行命令的基本操作系统的相应约定。例如,Windows 使用反斜杠 (\) 引用目录路径,而 Linux 和 macOS 使用正斜杠 (/)。

  2. 使用创建的文件作为输入,运行以下命令。

    aws imagebuilder update-image-pipeline --cli-input-json file://update-image-pipeline.json