AWS SAM "No changes to deploy. Stack ... is up to date" failing CI
sam deploy creates a CloudFormation change set; if nothing changed, the change set is empty. By default sam treats that as an error and exits non-zero, which fails the CI step even though the stack is fine.
What this error means
sam deploy ends with "Error: No changes to deploy. Stack <name> is up to date" and a non-zero exit, breaking the pipeline when redeploying unchanged infrastructure.
Error: No changes to deploy. Stack my-app is up to dateCommon causes
The change set is empty
Nothing in the built template differs from the deployed stack, so CloudFormation creates an empty change set.
Default fail-on-empty behaviour
Without --no-fail-on-empty-changeset, sam returns a non-zero exit code for an empty change set, which CI reads as failure.
How to fix it
Allow empty change sets
Tell sam not to fail when there is nothing to deploy so idempotent re-runs pass.
sam deploy --no-fail-on-empty-changeset --resolve-s3 \
--capabilities CAPABILITY_IAM --no-confirm-changesetPersist the flag in samconfig.toml
Set it once so every CI deploy tolerates no-op runs.
[default.deploy.parameters]
fail_on_empty_changeset = falseHow to prevent it
- Pass
--no-fail-on-empty-changesetfor idempotent CI deploys. - Keep the flag in samconfig.toml.
- Rebuild before deploy so intended changes actually reach the template.