DEV Community

Ashen Chathuranga
Ashen Chathuranga

Posted on

Generate cloud-init files for Raspberry Pi OS without re-downloading images

Introduction

Raspberry Pi recently introduced cloud-init support in their official Raspberry Pi OS images. This is a big step forward because cloud-init allows users to preconfigure devices before first boot, including Wi-Fi credentials, users, SSH access, locale, and more.

However, there is a practical problem with the current workflow provided by the official Raspberry Pi Imager. Advanced customization options are only available when you select Raspberry Pi OS from the official OS list inside the imager. If you instead flash a locally downloaded image using the Custom Image option, those configuration options disappear.

For users with limited bandwidth, slow connections, or frequent cache cleanups, this becomes frustrating very quickly.

This article explains the problem in detail and presents a simple, bandwidth-friendly solution using a cloud-init file generator.


The problem with Raspberry Pi Imager customization

1. Customization only works with official OS downloads

Raspberry Pi Imager allows you to configure:

  • Wi-Fi (SSID, password, country)
  • Username and password
  • SSH access
  • Locale, timezone, and keyboard layout

But these options are only enabled when:

  • You choose Raspberry Pi OS directly from the imager
  • The image is downloaded by the imager itself

If you:

  • Download the Raspberry Pi OS image manually
  • Use the Custom Image option to flash it

then all customization options are disabled.

2. Re-downloading wastes bandwidth

This creates several issues:

  • Raspberry Pi OS images are large
  • Clearing cache forces a full re-download
  • Re-downloading the same image multiple times wastes data
  • This is especially painful in regions with limited or expensive internet access

Many users already have the image they want, but still need a way to configure Wi-Fi and users before first boot.


How cloud-init works on Raspberry Pi OS

Recent Raspberry Pi OS images support cloud-init by reading configuration files from the boot partition during the first boot.

The key files are:

  • meta-data
  • network-config
  • user-data

If these files exist in the boot partition, Raspberry Pi OS will automatically apply the configuration on first boot.

This means:

  • No need for Raspberry Pi Imager customization
  • No need to re-download the OS image
  • Works with any flashing tool

You only need valid cloud-init files.


The solution: Raspberry Pi cloud-init generator

To solve this problem, I created a simple web-based tool that generates cloud-init files for Raspberry Pi OS.

Project overview

This tool allows you to generate:

  • meta-data
  • network-config
  • user-data

ready to be copied directly to the Raspberry Pi boot partition.


How the workflow looks now

Old workflow (problematic)

  1. Open Raspberry Pi Imager
  2. Select Raspberry Pi OS from official list
  3. Download the image again
  4. Add customization
  5. Flash SD card

Problems:

  • Repeated downloads
  • High data usage
  • Custom image option unusable

New workflow (efficient)

  1. Download Raspberry Pi OS image once
  2. Flash it using Custom Image in Raspberry Pi Imager or any other tool
  3. Open the cloud-init generator website
  4. Fill in Wi-Fi, user, and SSH details
  5. Generate meta-data, network-config, and user-data
  6. Copy these files to the boot partition of the SD card
  7. Boot the Raspberry Pi

Result:

  • No re-downloads
  • Full cloud-init customization
  • Works offline after image download

Key benefits

  • Saves bandwidth
  • Avoids unnecessary re-downloads
  • Works with cached or archived images
  • Uses official Raspberry Pi OS cloud-init support
  • Simple and beginner-friendly

This approach is especially useful for:

  • Developers flashing multiple Raspberry Pi boards
  • Users with limited internet access
  • Automated or repeatable Raspberry Pi setups

Conclusion

Raspberry Pi OS cloud-init support is powerful, but the current Raspberry Pi Imager workflow unnecessarily forces users to re-download images to access basic customization features.

By generating cloud-init files manually and placing them in the boot partition, you can fully configure Raspberry Pi OS without relying on the imager’s official OS download flow.

The Raspberry Pi cloud-init generator makes this process simple, accessible, and bandwidth-efficient.

If you regularly work with Raspberry Pi boards, this approach can save both time and data while giving you full control over your system configuration.

Top comments (0)