Search in sources :

Example 1 with ListInstancesRequest

use of com.amazonaws.services.servicediscovery.model.ListInstancesRequest in project aws-doc-sdk-examples by awsdocs.

the class ListInstances method main.

public static void main(String[] args) throws Exception {
    AWSCredentials credentials = null;
    try {
        credentials = new ProfileCredentialsProvider().getCredentials();
    } catch (Exception e) {
        throw new AmazonClientException("Cannot Load credentials");
    }
    AWSServiceDiscovery client = AWSServiceDiscoveryClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion("us-east-1").build();
    ListInstancesRequest lreq = new ListInstancesRequest();
    // Replace with service id
    lreq.setServiceId("srv-l7gkxmjapm5givba");
    System.out.println(client.listInstances(lreq));
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) AWSServiceDiscovery(com.amazonaws.services.servicediscovery.AWSServiceDiscovery) ListInstancesRequest(com.amazonaws.services.servicediscovery.model.ListInstancesRequest) AmazonClientException(com.amazonaws.AmazonClientException) ProfileCredentialsProvider(com.amazonaws.auth.profile.ProfileCredentialsProvider) AWSCredentials(com.amazonaws.auth.AWSCredentials) AmazonClientException(com.amazonaws.AmazonClientException)

Aggregations

AmazonClientException (com.amazonaws.AmazonClientException)1 AWSCredentials (com.amazonaws.auth.AWSCredentials)1 AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)1 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)1 AWSServiceDiscovery (com.amazonaws.services.servicediscovery.AWSServiceDiscovery)1 ListInstancesRequest (com.amazonaws.services.servicediscovery.model.ListInstancesRequest)1