AWS Ami Builder
HashiCorpOfficialPublished by HashiCorp
- Skill
- Tool integration
- Cloud and DevOps
- MPL-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to building custom Amazon Machine Images (AMIs) for EC2 instances using HashiCorp Packer. It covers the configuration of the amazon-ebs builder, including source AMI filtering, multi-region replication, and authentication methods. The guide includes templates for common operating systems like Ubuntu and Amazon Linux, along with troubleshooting tips for common build issues such as SSH timeouts and naming conflicts.
What it does
- Defines Packer HCL templates for creating custom AMIs on AWS.
- Configures source AMI filters to automatically select the latest base images.
- Supports multi-region AMI replication for global deployment.
- Provides standard commands for initializing, validating, and executing builds.
- Outlines authentication patterns for local and CI/CD environments.
- Offers solutions for common build errors like SSH connectivity and volume sizing.
When to use it
- When you need to create standardized, pre-configured machine images for EC2.
- When automating infrastructure provisioning to reduce instance boot time.
- When you need to maintain consistent environments across multiple AWS regions.
- When you want to incorporate OS-level updates or software installations into your base images.
Advantages
- Ensures consistent and reproducible machine image creation.
- Simplifies multi-region deployment through built-in replication features.
- Integrates seamlessly with existing AWS credential management systems.
- Reduces manual configuration effort by automating image hardening and provisioning.
Usage examples
- “How do I create a basic Ubuntu 22.04 AMI using Packer?”
- The agent provides a complete HCL template using the amazon-ebs builder with a source_ami_filter for Ubuntu 22.04 and a shell provisioner to update the system.
- “How can I make sure my AMI is available in multiple regions?”
- The agent demonstrates how to use the ami_regions attribute within the amazon-ebs source block to automatically copy the resulting AMI to specified regions.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/hashicorp/aws-ami-builder/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip aws-ami-builder.zip -d .agents/skills
Documentation by HashiCorp
AWS AMI Builder
Build Amazon Machine Images (AMIs) using Packer's amazon-ebs builder.
Reference: Amazon EBS Builder
Note: Building AMIs incurs AWS costs (EC2 instances, EBS storage, data transfer). Builds typically take 10-30 minutes depending on provisioning complexity.
Basic AMI Template
packer {
required_plugins {
amazon = {
source = "github.com/hashicorp/amazon"
version = "~> 1.3"
}
}
}
variable "region" {
type = string
default = "us-west-2"
}
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
}
source "amazon-ebs" "ubuntu" {
region = var.region
instance_type = "t3.micro"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"] # Canonical
}
ssh_username = "ubuntu"
ami_name = "my-app-${local.timestamp}"
tags = {
Name = "my-app"
BuildDate = local.timestamp
}
}
build {
sources = ["source.amazon-ebs.ubuntu"]
provisioner "shell" {
inline = [
"sudo apt-get update",
"sudo apt-get upgrade -y",
]
}
}Common Source AMI Filters
Ubuntu 22.04 LTS
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"] # Canonical
}Amazon Linux 2023
source_ami_filter {
filters = {
name = "al2023-ami-*-x86_64"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
}Multi-Region AMI
source "amazon-ebs" "ubuntu" {
region = "us-west-2"
instance_type = "t3.micro"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
}
most_recent = true
owners = ["099720109477"]
}
ssh_username = "ubuntu"
ami_name = "my-app-${local.timestamp}"
# Copy to additional regions
ami_regions = ["us-east-1", "us-east-2", "eu-west-1"]
}Authentication
Packer uses AWS credential resolution:
Environment variables:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYAWS credentials file:
~/.aws/credentialsIAM instance profile (when running on EC2)
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_REGION="us-west-2"
packer build .Build Commands
# Initialize plugins
packer init .
# Validate template
packer validate .
# Build AMI
packer build .
# Build with variables
packer build -var "region=us-east-1" .Common Issues
SSH Timeout
Ensure security group allows SSH (port 22)
Verify subnet has internet access
AMI Already Exists
AMI names must be unique
Use timestamp in name:
my-app-${local.timestamp}
Volume Size Too Small
Check source AMI's volume size
Set
launch_block_device_mappings.volume_sizeaccordingly
References
Files
- ATTRIBUTION.mdAdded by AutoGineer895 B
- LICENSELicence file added by AutoGineer16.3 KiB
- SKILL.md3.6 KiB
ATTRIBUTION.md
Attribution
This folder is an unmodified copy of the Agent Skill "aws-ami-builder", distributed by AutoGineer (https://autogineer.com/agent-skills).
Commit: 5e30fa5c867ba6777c37e4206babfd08049c396f
Published by: HashiCorp (https://github.com/hashicorp)
Publisher: HashiCorp (https://github.com/hashicorp)
Licence: Mozilla Public License 2.0 (https://github.com/hashicorp/agent-skills/blob/5e30fa5c867ba6777c37e4206babfd08049c396f/LICENSE)
Licence evidence: repository licence LICENSE
Retrieved: 2026-11-07
The skill's own files are unmodified copies. AutoGineer is not affiliated with or endorsed by the author or the publisher.
Files added by AutoGineer
ATTRIBUTION.md: this file, written by AutoGineer
LICENSE: copied from LICENSE
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
What our scanner noticed· Medium risk
- References to credential files
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- HashiCorp
- Publisher
- HashiCorp (Official)
- Source
- hashicorp/agent-skills · plugins/packer/skills/aws-ami-builder · commit 5e30fa5
- Licence
- Mozilla Public License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by HashiCorp.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download aws-ami-builder.zip