For testing purposes I needed a service which would generate a self signed certificate. To reduce my dependency on locally installed tools, I implemented this service as AWS Lambda function (or microservice if you want to call it that).

Here is what I came up with:

The generated output looks like this:

{
  "cert": {
    "filename": "cert.pem",
    "fileContent": "LS0tLS1CRUdJTiBDRVJU..."
  },
  "key": {
    "filename": "key.pem",
    "fileContent": "LS0tLS1CRUdJTiBQUklW..."
  }
}

PS: you might need to adjust the CN to your own domain name, currently all certificates will have the CN apimeister.com.