Skip to content
alyn
hashicorp

Aws Ami Builder skill

Build Amazon Machine Images (AMIs) with Packer using the amazon-ebs builder. Use when creating custom AMIs for EC2 instances.

$npx skills add hashicorp/agent-skills --skill aws-ami-builder
View this skill on GitHubhashicorp/agent-skills/plugins/packer/skills/aws-ami-builder/SKILL.md
Pack stars
925
Pack installs
83k
Alyn Score
60/99
Updated
7 days ago
License
MPL-2.0
– views – installs via Alyn

hashicorp

Aws Ami Builder

Install Aws Ami Builder

Pick your agent. Every command is ready to paste.

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

The open skills CLI detects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.

01

Install it

Run the command above, or upload the folder in Claude.

02

Ask naturally

Describe the task. Your agent loads aws-ami-builder when the request matches its description.

03

Name it if needed

If it does not trigger, say “use the aws-ami-builder skill”. In Codex, type $aws-ami-builder.

The skill itself

SKILL.md

FolderGitHub

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:

  1. Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
  2. AWS credentials file: ~/.aws/credentials
  3. IAM 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_size accordingly

References

Tips for Aws Ami Builder

  • • Start a fresh session after installing so your agent picks up the new skill.
  • • It is part of a pack with 20 skills. Install only the ones you need with --skill to keep triggers precise.
  • • If two skills overlap, mention the one you want by name.

Questions about Aws Ami Builder

What does the Aws Ami Builder skill do?

Build Amazon Machine Images (AMIs) with Packer using the amazon-ebs builder. Use when creating custom AMIs for EC2 instances.

How do I install Aws Ami Builder?

Run "npx skills add hashicorp/agent-skills --skill aws-ami-builder" in your project. The skills CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.

Does Aws Ami Builder work in Cursor and Codex?

Yes. Aws Ami Builder uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.

Is Aws Ami Builder free?

Aws Ami Builder is open source on GitHub under the MPL-2.0 license. It is free to install; check the license before commercial use.

Who made Aws Ami Builder?

Aws Ami Builder is published by hashicorp in the hashicorp/agent-skills repository, together with 19 other skills.

Similar skills. From other creators.