Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅
中国的 Amazon Web Services 服务入门
(PDF)。
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
创建 YAML 组件文档
要构建组件,请提供 YAML 应用程序组件文档。这表示创建组件所需的阶段和步骤。
本节中的示例创建了一个生成组件,该组件在 EC2 TOE 组件管理应用程序中调用UpdateOS
操作模块。该模块更新操作系统。有关 UpdateOS
操作模块的更多信息,请参阅 UpdateOS。有关 EC2 TOE YAML 应用程序组件文档的阶段、步骤和语法的更多信息,请参阅在中 EC2 TOE使用文档。
Image Builder 确定管道工作流程中的组件类型。此工作流程对应于构建过程中的构建阶段和测试阶段。Image Builder 按如下方式确定组件类型:
有关 Image Builder 如何在其构建过程中使用阶段 (stage) 和时段 (phase) 来管理组件工作流的更多信息,请参阅 使用 Image Builder 管理组件。
要为示例应用程序创建 YAML 应用程序组件文档,请按照与您的映像操作系统匹配的选项卡上的步骤进行操作。
- Linux
-
创建 YAML 组件文件
使用文件编辑工具创建名为 update-linux-os.yaml
的文件。包括以下内容:
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
name: update-linux-os
description: Updates Linux with the latest security updates.
schemaVersion: 1
phases:
- name: build
steps:
- name: UpdateOS
action: UpdateOS
# Document End
在代码环境中使用像在线 YAML Validat 或 YAML lint 扩展这样的工具来验证 YAML 格式是否正确。
- Windows
-
创建 YAML 组件文件
使用文件编辑工具创建名为 update-windows-os.yaml
的文件。包括以下内容:
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
name: update-windows-os
description: Updates Windows with the latest security updates.
schemaVersion: 1.0
phases:
- name: build
steps:
- name: UpdateOS
action: UpdateOS
# Document End
在代码环境中使用像在线 YAML Validat 或 YAML lint 扩展这样的工具来验证 YAML 格式是否正确。