Creare un documento componente YAML per componenti personalizzati in Image Builder - EC2 Image Builder

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Creare un documento componente YAML per componenti personalizzati in Image Builder

Per creare un componente, è necessario fornire un documento relativo al componente dell'applicazione YAML. Il documento contiene il codice che viene eseguito durante le fasi e i passaggi definiti per fornire la personalizzazione dell'immagine.

Gli esempi in questa sezione creano un componente di compilazione che richiama il modulo di UpdateOS azione nell'applicazione di gestione dei AWSTOE componenti. Il modulo aggiorna il sistema operativo. Per ulteriori informazioni sul modulo di UpdateOS azione, vedereAggiorna il sistema operativo. Per ulteriori informazioni sulle fasi, i passaggi e la sintassi dei documenti dei componenti dell'applicazione AWSTOE YAML, consulta Use documents in. AWSTOE

Nota

Image Builder determina il tipo di componente dalle fasi definite nel documento del componente come segue:

  • Build: questo è il tipo di componente predefinito. Tutto ciò che non è classificato come componente di test è un componente di compilazione. Questo tipo di componente viene eseguito durante la fase di creazione dell'immagine. Se questo componente di compilazione ha una test fase definita, tale fase viene eseguita durante la fase di test.

  • Test: per qualificarsi come componente di test, il documento del componente deve includere solo una fase, denominatatest. Per i test relativi alle configurazioni dei componenti di compilazione, ti consigliamo di non utilizzare un componente di test autonomo. Piuttosto, usa la test fase nel componente di compilazione associato.

Per ulteriori informazioni su come Image Builder utilizza fasi e fasi per gestire il flusso di lavoro dei componenti nel processo di creazione, vedere. Usa i componenti per personalizzare l'immagine di Image Builder

Per creare un documento relativo al componente dell'applicazione YAML per un'applicazione di esempio, seguite i passaggi nella scheda corrispondente al sistema operativo dell'immagine.

Linux
Crea un file componente YAML

Usa uno strumento di modifica dei file per creare un file denominato. update-linux-os.yaml Includi i seguenti contenuti:

# 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
Suggerimento

Usa uno strumento come questo validatore YAML online o un'estensione YAML lint nel tuo ambiente di codice per verificare che il tuo YAML sia ben formato.

Windows
Crea un file componente YAML

Usa uno strumento di modifica dei file per creare un file denominato. update-windows-os.yaml Includi i seguenti contenuti:

# 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
Suggerimento

Usa uno strumento come questo validatore YAML online o un'estensione YAML lint nel tuo ambiente di codice per verificare che il tuo YAML sia ben formato.