cfn-init command not found

In this troubleshooting guide we learn how to fix cfn-init command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

cfn-init: command not found

or when using sudo you get the following error message

sudo: cfn-init: command not found

Solutions to cfn-init: command not found

How To Fix cfn-init: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu cfn-init is provided by heat-cfntools package.

heat-cfntools is:

This package contains tools for use with CloudFormation cfn-init - Reads the AWS::CloudFormation::Init for the instance resource, installs packages, and starts services cfn-signal - Waits for an application to be ready before continuing, ie: supporting the WaitCondition feature cfn-hup - Handle updates from the UpdateStack CloudFormation API call

To fix this problem, we can install more using the command below.

sudo apt-get -y install heat-cfntools

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install heat-cfntools.

sudo apt -y install heat-cfntools

Or if you have aptitude installed you can use the following command.

sudo aptitude install heat-cfntools

Summary

In this tutorial we learn how to fix cfn-init command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.