title: Connect to Google App Engine Datastore
body: <p>I am trying to connect to Google App Engine's Datastore from my local machine in Java. I will not be using the service with an application on GAE, it will be on AWS.</p>
  
  <p><strong>What I tried</strong></p>
  
  <p>I tried using
  <code>DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();</code>, but I think it is for when the application is hosted on GAE.</p>
  
  <p>Right now, I have Google Storage up and running using a json credentials file fetched with the System Variable <strong>GOOGLE_APPLICATION_CREDENTIALS</strong>. The connection works fine, so my guess is that I might have to do something similar to Storage. 
  I did something like this for Storage : </p>
  
  <pre><code>HttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
          JsonFactory jsonFactory = new JacksonFactory();
          GoogleCredential credential = GoogleCredential.getApplicationDefault(transport, jsonFactory);
  
          if (credential.createScopedRequired()) {
              Collection&lt;String&gt; bigqueryScopes = StorageScopes.all();
              credential = credential.createScoped(bigqueryScopes);
          }
  
          Storage client = new Storage.Builder(transport, jsonFactory, credential)
                  .setApplicationName("APPLICATION_NAME")
                  .build();
  </code></pre>
  
  <p><strong>The question</strong></p>
  
  <p>So my question is : How can I connect to Google App Engine Datastore from outside of Google App Engine?</p>
  
  <p>Thank you for your help!</p>