aws: command not found

When we want to execute AWS CLI commands to create tags, add AWS keys on AWS instances with the AWS Chef cookbook, first, we need to install the AWS CLI.

On Linux the following lines complete the installation

  bash "install_aws_cli" do
    code <<-EOF
      curl "" -o ""
      unzip -o
      # Install AWS CLI and create a symbolic link to it at /usr/bin, otherwise the rest of the AWS CLI calls fail.
      sudo ./aws/install -b /usr/bin --update
    not_if 'which aws'

Make sure you use the -b /usr/bin option to instruct the installer to create a symbolic link at /usr/bin

The Amazon recommended -b /usr/local/bin location only works on Amazon Linux and Ubuntu. On CentOS 7 and Red Hat 7 (RHEL7) we get the error message when the aws cookbook is executed

aws: command not found

Leave a comment

Your email address will not be published. Required fields are marked *