Using Python to power an AppStream 2.0 Linux Imaging Assistant GUI
In this blog, we show you how to add, launch, and use a graphical Imaging Assistant for Amazon AppStream 2.0 Linux.
With Amazon AppStream 2.0 Linux application streaming, you can stream Linux applications and desktops to your users, and greatly lower the total streaming costs. You can use the Linux command line to use the included tools to create and capture their images. These tools give you significant control over the process.
If you prefer a graphical user interface experience, there is a Python-based option to use with your AppStream 2.0 Linux images. You can perform the entire AppStream image preparation process with this GUI Linux Image Assistant. Since this option is open sourced, you can make modifications to the assistant to fulfill your specific requirements.
The Linux Image Assistant is open sourced, provided under the MIT-0 license on GitHub. You can download the code for the repository from appstream2-linux-imaging-assistant. The assistant is written in Python, and uses Tkinter and Pygubu to provide an interactive GUI. The AppStream 2.0 command-line actions are performed in the background.
In addition to the source code, the repository includes a packaged binary. With the binary, you can download and launch a single file that contains all of the Image Assistant dependencies.
In this blog, we show you how to download and use the binary to onboard your Linux-based applications into AppStream 2.0.
To follow this blog, you need the following:
- Familiarity with Amazon Linux 2 and AppStream 2.0
- An AppStream 2.0 Linux-based Image Builder
Preparing the Imaging Assistant
The Image Assistant GUI code is available on GitHub for anyone that wants to review the code before launching. To streamline the process, the repository includes a pre-built binary. This section outlines running the pre-built binary. If you would like to run the Image Assistant without the binary, see the repository’s README.
- Connect to the Image Builder
- Select Applications from the menu bar
- Choose the Terminal Icon
- To download the latest binary, enter the following command:
- Adjust the permissions in order to allow the file to be launched
chmod +x ./AS2IA
- Run the file from the terminal
Using the Linux Imaging Assistant GUI
Adding an Application
Before you begin adding an application, you must have your target application installed and running. Keep the application running and make sure to use the initial components required. This ensures that these components are captured by the optimization process.
Step 1: Select the target process
Select the running process of your application from the Process Name dropdown. If your application is not running when you start the Image Assistant, start the application, and select Get Procs. Again, keep the application running and make sure to use the initial components required by your users. This ensures that these components are captured by the optimization process.
If you have trouble finding your application, you can use the Process Filter textbox. Entering text in the Process Filter textbox dynamically updates the Process Name dropdown.
Step 2: Get the application files
Once your target application process is selected in the dropdown, choose Get Files.
This automates the optimization step to generate an application optimization manifest file.
Step 3: Select the manifest
The manifest is used to add the configured application to your catalog. The manifest location defaults to /tmp. You can modify this field to save in a different location. When you are ready to create your manifest, choose Create Manifest.
Alternatively, if you have already created your application manifest, you can select Import Manifest to target your existing manifest.
Step 4: Provide application settings.
The Image Assistant prompts for additional application settings. Enter the Application Name and Display Name. You have the option to select an Icon Path, a Working Directory, and Launch Parameters.
Once you have completed the application settings, choose Add App to Catalog. Note: If you don’t see the application verification pop-up within a few seconds of adding your app, the pop up may be behind your other windows.
Viewing Your Catalog
The second tab of the GUI Imaging Assistant, Verify Catalog shows the current application catalog. With this tab, you can refresh, remove applications, or reset your catalog to remove all the catalog’s applications.
Capturing an Image
The Configure Image tab is used to create an image. To create an image:
- Enter an Image Name
- You have the option to enter an Image Description.
- You have the option to provide tags for the image. Tag must be provided in the format “key1” ”value1” “key2” “value2”.
- When the image details are entered, select the Finalize tab.
- By default, the image will Use the latest AppStream 2.0 agent. Unselect the check box not to use the latest AppStream 2.0 agent.
- Choose Create Image on the Finalize tab. If your image passes validation, you will be logged out so the image capture process can begin. If the validation fails, check the Output tab for your error result.
In this post, we demonstrated how to download and use the GUI AppStream 2.0 Image Assistant for Linux-based Image Builders available on GitHub.
To dive deeper into the Image Assistant CLI, check how to create your AppStream 2.0 image programmatically by using the Image Assistant CLI operations. To understand how to automate this process, review the blog automatically create customized AppStream 2.0 Linux images.