Skip to main content

ORFMI - Open Rainforest Machine Image

A Python CLI tool for creating AWS AMIs from configuration files and setup scripts.

Installation

pip install orfmi

Usage

orfmi --config-file config.yml --setup-file setup.sh

Required Arguments

  • --config-file FILE - Path to the YAML configuration file
  • --setup-file FILE - Path to the setup script (bash or PowerShell)

Optional Arguments

  • --extra-files FILE [FILE ...] - Additional files to upload
  • -v, --verbose - Enable verbose output
  • -q, --quiet - Suppress output except for errors and the final AMI ID

Configuration File

The configuration file is a YAML file with the following structure:

# Required fields
ami_name: my-custom-ami
region: us-east-1
source_ami: debian-12-*  # AMI name pattern to search for
subnet_ids:
  - subnet-12345abc
  - subnet-67890def
instance_types:
  - t3.micro
  - t3.small

# Optional fields
ami_description: My custom AMI for production
iam_instance_profile: my-instance-profile
ssh_username: admin  # default: admin
ssh_timeout: 300     # default: 300 seconds
ssh_retries: 30      # default: 30 retries
platform: linux      # linux or windows, default: linux
tags:
  Name: my-ami
  Environment: production

Required Fields

Field Description
ami_name Name for the created AMI
region AWS region
source_ami Source AMI name pattern (supports wildcards)
subnet_ids List of subnet IDs for launching the instance
instance_types List of instance types to try (uses EC2 Fleet)

Optional Fields

Field Default Description
ami_description "" Description for the AMI
iam_instance_profile null IAM instance profile name
ssh_username admin SSH username for connecting
ssh_timeout 300 SSH command timeout in seconds
ssh_retries 30 Number of SSH connection retries
platform linux Platform type (linux/windows)
tags {} Tags to apply to resources

Setup Script

The setup script runs on the instance to configure it before creating the AMI.

Linux (Bash)

#!/bin/bash
set -e

# Update packages
apt-get update
apt-get upgrade -y

# Install required software
apt-get install -y docker.io git

# Enable services
systemctl enable docker

# Clean up
apt-get clean
rm -rf /var/lib/apt/lists/*

Windows (PowerShell)

# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force
$url = 'https://chocolatey.org/install.ps1'
iex ((New-Object System.Net.WebClient).DownloadString($url))

# Install software
choco install -y git docker-desktop

Exit Codes

Code Description
0 Success - AMI created
1 Build failure
2 Configuration or usage error

Output

On success, the tool outputs the AMI ID in the format:

AMI_ID=ami-0123456789abcdef0

How It Works

  1. Parses the configuration file
  2. Looks up the source AMI by name pattern
  3. Creates temporary resources (key pair, security group, launch template)
  4. Launches an EC2 spot instance using EC2 Fleet
  5. Waits for the instance to be ready
  6. Connects via SSH and runs the setup script
  7. Creates an AMI from the configured instance
  8. Cleans up all temporary resources
  9. Outputs the AMI ID

License

Apache License 2.0

Metadata

Release files for orfmi 20260114231306

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orfmi 20260114231306
File Size Uploaded Provenance
orfmi-20260114231306.tar.gz 35.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for orfmi 20260114231306
File Interpreter ABI Platform
orfmi-20260114231306-py3-none-any.whl Python 3 none any Details

Total release size: 53.8 kB

Release files / orfmi-20260114231306.tar.gz

Download URL orfmi-20260114231306.tar.gz
Size 35.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cb7e610b871bf6e4f77c0bba78e77fcd8baeafe352c21e9f1dad4650977df4dc
BLAKE2b-256 checksum
How to use checksums
30871073a00cf5aa57099db951062435c3e90074f675935f9600c161f20455b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Release files / orfmi-20260114231306-py3-none-any.whl

Download URL orfmi-20260114231306-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50a509c4db92af91e504500ea140763b5454b7ad823118b6fe8fc47c2f6b3e1c
BLAKE2b-256 checksum
How to use checksums
3de26444f160967a76c5d30e8e7f86d792fb879bb5d4d05abc21c5feea2af6d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

Security for orfmi 20260114231306

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for orfmi-20260114231306.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page