hashicorp avatar

Aws Ami Builder

Packer template guide that builds custom EC2 AMIs with the amazon-ebs builder and cost-aware defaults.

CCM score
73 of 100
skills.sh installs
3.4K
GitHub stars
941
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers basic AMI templates, source AMI filters for Ubuntu 22.04 and Amazon Linux 2023, and multi-region copies
  • Includes packer init, packer validate, and packer build commands with variable overrides, plus AWS credential resolution options
  • Notes that builds incur EC2, EBS, and data transfer costs and typically take 10 to 30 minutes
  • Designed for teams creating custom AMIs for EC2 instances who need to troubleshoot SSH timeouts, duplicate names, or undersized volumes

Install

$ npx -y skills add hashicorp/agent-skills --skill aws-ami-builder -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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
  }
}

Details

Repository
github.com/hashicorp/agent-skills
Category
DevOps & Cloud
First seen
Apr 16, 2026

More from hashicorp/agent-skills

All 16

Similar to Aws Ami Builder

More DevOps & Cloud