ec2metadata command not found

In this troubleshooting guide we learn how to fix ec2metadata command not found error message

Introduction

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

ec2metadata: command not found

or when using sudo you get the following error message

sudo: ec2metadata: command not found

Solutions to ec2metadata: command not found

How To Fix ec2metadata: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu ec2metadata is provided by cloud-guest-utils package.

cloud-guest-utils is:

This package contains programs useful inside cloud instance. It contains ‘growpart’ for resizing a partition during boot.

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

sudo apt-get -y install cloud-guest-utils

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

You can also use apt command to install cloud-guest-utils.

sudo apt -y install cloud-guest-utils

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

sudo aptitude install cloud-guest-utils

Summary

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