title: AWS Error Message: InvalidInstanceID.NotFound
body: <p>I'm trying to start a Amazon <a href="http://aws.amazon.com/ec2/" rel="nofollow noreferrer">EC2</a> cloud machine with <code>[startInstance][2]</code> method using aws-sdk in Java. My code is as follows.</p>
  
  <pre><code>public String startInstance(String instanceId) throws Exception {
      List&lt;String&gt; instanceIds = new ArrayList&lt;String&gt;();
      instanceIds.add(instanceId);
  
      StartInstancesRequest startRequest = new StartInstancesRequest(
              instanceIds);
      startRequest.setRequestCredentials(getCredentials());
  
      StartInstancesResult startResult = ec2.startInstances(startRequest);
      List&lt;InstanceStateChange&gt; stateChangeList = startResult
              .getStartingInstances();
      log.trace("Starting instance '{}':", instanceId);
  
      // Wait for the instance to be started
      return waitForTransitionCompletion(stateChangeList, "running",
              instanceId);
  }
  </code></pre>
  
  <p>When I run the above code, i'm getting the following AWS error:</p>
  
  <pre><code>Status Code: 400, AWS Request ID: e1bd4795-a609-44d1-9e80-43611e80006b, AWS Erro
  r Code: InvalidInstanceID.NotFound, AWS Error Message: The instance ID 'i-2b97ac
  2f' does not exist
          at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpCli
  ent.java:538)
          at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.ja
  va:283)
          at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:168
  )
          at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.jav
  a:5208)
          at com.amazonaws.services.ec2.AmazonEC2Client.startInstances(AmazonEC2Cl
  ient.java:2426)
  </code></pre>