@SdkInternalApi
    final ModifyInstanceMetadataDefaultsResult executeModifyInstanceMetadataDefaults(ModifyInstanceMetadataDefaultsRequest modifyInstanceMetadataDefaultsRequest) {

        ExecutionContext executionContext = createExecutionContext(modifyInstanceMetadataDefaultsRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<ModifyInstanceMetadataDefaultsRequest> request = null;
        Response<ModifyInstanceMetadataDefaultsResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new ModifyInstanceMetadataDefaultsRequestMarshaller().marshall(super.beforeMarshalling(modifyInstanceMetadataDefaultsRequest));
                // 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, "ModifyInstanceMetadataDefaults");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

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

            StaxResponseHandler<ModifyInstanceMetadataDefaultsResult> responseHandler = new StaxResponseHandler<ModifyInstanceMetadataDefaultsResult>(
                    new ModifyInstanceMetadataDefaultsResultStaxUnmarshaller());

            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }
<p>
Modifies the default instance metadata service (IMDS) settings at the account level in the specified Amazon Web
Services&#x2028; Region.
</p>
<note>
<p>
To remove a parameter's account-level default setting, specify <code>no-preference</code>. If an account-level
setting is cleared with <code>no-preference</code>, then the instance launch considers the other instance
metadata settings. For more information, see <a href=
"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence"
>Order of precedence for instance metadata options</a> in the <i>Amazon EC2 User Guide</i>.
</p>
</note>

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