Understanding how the Amazon AppConfig Agent Lambda extension works
If you use Amazon AppConfig to manage configurations for a Lambda function without Lambda extensions, then you must configure your Lambda function to receive configuration updates by integrating with the StartConfigurationSession and GetLatestConfiguration API actions.
Integrating the Amazon AppConfig Agent Lambda extension with your Lambda function simplifies this process. The extension takes care of calling the Amazon AppConfig service, managing a local cache of retrieved data, tracking the configuration tokens needed for the next service calls, and periodically checking for configuration updates in the background. The following diagram shows how it works.
-
You configure the Amazon AppConfig Agent Lambda extension as a layer of your Lambda function.
-
To access its configuration data, your function calls the Amazon AppConfig extension at an HTTP endpoint running on
localhost:2772
. -
The extension maintains a local cache of the configuration data. If the data isn't in the cache, the extension calls Amazon AppConfig to get the configuration data.
-
Upon receiving the configuration from the service, the extension stores it in the local cache and passes it to the Lambda function.
-
Amazon AppConfig Agent Lambda extension periodically checks for updates to your configuration data in the background. Each time your Lambda function is invoked, the extension checks the elapsed time since it retrieved a configuration. If the elapsed time is greater than the configured poll interval, the extension calls Amazon AppConfig to check for newly deployed data, updates the local cache if there has been a change, and resets the elapsed time.
Note
-
Lambda instantiates separate instances corresponding to the concurrency level that your function requires. Each instance is isolated and maintains its own local cache of your configuration data. For more information about Lambda instances and concurrency, see Managing concurrency for a Lambda function.
-
The amount of time it takes for a configuration change to appear in a Lambda function, after you deploy an updated configuration from Amazon AppConfig, depends on the deployment strategy you used for the deployment and the polling interval you configured for the extension.