Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Customize AWS cloud images with RHEL image builder and Packit

April 2, 2024
Maja Massarini
Related topics:
AutomationContainersLinux
Related products:
Red Hat Enterprise Linux

    Have you ever wanted to bring your pull request changes in a cloud image easily?

    Curious about how easy it can be? With Packit, it can be just a matter of commenting on your pull request with the following command:

    /packit vm-image-build

    With the above command, Packit automates all the manual steps needed to create an RPM package with your pull request changes and asks the Red Hat Enterprise Linux image builder (RHEL image builder) to install it inside a brand new cloud image.

    Let's have a look at the prerequisites for this.

    Join the Red Hat Developer program

    If you don't already have a business account, you can create a Red Hat Developer account at no cost.

    You need a subscription in order to use the RHEL image builder service and launch the builded images in the Amazon Web Services (AWS) management console.

    Prepare to upload the Amazon Machine Image

    Before uploading an Amazon Machine Image (AMI), you must configure the AWS system for receiving them.

    Prerequisites

    • You must have an access key ID configured in the AWS IAM account manager.
    • You must have a writable S3 bucket prepared.

    Procedure

    Follow these steps to satisfy the above prerequisites.

    The manual steps

    Are you wondering what are the manual steps for bringing your pull request changes in a cloud image and why you should automate them?

    There could be many ways to achieve this goal, but let's see together the closest to our automated solution. Below you can find a summary of all the needed manual steps; I am quite sure after reading them, you will want to automate them with Packit!

    Build an RPM package with your pull request changes through COPR.

    1. Install copr-cli.
    2. Create your account and service token.
    3. Add your token to ~/.config/copr.
    4. Create a new COPR project.
    5. Start a build with your local pull request changes using copr-cli.
    6. Wait for the build to finish.

    Create a new cloud image through the RHEL image builder console.

    1. Log in with your Red Hat Developer account.
    2. Click on the Create Image button. Choose the AWS image type and follow the wizard.
    3. Wait for the build to finish.
    4. Open the Launch link for the built image.

    Launch and access the AWS image through the AWS management console.

    1. The previous link will open an AWS console tab with the Launch an Instance wizard preset to use the builded image. You need to log in into the AWS management console using an AWS account ID allowed to access the AMI image you just created.
    2. Select a key pair (or create one if you don't have it already) to be able to ssh the image later.
    3. Click Launch Instance.
    4. Connect to instance using an ssh client.
    5. Add the previously created COPR repo to the list of available dnf repositories.
    6. Install the package you have created in step 4.
    7. Now you are ready to test your code in a real cloud image.

    For every new pull request you want to test directly in a cloud image you have to repeat steps 4-16, or automate them through Packit.

    Automate the steps

    Install Packit

    Installing Packit is pretty straightforward:

    1. Create a valid Fedora Account System (FAS) account (if you don't already have one). Why do you need this? After these few steps you will start building (and potentially shipping) Fedora packages through the COPR service, and we need you to agree with the Fedora license.
    2. Install our GitHub application on GitHub Marketplace, or configure a webhook on GitLab (depending on where your project lives).
    3. Make Packit approve your FAS username; on GitHub, the approval process is automated, and for GitLab, you have to contact us.

    Once installed, you are ready to automate the process as described below.

    Set up Packit

    Create a .packit.yaml configuration file in your pull request—but just the first time! After your pull request has been merged, Packit will take the .packit.yaml file from the target main branch.

    The configuration file will look like the following:

    ---
    
    jobs:
    - job: copr_build
      trigger: pull_request
      targets:
      - fedora-all
    
    - job: vm_image_build
      trigger: pull_request
      image_request:
        architecture: x86_64
        image_type: aws
        upload_request:
          type: aws
          options:
            share_with_accounts:
            - < shared-aws-account-id >
      image_distribution: fedora-39
      copr_chroot: fedora-39-x86_64
      image_customizations:
        packages: [hello-world]

    copr_build job

    The first job tells the Packit service to build an RPM package for the Fedora release you want—in this example all the active Fedora releases—and to add your pull request changes to the package.

    To further customize the COPR builds made by Packit, you might want to refer to this guide.

    vm_image_build job

    The second job tells Packit how to configure the RHEL image builder service.

    The first two lines of this job are still meant for Packit; they allow Packit to react to your pull request comment /packit vm-image-build. Packit does not build a VM image automatically, as it does when it builds a COPR package, to save you from unwanted costs.

    - job: vm_image_build
      trigger: pull_request
    

    The other lines are meant to customize the RHEL image builder behavior.

    You are asking to build an AWS image, with a fedora-39 distribution, for the x86_64 architecture and you want to share it with the listed AWS Account IDs.

      image_request:
        architecture: x86_64
        image_type: aws
        upload_request:
          type: aws
          options:
            share_with_accounts:
            - < shared-aws-account-id >
      image_distribution: fedora-39
    

    You don't want to manually install the COPR package into the image; for this reason, you'll ask RHEL image builder to install it (hello-world).

    You tell RHEL image builder to take it from the COPR chroot fedora-39-x86_64, and you don't need to create or specify a COPR project because Packit has automatically created it for you.

      copr_chroot: fedora-39-x86_64
      image_customizations:
        packages: [hello-world]
    

    Create, comment, and test a pull request

    Create a pull request; mine will show you the word world in green.

    All you need to do is comment your pull request with:

    /packit vm-image-build

    And the image will be built and customized for you.

    Look for the check named vm-image-build-fedora-39-x86_64 and wait for it to finish (Figure 1).

    Wait for check vm-image-build-fedora-39-x86_64 to finish
    Figure 1: The image is being built

    Open its details (Figure 2) and you will find the link to the AWS image.

    The check details have a link to the AWS image
    Figure 2: The AWS image link now appears in the sidebar.

    Open the AWS link (you will need to be logged in) and see the details of your image ready to be launched (Figure 3).

    The AWS image details
    Figure 3: The AMI details window.

    Launch your image instance and connect to it (Figure 4).

    Connect to instance details
    Figure 4: Connecting to the image instance.

    Test it, as shown in Figure 5.

    Test it!
    Figure 5: The word "world" now appears in green.

    Conclusions

    Packit can automate building RPM packages with changes taken from pull requests, creating cloud images, and installing packages into them so that they are ready to be manually tested.

    But this is not all—Packit can also help you automating tests or releases. Want to know more? Visit packit.dev.

    Related Posts

    • How RHEL image builder has improved security and function

    • How to trigger jobs manually in Packit

    • How to reduce Red Hat Fuse image size

    • How to set up Packit to simplify upstream project integration

    • Build smaller container images using S2I

    • How to improve Go FIPS test coverage with Packit

    Recent Posts

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    • Control multicluster costs with right-sizing in Red Hat Advanced Cluster Management 5

    • Lightbits is now certified for Red Hat OpenStack Services on OpenShift

    What’s up next?

    Now that Windows developers can write code that runs on Red Hat Enterprise Linux (RHEL) with almost no learning curve, the app dev environment is changing—.NET developers can now move into microservices. Download the .NET on Red Hat Enterprise Linux cheat sheett and learn how to run your .NET code in a Linux container.

    Get the cheat sheet
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI