@SdkInternalApi
    final CreateKeyPairResult executeCreateKeyPair(CreateKeyPairRequest createKeyPairRequest) {

        ExecutionContext executionContext = createExecutionContext(createKeyPairRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<CreateKeyPairRequest> request = null;
        Response<CreateKeyPairResult> response = null;

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

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

            StaxResponseHandler<CreateKeyPairResult> responseHandler = new StaxResponseHandler<CreateKeyPairResult>(new CreateKeyPairResultStaxUnmarshaller());

            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }
<p>
Creates an ED25519 or 2048-bit RSA key pair with the specified name and in the specified PEM or PPK format.
Amazon EC2 stores the public key and displays the private key for you to save to a file. The private key is
returned as an unencrypted PEM encoded PKCS#1 private key or an unencrypted PPK formatted private key for use
with PuTTY. If a key with the specified name already exists, Amazon EC2 returns an error.
</p>
<p>
The key pair returned to you is available only in the Amazon Web Services Region in which you create it. If you
prefer, you can create your own key pair using a third-party tool and upload it to any Region using
<a>ImportKeyPair</a>.
</p>
<p>
You can have up to 5,000 key pairs per Amazon Web Services Region.
</p>
<p>
For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html">Amazon
EC2 key pairs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.
</p>

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