AWS CloudFormation
create-stack
deploy
cloud infrastructure
AWS services

AWS CloudFormation create-stack vs deploy

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

aws cloudformation create-stack and aws cloudformation deploy both result in CloudFormation stacks, but they are not interchangeable shortcuts. create-stack is the low-level command for creating a brand-new stack, while deploy is a higher-level convenience command that handles create-or-update behavior and uses change sets under the hood.

What create-stack Does

create-stack is explicit: it creates a new stack from a template.

bash
1aws cloudformation create-stack \
2  --stack-name my-app \
3  --template-body file://template.yaml \
4  --capabilities CAPABILITY_NAMED_IAM

If the stack already exists, this command does not update it. You would need a different command such as update-stack.

This makes create-stack useful when:

  • you know the stack does not exist yet
  • you want exact control over stack-creation semantics
  • your workflow explicitly separates create and update operations

What deploy Does

deploy is a higher-level convenience command for day-to-day infrastructure deployment.

bash
1aws cloudformation deploy \
2  --stack-name my-app \
3  --template-file template.yaml \
4  --capabilities CAPABILITY_NAMED_IAM

If the stack does not exist, deploy creates it. If the stack already exists, deploy updates it. That is why it is commonly used in CI and CD pipelines.

A useful way to think about it is:

  • 'create-stack means "create this stack"'
  • 'deploy means "make the stack match this template"'

Why deploy Feels Easier

The reason many teams prefer deploy is not just syntax. It reduces branching logic in scripts.

Without deploy, your automation often has to do this:

  1. check whether the stack exists
  2. call create-stack if it does not
  3. call update-stack if it does
  4. handle the case where no updates are needed

deploy wraps that operational pattern for you.

Parameters And Packaging Differences

deploy also fits better with packaged workflows, where local artifacts have already been uploaded or transformed for deployment. It is often used after packaging steps in serverless or artifact-heavy CloudFormation workflows.

That does not make create-stack obsolete. It just means deploy is usually the more ergonomic command when your goal is repeatable infrastructure rollout.

When To Choose create-stack

Use create-stack when you want low-level control or a very explicit lifecycle.

Examples:

  • bootstrapping a brand-new environment
  • testing raw stack-creation behavior
  • scripts where create and update are intentionally separated

If you later need to modify the stack, you would move to update-stack or another explicit workflow step.

When To Choose deploy

Use deploy when you want a normal create-or-update deployment flow.

Examples:

  • CI pipeline deployment jobs
  • developer environments that are updated repeatedly
  • infrastructure repos where the template is the desired state

This is the common default for iterative infrastructure delivery.

A Practical Comparison

Suppose your stack might or might not exist.

With the lower-level commands, the logic is more involved:

bash
aws cloudformation create-stack ...
# or later
aws cloudformation update-stack ...

With deploy, the operator intent is shorter:

bash
aws cloudformation deploy ...

That simplicity is why many teams standardize on deploy unless they need very specific low-level control.

Common Pitfalls

A common mistake is using create-stack in a repeated deployment workflow and then being surprised when it fails because the stack already exists.

Another issue is assuming deploy is a completely different CloudFormation mechanism. It is still CloudFormation stack creation and updates, just wrapped in a higher-level CLI workflow.

Developers also sometimes forget that deploy still needs capabilities such as CAPABILITY_IAM or CAPABILITY_NAMED_IAM when the template creates IAM resources.

Finally, do not treat deploy as magic. It simplifies command usage, but you still need to understand what changes the template is applying and how stack updates behave.

Summary

  • 'create-stack creates a brand-new stack and does not update an existing one.'
  • 'deploy is a higher-level create-or-update command designed for repeatable deployments.'
  • 'deploy is usually the better default for CI and iterative infrastructure workflows.'
  • 'create-stack is useful when you want explicit low-level creation behavior.'
  • Choose based on workflow intent: one-time creation versus ongoing desired-state deployment.

Course illustration
Course illustration

All Rights Reserved.