@SdkInternalApi
    final StopInstancesResult executeStopInstances(StopInstancesRequest stopInstancesRequest) {

        ExecutionContext executionContext = createExecutionContext(stopInstancesRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<StopInstancesRequest> request = null;
        Response<StopInstancesResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new StopInstancesRequestMarshaller().marshall(super.beforeMarshalling(stopInstancesRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopInstances");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            StaxResponseHandler<StopInstancesResult> responseHandler = new StaxResponseHandler<StopInstancesResult>(new StopInstancesResultStaxUnmarshaller());

            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }
<p>
Stops an Amazon EBS-backed instance. For more information, see <a
href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html">Stop and start Amazon EC2
instances</a> in the <i>Amazon EC2 User Guide</i>.
</p>
<p>
You can use the Stop action to hibernate an instance if the instance is <a
href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enabling-hibernation.html">enabled for hibernation</a>
and it meets the <a
href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html">hibernation
prerequisites</a>. For more information, see <a
href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your Amazon EC2 instance</a>
in the <i>Amazon EC2 User Guide</i>.
</p>
<p>
We don't charge usage for a stopped instance, or data transfer fees; however, your root partition Amazon EBS
volume remains and continues to persist your data, and you are charged for Amazon EBS volume usage. Every time
you start your instance, Amazon EC2 charges a one-minute minimum for instance usage, and thereafter charges per
second for instance usage.
</p>
<p>
You can't stop or hibernate instance store-backed instances. You can't use the Stop action to hibernate Spot
Instances, but you can specify that Amazon EC2 should hibernate Spot Instances when they are interrupted. For
more information, see <a
href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html#hibernate-spot-instances"
>Hibernating interrupted Spot Instances</a> in the <i>Amazon EC2 User Guide</i>.
</p>
<p>
When you stop or hibernate an instance, we shut it down. You can restart your instance at any time. Before
stopping or hibernating an instance, make sure it is in a state from which it can be restarted. Stopping an
instance does not preserve data stored in RAM, but hibernating an instance does preserve data stored in RAM. If
an instance cannot hibernate successfully, a normal shutdown occurs.
</p>
<p>
Stopping and hibernating an instance is different to rebooting or terminating it. For example, when you stop or
hibernate an instance, the root device and any other devices attached to the instance persist. When you terminate
an instance, the root device and any other devices attached during the instance launch are automatically deleted.
For more information about the differences between rebooting, stopping, hibernating, and terminating instances,
see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html">Instance
lifecycle</a> in the <i>Amazon EC2 User Guide</i>.
</p>
<p>
When you stop an instance, we attempt to shut it down forcibly after a short while. If your instance appears
stuck in the stopping state after a period of time, there may be an issue with the underlying host computer. For
more information, see <a
href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesStopping.html">Troubleshoot
stopping your instance</a> in the <i>Amazon EC2 User Guide</i>.
</p>

@param stopInstancesRequest
@return Result of the StopInstances operation returned by the service.
@sample AmazonEC2.StopInstances
@see <a href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/StopInstances" target="_top">AWS API
     Documentation</a>
aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/AmazonEC2Client.java