Amazon EC2 Container Service vs AWS CloudFormation

Need advice about which tool to choose?Ask the StackShare community!

Amazon EC2 Container Service

+ 1
AWS CloudFormation

+ 1
Add tool

AWS CloudFormation vs Amazon EC2 Container Service: What are the differences?

Key differences between AWS CloudFormation and Amazon EC2 Container Service

  1. Managed Services vs. Container Orchestration: AWS CloudFormation is a managed service that provides infrastructure as code, allowing users to define and provision AWS resources in a predictable and repeatable manner. It focuses on the provisioning and management of infrastructure resources. On the other hand, Amazon EC2 Container Service (ECS) is a container orchestration service that helps users to run, manage, and scale containerized applications using Docker containers. It focuses on managing the deployment and lifecycle of containerized applications.

  2. Granularity of Control: With AWS CloudFormation, users have fine-grained control over the provisioning and configuration of infrastructure resources. It allows users to specify details such as instance types, storage volumes, network settings, and security groups. In contrast, Amazon ECS abstracts the underlying infrastructure and provides a higher-level control over containers. Users define container specifications, such as CPU and memory requirements, and Amazon ECS takes care of the underlying infrastructure provisioning and coordination.

  3. Resource Management: AWS CloudFormation manages infrastructure resources as a stack. Users define a template that describes the resources they need, and CloudFormation creates and manages the stack based on that template. It provides features like rolling updates and drift detection. In contrast, Amazon ECS manages containers as tasks and services. Users define tasks that specify container images, networking, and resource requirements. ECS takes care of deploying and scaling those tasks, managing container instances, and load balancing traffic.

  4. Integration with Other AWS Services: AWS CloudFormation integrates with various AWS services, enabling users to create and provision resources from different services as part of a stack. Users can define dependencies between resources, enabling efficient provisioning and management. Amazon ECS integrates tightly with other AWS services, such as Amazon Elastic Container Registry (ECR) for container image storage, and Amazon Elastic Load Balancing (ELB) for load balancing container traffic. This integration simplifies the overall deployment and management process.

  5. Infrastructure-as-Code vs. Containerization: AWS CloudFormation focuses on defining infrastructure resources as code and managing the infrastructure lifecycle. It enables users to declaratively define and version their infrastructure. Amazon ECS, on the other hand, focuses on containerization and managing the application lifecycle. It provides features like task definitions and service definitions to define and manage containerized applications.

  6. Deployment and Management: AWS CloudFormation provides features like change sets, drift detection, and rollback, which enable users to safely deploy and manage changes to their infrastructure. It supports blue-green deployments and other advanced deployment strategies. With Amazon ECS, users can easily update their containerized applications by creating new task definitions and deploying new versions of services. It handles the deployment and management of containers, making it easier to scale and update applications.

In Summary, AWS CloudFormation is a managed service for infrastructure provisioning and management, while Amazon EC2 Container Service is a container orchestration service for running and managing containerized applications.

Decisions about Amazon EC2 Container Service and AWS CloudFormation
Kirill Shirinkin
Cloud and DevOps Consultant at mkdev · | 3 upvotes · 145.2K views

Ok, so first - AWS Copilot is CloudFormation under the hood, but the way it works results in you not thinking about CFN anymore. AWS found the right balance with Copilot - it's insanely simple to setup production-ready multi-account environment with many services inside, with CI/CD out of the box etc etc. It's pretty new, but even now it was enough to launch Transcripto, which uses may be a dozen of different AWS services, all bound together by Copilot.

See more
Andres Paredes
Lead Senior Software Engineer at InTouch Technology · | 3 upvotes · 84.5K views

If you want to integrate your cluster and control end to end your pipeline with AWS tools like ECR and Code Pipeline your best option is ECS using a EC2 instance. There are pros and cons but it's easier to integrate using cloud formation templates and visual UI for approvals, etc. ECS is free, you need to pay only for the EC2 instance but unfortunately, it is not standard then you cannot use standard tools to see and manage your Kubernetes. EKS in the other hand uses standard Kubernates definitions but you need to pay for the service and also for the EC2 instance(s) you have in your cluster.

See more

Because Pulumi uses real programming languages, you can actually write abstractions for your infrastructure code, which is incredibly empowering. You still 'describe' your desired state, but by having a programming language at your fingers, you can factor out patterns, and package it up for easier consumption.

See more
Sergey Ivanov

We use Terraform to manage AWS cloud environment for the project. It is pretty complex, largely static, security-focused, and constantly evolving.

Terraform provides descriptive (declarative) way of defining the target configuration, where it can work out the dependencies between configuration elements and apply differences without re-provisioning the entire cloud stack.


Terraform is vendor-neutral in a way that it is using a common configuration language (HCL) with plugins (providers) for multiple cloud and service providers.

Terraform keeps track of the previous state of the deployment and applies incremental changes, resulting in faster deployment times.

Terraform allows us to share reusable modules between projects. We have built an impressive library of modules internally, which makes it very easy to assemble a new project from pre-fabricated building blocks.


Software is imperfect, and Terraform is no exception. Occasionally we hit annoying bugs that we have to work around. The interaction with any underlying APIs is encapsulated inside 3rd party Terraform providers, and any bug fixes or new features require a provider release. Some providers have very poor coverage of the underlying APIs.

Terraform is not great for managing highly dynamic parts of cloud environments. That part is better delegated to other tools or scripts.

Terraform state may go out of sync with the target environment or with the source configuration, which often results in painful reconciliation.

See more

I personally am not a huge fan of vendor lock in for multiple reasons:

  • I've seen cost saving moves to the cloud end up costing a fortune and trapping companies due to over utilization of cloud specific features.
  • I've seen S3 failures nearly take down half the internet.
  • I've seen companies get stuck in the cloud because they aren't built cloud agnostic.

I choose to use terraform for my cloud provisioning for these reasons:

  • It's cloud agnostic so I can use it no matter where I am.
  • It isn't difficult to use and uses a relatively easy to read language.
  • It tests infrastructure before running it, and enables me to see and keep changes up to date.
  • It runs from the same CLI I do most of my CM work from.
See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of Amazon EC2 Container Service
Pros of AWS CloudFormation
  • 100
    Backed by amazon
  • 72
    Familiar to ec2
  • 53
    Cluster based
  • 42
    Simple API
  • 26
    Iam roles
  • 7
  • 7
    Cluster management
  • 7
    Programmatic Control
  • 4
    Container-enabled applications
  • 4
    Socker support
  • 2
    No additional cost
  • 1
    Easy to use and cheap
  • 43
    Automates infrastructure deployments
  • 21
    Declarative infrastructure and deployment
  • 13
    No more clicking around
  • 3
    Any Operative System you want
  • 3
  • 3
    Infrastructure as code
  • 1
    CDK makes it truly infrastructure-as-code
  • 1
    Automates Infrastructure Deployment
  • 0

Sign up to add or upvote prosMake informed product decisions

Cons of Amazon EC2 Container Service
Cons of AWS CloudFormation
    Be the first to leave a con
    • 4
    • 2
      No RBAC and policies in templates

    Sign up to add or upvote consMake informed product decisions

    What is Amazon EC2 Container Service?

    Amazon EC2 Container Service lets you launch and stop container-enabled applications with simple API calls, allows you to query the state of your cluster from a centralized service, and gives you access to many familiar Amazon EC2 features like security groups, EBS volumes and IAM roles.

    What is AWS CloudFormation?

    You can use AWS CloudFormation’s sample templates or create your own templates to describe the AWS resources, and any associated dependencies or runtime parameters, required to run your application. You don’t need to figure out the order in which AWS services need to be provisioned or the subtleties of how to make those dependencies work.

    Need advice about which tool to choose?Ask the StackShare community!

    Jobs that mention Amazon EC2 Container Service and AWS CloudFormation as a desired skillset
    What companies use Amazon EC2 Container Service?
    What companies use AWS CloudFormation?
    See which teams inside your own company are using Amazon EC2 Container Service or AWS CloudFormation.
    Sign up for StackShare EnterpriseLearn More

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with Amazon EC2 Container Service?
    What tools integrate with AWS CloudFormation?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    Blog Posts

    GitHubDockerAmazon EC2+23
    What are some alternatives to Amazon EC2 Container Service and AWS CloudFormation?
    Kubernetes is an open source orchestration system for Docker containers. It handles scheduling onto nodes in a compute cluster and actively manages workloads to ensure that their state matches the users declared intentions.
    JavaScript is most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic,and supports object-oriented, imperative, and functional programming styles.
    Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
    GitHub is the best place to share code with friends, co-workers, classmates, and complete strangers. Over three million people use GitHub to build amazing things together.
    Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.
    See all alternatives