code: public static List<Instance> describeAllInstances() {
          // pass any credentials as aws-mock does not authenticate them at all
          AWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
          AmazonEC2Client amazonEC2Client = new AmazonEC2Client(credentials);
  
          // the mock endpoint for ec2 which runs on your computer
          String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/";
          amazonEC2Client.setEndpoint(ec2Endpoint);
  
          DescribeInstancesResult response = amazonEC2Client.describeInstances();
          List<Reservation> reservations = response.getReservations();
  
          List<Instance> ret = new ArrayList<Instance>();
  
          for (Reservation reservation : reservations) {
              List<Instance> instances = reservation.getInstances();
  
              if (null != instances) {
  
                  for (Instance i : instances) {
                      ret.add(i);
                  }
              }
          }
  
          return ret;
      }
docs: Describe all mock instances within aws-mock.
  
  @return a list of all instances