2장. Introduction to cloud-init


The cloud-init utility automates the initialization and configuration of virtual machines (VM), also known as instances, during the first boot. You can configure cloud-init to perform tasks such as:

  • Configuring a hostname, network interfaces, and user accounts
  • Installing packages on an instance
  • Running scripts
  • Modifying default virtual machine (VM) actions

Before you begin, make sure to complete the following step:

cloud-init is available for various types of RHEL images as follows:

  • A KVM qcow2 guest image comes preinstalled with cloud-init. After you launch the instance, the cloud-init utility is automatically enabled. You can use KVM guest images from the Red Hat Customer Portal with Red Hat Virtualization, Red Hat OpenStack Platform (RHOSP), and Red Hat OpenShift Virtualization.
  • If you download a Red Hat ISO image from the Red Hat Customer Portal to create a custom guest image, you need to install the cloud-init package on that customized guest image.
  • If you use an image from a certified cloud service provider (CCSP), such as Amazon Web Services (AWS), Google Cloud, or Microsoft Azure, you can use RHEL image builder to create the image. RHEL image builder customizes images for specific cloud providers. The following image formats come with cloud-init preinstalled:

    • Amazon Machine Image (AMI)
    • Virtual Hard Drive (VHD)
    • QEMU copy-on-write (QCOW2)

For details about the RHEL image builder, see Installing RHEL image builder.

Most cloud platforms support cloud-init, but configuration procedures and supported options vary.

Otherwise, you can configure cloud-init for the NoCloud environment. By using NoCloud, you can manage cloud instances for both a local configuration (without network access) and configurations fetched from a remote server. Additionally, you can create a VM template by configuring cloud-init on one VM. By using this template, you can create additional VMs or clusters of VMs.

2.1. Overview of the cloud-init configuration

The cloud-init utility uses YAML-formatted configuration files to apply user-defined tasks to instances. When an instance boots, the cloud-init service initiates and executes the instructions from the YAML file. These tasks may complete during the first boot or on subsequent boots of the VM, depending on the configuration.

To define the specific tasks, configure the /etc/cloud/cloud.cfg file and add directives under the /etc/cloud/cloud.cfg.d/ directory.

  • The cloud.cfg file includes directives for various system configurations, such as user access, authentication, and system information. This file also includes default and optional modules for cloud-init. The default module groups are as follows:

    • cloud_init_modules
    • cloud_config_modules
    • cloud_final_modules
  • You can include additional directives for cloud-init in the cloud.cfg.d directory.
  • While adding directives to the cloud.cfg.d directory, add them to a custom file named *.cfg, and always include #cloud-config at the top of the file.

For details, refer to an example file of cloud.cfg. See an example of cloud.cfg file.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat
맨 위로 이동