@Override
    public AmazonWebServiceRequest beforeMarshalling(
            AmazonWebServiceRequest request) {

        if (request instanceof CreateBatchPredictionRequest) {
            CreateBatchPredictionRequest copy =
                    (CreateBatchPredictionRequest) request;

            if (copy.getBatchPredictionId() == null) {
                copy = copy.clone();
                copy.setBatchPredictionId(UUID.randomUUID().toString());
            }

            return copy;
        } else if (request instanceof CreateDataSourceFromRDSRequest) {
            CreateDataSourceFromRDSRequest copy =
                    (CreateDataSourceFromRDSRequest) request;

            if (copy.getDataSourceId() == null) {
                copy = copy.clone();
                copy.setDataSourceId(UUID.randomUUID().toString());
            }

            return copy;
        } else if (request instanceof CreateDataSourceFromRedshiftRequest) {
            CreateDataSourceFromRedshiftRequest copy =
                    (CreateDataSourceFromRedshiftRequest) request;

            if (copy.getDataSourceId() == null) {
                copy = copy.clone();
                copy.setDataSourceId(UUID.randomUUID().toString());
            }

            return copy;
        } else if (request instanceof CreateDataSourceFromS3Request) {
            CreateDataSourceFromS3Request copy =
                    (CreateDataSourceFromS3Request) request;

            if (copy.getDataSourceId() == null) {
                copy = copy.clone();
                copy.setDataSourceId(UUID.randomUUID().toString());
            }

            return copy;
        } else if (request instanceof CreateEvaluationRequest) {
            CreateEvaluationRequest copy =
                    (CreateEvaluationRequest) request;

            if (copy.getEvaluationId() == null) {
                copy = copy.clone();
                copy.setEvaluationId(UUID.randomUUID().toString());
            }

            return copy;
        } else if (request instanceof CreateMLModelRequest) {
            CreateMLModelRequest copy = (CreateMLModelRequest) request;

            if (copy.getMLModelId() == null) {
                copy = copy.clone();
                copy.setMLModelId(UUID.randomUUID().toString());
            }

            return copy;
        }

        return request;
    }
CreateXxx API calls require a unique (for all time!) ID parameter for
idempotency. If the user doesn't specify one, fill in a GUID.
aws-java-sdk-machinelearning/src/main/java/com/amazonaws/services/machinelearning/internal/RandomIdHandler.java