//snippet-sourcedescription:[RebootInstance.java demonstrates how to reboot an EC2 instance in code.]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[ec2]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[]
//snippet-sourceauthor:[soo-aws]
/*
 * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package com.example.ec2;
// snippet-start:[ec2.java2.reboot_instance.complete]
// snippet-start:[ec2.java2.reboot_instance.import]
import software.amazon.awssdk.services.ec2.Ec2Client;
import software.amazon.awssdk.services.ec2.model.RebootInstancesRequest;
import software.amazon.awssdk.services.ec2.model.RebootInstancesResponse;
 
// snippet-end:[ec2.java2.reboot_instance.import]
/**
 * Reboots and EC2 instance
 */
public class RebootInstance
{
    public static void main(String[] args)
    {
        final String USAGE =
            "To run this example, supply an instance id\n" +
            "Ex: RebootInstance <instance_id>\n";

        if (args.length != 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String instance_id = args[0];
        // snippet-start:[ec2.java2.reboot_instance.main]

        Ec2Client ec2 = Ec2Client.create();

        RebootInstancesRequest request = RebootInstancesRequest.builder()
            .instanceIds(instance_id).build();

        RebootInstancesResponse response = ec2.rebootInstances(request);

        // snippet-end:[ec2.java2.reboot_instance.main]
        System.out.printf(
            "Successfully rebooted instance %s", instance_id);
    }
}
 
// snippet-end:[ec2.java2.reboot_instance.complete]

@@ -251,16 +251,26 @@
 cedate:%5B
+2020-01-10
 %5D%0D%0A//sni
@@ -293,14 +293,15 @@
 r:%5Bs
-oo-aws
+cmacdon
 %5D%0D%0A/
@@ -327,10 +327,10 @@
 0-20
-19
+20
  Ama
@@ -1236,17 +1236,16 @@
 ponse;%0D%0A
- 
 %0D%0A// sni
@@ -1359,11 +1359,12 @@
 ance
+ %7B
 %0D%0A
-%7B
 %0D%0A  
@@ -1403,21 +1403,16 @@
 %5B%5D args)
-%0D%0A   
  %7B%0D%0A    
@@ -1437,16 +1437,20 @@
 SAGE =%0D%0A
+    
         
@@ -1503,16 +1503,28 @@
 d%5Cn%22 +%0D%0A
+            
         
@@ -1706,18 +1706,17 @@
 instance
-_i
+I
 d = args
@@ -1916,16 +1916,20 @@
         
+    
 .instanc
@@ -1941,18 +1941,17 @@
 instance
-_i
+I
 d).build
@@ -2130,16 +2130,20 @@
         
+    
 %22Success
@@ -2179,18 +2179,17 @@
 instance
-_i
+I
 d);%0D%0A   
@@ -2195,17 +2195,16 @@
   %7D%0D%0A%7D%0D%0A
- 
 %0D%0A// sni

Update RebootInstance.java