title: sudo: aws: command not found
body: <p>Installed aws cli 2 on my Centos machine. Added</p>
  <blockquote>
  <p>PATH=&quot;/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin&quot;</p>
  </blockquote>
  <p>to <code>/etc/environment</code>. Most of the cases aws command can be called successfully. However, when using <code>sudo aws</code>, it shows command not found. Below are all the scenarios. Any idea?</p>
  <pre class="lang-sh prettyprint-override"><code>[centos@ip-172-20-x-x ~]$ aws --version
  aws-cli/2.1.28 Python/3.8.8 Linux/3.10.0-1160.11.1.el7.x86_64 exe/x86_64.centos.7 prompt/off
  [centos@ip-172-20-x-x ~]$ sudo su
  [root@ip-172-20-x-x centos]# aws --version
  aws-cli/2.1.28 Python/3.8.8 Linux/3.10.0-1160.11.1.el7.x86_64 exe/x86_64.centos.7 prompt/off
  [root@ip-172-20-x-x centos]# sudo aws --version
  sudo: aws: command not found
  [root@ip-172-20-x-x centos]# cat /etc/environment
  PATH=&quot;/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin&quot;
  [root@ip-172-20-x-x centos]# sudo env
  HOSTNAME=ip-172-20-x-x.ap-southeast-1.compute.internal
  TERM=xterm
  HISTSIZE=1000
  USERNAME=root
  MAIL=/var/spool/mail/centos
  LANG=en_US.UTF-8
  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
  LOGNAME=root
  USER=root
  HOME=/root
  SHELL=/bin/bash
  SUDO_COMMAND=/bin/env
  SUDO_USER=root
  SUDO_UID=0
  SUDO_GID=0
  XDG_SESSION_ID=20
  </code></pre>