VectleSkillsError: Build 'amazon-ebs' errored: Error creating AMI: InvalidAMIName.Malformed

Error: Build 'amazon-ebs' errored: Error creating AMI: InvalidAMIName.Malformed

Export

Fixes Packer failing at AMI creation because the ami_name contains illegal characters. For engineers whose builds run to completion then fail at the final AMI step, the fix is sanitizing the name.

Error: Build 'amazon-ebs' errored: Error creating AMI: InvalidAMIName.Malformed

TL;DR

Your ami_name contains characters AWS rejects (like + or spaces). Restrict it to letters, numbers, ( ) . - / _, 3-128 chars, and rebuild.

The error

==> amazon-ebs: Error creating AMI: InvalidAMIName.Malformed: AMI names must be between 3 and 128 characters long, and may contain letters, numbers, '(', ')', '.', '-', '/' and '_'
	status code: 400, request id: OMITTED
Build 'amazon-ebs' errored: Error creating AMI: InvalidAMIName.Malformed

Fix it

  1. Inspect your ami_name: look for spaces, +, or other characters outside the allowed set.
  • Success check: you spot the offending characters (in the issue, Centos 7 + Stuff).
  1. Sanitize it: replace spaces with - or _, drop + and other symbols. E.g. centos-7-stuff-{{timestamp}}.
  • Success check: the name matches [A-Za-z0-9()./_-]{3,128}.
  1. Note the prevalidation gap: packer validate may not catch this; it fails late, after provisioning. Consider it a known rough edge.
  • Success check: you validate names yourself before long builds.
  1. Re-run packer build.
  • Success check: Creating the AMI succeeds.

When to use this

You hit this at the very end of an amazon-ebs build, after provisioning succeeded, when AWS rejects the AMI name.

When NOT to use this

Do not use this for InvalidAMIName.Duplicate (name taken; make it unique) or for build failures earlier in provisioning.

Compatibility

Packer 1.x, amazon-ebs. The character rules come from the EC2 API.

Variants

  • InvalidAMIName.Malformed from timestamps or variables injecting spaces
  • Names over 128 chars from long prefixes plus timestamps

Root cause

EC2 AMI names allow only a restricted charset. Packer's prevalidation did not reject the bad name, so the build burned full provisioning time before AWS refused it at CreateImage.

Edge cases

  • {{timestamp}} is safe (digits only). The risk is in your static prefix and variable values.
  • Slashes are allowed but can confuse console filtering; prefer -.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=Error%3A+Build+%27amazon-ebs%27+errored%3A+Error+creating+AMI%3A+InvalidAMIName.Malformed&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.