Skip to content
Latchkey

Copilot "copilot deploy" failed to deploy (CloudFormation) in CI

Copilot renders your manifest to CloudFormation and deploys a change set. When a resource in that stack fails to create or update, the change set rolls back and the CLI reports "failed to deploy" with the stack error.

What this error means

copilot svc deploy or copilot deploy ends with "failed to deploy ... : ResourceNotReady" or a CloudFormation stack event such as CREATE_FAILED / UPDATE_ROLLBACK_COMPLETE for a generated resource.

copilot
x deploy service web to environment prod
- failed to deploy svc: stack myapp-prod-web operation failed:
  ResourceNotReady: ... TaskDefinition ... CREATE_FAILED

Common causes

A generated resource failed in CloudFormation

A task definition, target group, or service in the rendered stack failed (a bad image, a health check timeout, an invalid value), so the change set rolls back.

A manifest value the stack cannot satisfy

A manifest setting (port, healthcheck, cpu/memory) maps to a resource configuration that CloudFormation rejects or that the running container cannot satisfy.

How to fix it

Read the failed stack event

  1. Open the named stack in CloudFormation.
  2. Find the first CREATE_FAILED / UPDATE_FAILED event and its reason.
  3. Fix the manifest or image and run copilot svc deploy again.

Align the manifest with a working container

Confirm the image runs and the manifest port and healthcheck match what the container serves.

copilot/web/manifest.yml
# copilot/web/manifest.yml
image:
  build: Dockerfile
http:
  path: "/"
  healthcheck: "/healthz"
port: 8080

How to prevent it

  • Run the image locally and confirm port and health route.
  • Change one manifest field at a time and redeploy.
  • Keep the copilot CLI version current with the templates.

Frequently asked questions

What causes ""failed to deploy" (CloudFormation)"?
A task definition, target group, or service in the rendered stack failed (a bad image, a health check timeout, an invalid value), so the change set rolls back.
How do I fix "failed to deploy" (CloudFormation)?
Read the failed stack event

Related guides

References

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