code: public String createKeyValuePair(String keyName) {
  
      final AmazonEC2 amazonEC2 = getEc2Client();
  
      final CreateKeyPairRequest createKeyPairRequest = new CreateKeyPairRequest().withKeyName(keyName);
      final CreateKeyPairResult createKeyPairResult = amazonEC2.createKeyPair(createKeyPairRequest);
      final KeyPair keyPair = createKeyPairResult.getKeyPair();
      final String material = keyPair.getKeyMaterial();
      LOGGER.info("Created key: " + keyName);
      LOGGER.debug("Created material: " + material);
  
      return material;
    }
docs: *
  Creates a 2048-bit RSA key pair with the specified name
  
  @param keyName Key name to use
  @return Unencrypted PEM encoded PKCS#8 private key