cfn-init vs cloud-init

There are two similarly named projects: cfn-init and cloud-init. Both provide a standard way to customize EC2 instances, but they are different tools. You may be wondering what’s the difference between these projects.

  • cloud-init is a Ubuntu-developed project that provides a standard to customize Cloud instances.
  • cfn-init is an AWS supported way of customizing EC2 instances.

More Details


The cloud-init project tagline is that they are “The standard for customising cloud instances”. So it works with multiple cloud providers. It comes pre-installed in the Ubuntu Cloud Images and also on the official EC2 Ubuntu images. It has a larger documentation site: cloud-init Documentation.

The Cloud configs are written as YAML and allow you to use directives for common tasks like installing packages, configuring files, and running commands. Here are Cloud config examples Interestingly, there does not seem to be a service module.

The cloud-init scripts are stored in UserData in multipart format. They get expanded out to the /var/lib/cloud directory and then ran.


The cfn-init tool is an AWS officially supported way of customizing EC2 instances. It has simpler documentation. In fact there are really 2 main pages: AWS::CloudFormation::Init and cfn-init. It supports common configuration management tasks like creating packages, groups, users, sources, files, commands, services. These tasks are group together in “Configset”. Configsets are a part of a CloudFormation template, so they can be written as YAML or JSON.

The cfn-init script is pre-installed on the AmazonLinux2 distro. AWS packaged it up to make it easier to customize EC2 instances without having to take the additional step of installing a configuration management tool.

The cfn-init script typically pulls the Configset definition from the CloudFormation stack template itself. It can also be provided a JSON Configset definition directly from the file system.