Skip to content
Latchkey

Elastic Beanstalk "Instance deployment failed" from .ebextensions in CI

Beanstalk applies .ebextensions config files (packages, files, commands, container_commands) during deploy. A directive that errors fails the instance deployment with "Instance deployment failed" and a reference to the config.

What this error means

eb deploy fails with "Instance deployment failed. For details, see service log." and eb-engine.log shows a failing container_command or a YAML/config error in a .ebextensions file.

eb
[ERROR] Instance deployment failed. For details, see 'eb-engine.log'.
[ERROR] command 01_migrate (in .ebextensions/db.config) failed.
Command failed on instance. Return code: 1

Common causes

A container_command exited non-zero

A migration, build, or setup command in container_commands failed (a missing tool, a wrong path, a non-zero exit), which fails the whole deploy.

A malformed .ebextensions file

Invalid YAML, an unknown key, or a package that cannot be installed makes Beanstalk reject the config during the deploy.

How to fix it

Read eb-engine.log for the failing directive

  1. Fetch the logs and open eb-engine.log.
  2. Find the named command or config key that failed and its output.
  3. Correct the command or config and redeploy.
Terminal
eb logs --all

Make commands robust and valid

Use absolute paths, guard one-off commands with leader_only, and validate the YAML.

.ebextensions/db.config
container_commands:
  01_migrate:
    command: "/var/app/venv/*/bin/python manage.py migrate"
    leader_only: true

How to prevent it

  • Validate .ebextensions YAML before committing.
  • Use leader_only for one-off tasks like migrations.
  • Reference absolute paths and tools known to exist on the platform.

Frequently asked questions

What causes ""Instance deployment failed" (.ebextensions)"?
A migration, build, or setup command in container_commands failed (a missing tool, a wrong path, a non-zero exit), which fails the whole deploy.
How do I fix "Instance deployment failed" (.ebextensions)?
Read eb-engine.log for the failing directive

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card