concept AWS KMS in category aws

appears as: AWS KMS
AWS Lambda in Action: Event-driven serverless applications

This is an excerpt from Manning's book AWS Lambda in Action: Event-driven serverless applications.

The idea is to wrap the whole logic of your Lambda functions in an internal function in your code. For example, you can call this internal function processEvent (figure 16.1). When the Lambda function is invoked, it checks whether the secrets have already been decrypted by a previous execution of the function. If yes, the process-Event function is called. If no, AWS KMS is (asynchronously) called to decrypt the secrets, and the process-Event is returned as a callback to be invoked as soon as the KMS decrypt call returns successfully.

Figure 16.1. How to manage secrets and credentials in your Lambda functions. Data is encrypted using AWS KMS. The first invocation is decrypting the data and caching the result before processing the event. All subsequent invocations use the cached results and go straight to processing the event.

You can now include the GitHub SDKs in your Lambda function and use the token to authenticate your calls. For additional security, you can protect the token using AWS KMS as described at the beginning of this chapter. For an overview of the available GitHub SDKs and the supported platforms, see https://developer.github.com/libraries/.