Search in sources :

Example 1 with RebootInstancesResult

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

the class RebootInstance method main.

public static void main(String[] args) {
    final String USAGE = "To run this example, supply an instance id\n" + "Ex: RebootInstnace <instance_id>\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String instance_id = args[0];
    final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
    RebootInstancesRequest request = new RebootInstancesRequest().withInstanceIds(instance_id);
    RebootInstancesResult response = ec2.rebootInstances(request);
    System.out.printf("Successfully rebooted instance %s", instance_id);
}
Also used : RebootInstancesRequest(com.amazonaws.services.ec2.model.RebootInstancesRequest) RebootInstancesResult(com.amazonaws.services.ec2.model.RebootInstancesResult) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2)

Aggregations

AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)1 RebootInstancesRequest (com.amazonaws.services.ec2.model.RebootInstancesRequest)1 RebootInstancesResult (com.amazonaws.services.ec2.model.RebootInstancesResult)1