Parsing x509 certificate in lambda

Does anyone know of a simple way to parse an x509 certificate inside lambda to access its subject fields? The very useful AWS IOT support exposes the certificate in the lambda function and then does not seem to provide anyway to decode it.

If your Lambda is using node, you could use https://www.npmjs.com/package/x509 examples on there show how to use it.

That package is a wrapper for calling openssl. I’ve figured out now that lambda nodes have openssl available. I’m still working on figuring out how to use serverless to include this package into my function upload.