The AWS Lambda extensions arose in response to the request of developers in order to incorporate monitoring, security and governance tools in a more direct way within the invocations of the functions with which they could centralize the monitoring in tools that they already had . Before AWS Lambda extensions there were two main ways to monitor your function aws solution architect associate:
Synchronous way: Send the logs during the execution of the elements of the function, which can increase the execution time of the AWS Lambda . Deriving in a higher latency to the user and also increasing the cost of the invocation.
Asynchronous way: After execution, logs are sent, mainly using AWS CloudWatch . Which, while improving the efficiency of AWS Lambda , requires post-processing to filter the most relevant logs (if desired) and send them to the monitoring tool. Generating delays in updating the information, considering that sending logs to AWS CloudWatc h can increase the average cost of executing the function. Finally, there is also the possibility of losing the logs if the environment is closed immediately before sending the information.
The extensions allow the developer to be able to generate separate processes so that they can send monitoring information synchronously and also that they can customize or prepare the AWS Lambda execution environment before its invocation. Dividing into two types:
Internal extensions: This type can be identified as code wrappers, which means that they will share the same process and for this reason they must be of the same programming language as that of the main function. Its purpose is to modify the start of the function, allowing to add or modify execution arguments, environment variables, obtain and provide secret data or data necessary for the proper execution of the function.
External extensions: They allow a separate thread of execution, but maintaining the same execution environment of the AWS Lambda function . This separation allows them to be executed in a programming language different from the one established in the function. Also, they can be invoked before and continue to run after the function's runtime.
The execution environment ( Execution Environment ) mainly consists of API Endpoints and processes ( Processes ). Where processes are created by executing the extension code, and the Runtime together with the function. The AWS Lambda service communicates via HTTP with the Runtime using the Runtime API allowing the output and input of information to other elements of the function or to the AWS Lambda service during the existence of the process.
On the other hand, extensions can communicate with the other components in two ways:
Extensions API : Through this HTTP API, the extensions receive the Runtime signals of the function, allowing them to execute different types of logic depending on the general state of the function.
Logs API : This HTTP API allows the extension to send logs directly to AWS CloudWatch or subscribe to receive them.
No comments:
Post a Comment