Codebuild aws command not found when ran?
<p>I'm trying to get a simple docker app to build using AWS <strong>codebuild</strong>, but I am coming across an error where the <strong>aws</strong> command is not found:</p>

<pre><code>[Container] 2016/12/10 04:29:17 Build started on Sat Dec 10 04:29:17 UTC 2016
[Container] 2016/12/10 04:29:17 Running command echo Building the Docker image...
[Container] 2016/12/10 04:29:17 Building the Docker image...
[Container] 2016/12/10 04:29:17 Running command docker build -t aws-test .
[Container] 2016/12/10 04:29:17 sh: 1: docker: not found
[Container] 2016/12/10 04:29:17 Command did not exit successfully docker build -t aws-test . exit status 127
[Container] 2016/12/10 04:29:17 Phase complete: BUILD Success: false
[Container] 2016/12/10 04:29:17 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker build -t aws-test .. Reason: exit status 127
</code></pre>

<p>I've got a super simple docker file which builds a simple express app:</p>

<pre><code>FROM node:6.2.0

# Create app directory
RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app

# Install app dependencies
COPY package.json /usr/src/app/

# Bundle app source
COPY . /usr/src/app

EXPOSE 3000

CMD npm install &amp;&amp; npm start
</code></pre>

<p>And I've got a super simple <strong>buildspec.yml</strong> which is suppose to build the docker container and push it to the <strong>aws</strong> registry:</p>

<pre><code>version: 0.1

phases:
  pre_build:
    commands:
      - echo Logging in to Amazon ECR...
      - $(aws ecr get-login --region us-west-2)
  build:
    commands:
      - echo Build started on `date`
      - echo Building the Docker image...          
      - docker build -t &lt;CONTAINER_NAME&gt; .
      - docker tag &lt;CONTAINER_NAME&gt;:latest &lt;ID&gt;.dkr.ecr.us-west-2.amazonaws.com/&lt;CONTAINER_NAME&gt;:latest
  post_build:
    commands:
      - echo Build completed on `date`
      - echo Pushing the Docker image...
      - docker push &lt;ID&gt;.dkr.ecr.us-west-2.amazonaws.com/&lt;CONTAINER_NAME&gt;:latest
</code></pre>

<p>However once ran, it throws the error posted above ^^ I'm not sure why the <strong>aws</strong> cli utils aren't found? This guide here: </p>

<p><a href="http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html" rel="noreferrer">http://docs.aws.amazon.com/codebuild/latest/userguide/sample-docker.html</a></p>

<p>Suggests I don't need to do anything to setup the <strong>aws</strong> cli utils anywhere?</p>

<p>Also one other thing I noticed, I removed <strong>$(aws ecr get-login --region us-west-2)</strong> step from the buildspec file, built it again and it then said that the docker command was not found?! Have I missed a step somewhere (I don't think I have).</p>