Monitoring AWS Systems Manager Cloud Extensions
Monitor the health and performance of the AWS Systems Manager Cloud Extensions runtime and your extensions. Use runtime logs, Amazon CloudWatch metrics, and the Cloud Extensions API.
Topics
Checking the configuration with the API
The Cloud Extensions API shows the configuration that the runtime loads. Use the following commands to confirm what you configured:
# List the profiles in your account aws cloudextensions list-profiles # List the extensions in a profile aws cloudextensions list-profile-entries --profile-identifier my-application # View the version policy, the settings, and the capabilities that you approved for one extension aws cloudextensions get-profile-entry \ --profile-identifier my-application \ --identifierprofile-entry-id
The effectiveSettings field shows the setting values that the extension uses, including default values. The approved field shows the capabilities that you approved. The inherited field shows the profile defaults that apply to the entry.
Runtime logs
The runtime writes log messages that show which profile it loaded, which extensions it started, and which errors occurred.
Log messages
At startup, the runtime logs the profile that it retrieved and the extensions that it loads. When the runtime shuts down, it logs that it removed the routes of the extensions. When the cached copy of an extension doesn't match the release, the runtime logs a warning and fetches the correct package.
Where to find the logs
-
Lambda – The runtime writes its logs to the CloudWatch Logs log group of your function,
/aws/lambda/. The logs are JSON, with one event on each line.function-name -
Containers – The runtime writes its logs to the standard output of the container, as plain text. Use
docker logs, or the log driver of your container platform.
A log line that comes from an extension, instead of from the runtime, has "source": "extension".
To read the logs of a Lambda function, run the following command:
aws logs tail /aws/lambda/my-function --follow
Log level
In Lambda, the AWS_CLOUDEXTENSIONS_LOG_LEVEL environment variable sets the verbosity of the logs. For example, to see detailed messages, set the variable to debug. The valid values are:
-
debug- Detailed debugging information -
info- General informational messages. This value is the default. -
warn- Warning messages only -
error- Error messages only -
none- No logs
Searching the logs
To search the logs of a Lambda function for errors, run the following command:
aws logs filter-log-events \ --log-group-name /aws/lambda/my-function \ --filter-pattern "ERROR"
CloudWatch metrics
Each extension sends its own metrics to Amazon CloudWatch. The metrics are OpenTelemetry metrics, so they don't have a classic CloudWatch namespace or dimensions, and the list-metrics command of CloudWatch doesn't list them. You query the metrics with Prometheus Query Language (PromQL) in CloudWatch, and you create PromQL alarms on them. You don't turn on a feature in your account. You don't pay for the metrics.
Metric scopes and attributes
Each extension publishes its metrics under its own instrumentation scope. The scope has the form cloudwatch.aws/<extension_name>/cloudextensions. The following table lists the scopes:
| Extension | Scope |
|---|---|
|
AWS AppConfig |
|
|
Parameter Store |
|
|
Secrets Manager |
|
Each data point has the attributes extension.name and extension.version. For the metrics of each extension, see the monitoring topic of the extension.
Querying metrics
To query a metric, use a PromQL query in CloudWatch. For example, the following query is true when the AWS AppConfig extension fails to retrieve a configuration within the last five minutes:
sum(sum_over_time({"cache.load.failures"}[5m])) > 0
Creating CloudWatch alarms
Create PromQL alarms to detect problems early. Alarm on the failure counters of an extension. For example, the cache.load.failures and cache.refresh.failures metrics of the AWS AppConfig extension count failed retrievals and failed background polls.
Telemetry that the runtime sends
The runtime sends operational telemetry to AWS. For each reporting period, the telemetry includes the following:
-
The number of invocations, errors, and faults of each extension
-
The memory that each extension uses
-
How long calls to each extension take
-
The metrics of each extension
The telemetry labels this data with the ID and name of the profile and the name and version of the extension. When the runtime calls the Cloud Extensions service, it also identifies its own version, its operating system, and its architecture. In Lambda, it also identifies the Lambda environment. You can't turn telemetry off.
If the network is unavailable, the runtime buffers telemetry for retry.
Extension-specific details
For the metrics, logs, settings, and checks of each extension, see the topic for the extension:
Checking profiles and extension versions on the console
To check the version and the update method of each extension in a profile
-
Open the Systems Manager console at https://console.aws.amazon.com/systems-manager/
. -
In the navigation pane, choose Cloud Extensions.
-
Choose the Profiles tab, and then choose the name of the profile.
-
On the Extensions tab, review the Version and Update method columns for each extension.
-
If a version column shows Update available, a newer version of the extension exists. For more information, see Updating an extension on the console.
To check the authentication setting and the execution role of the profile, choose the Runtime settings tab.
Performance monitoring
Cache effectiveness
Use the cache metrics of an extension to see how well its cache works. Compare cache.hits with cache.misses to see the hit ratio. A low hit ratio means that more requests reach the AWS service. The cache might be too small, or the time to live (TTL) might be too short. For the metrics of each extension, see the monitoring topic of the extension.
Memory
A steady rise in memory use can mean that a cache setting is too large for your compute. For example, the Parameter Store extension has a cache size setting. For more information, see Configuration options for the Parameter Store extension in AWS Systems Manager Cloud Extensions.
Troubleshooting with monitoring data
-
An extension doesn't start – Check the runtime logs for
ERROR failed to load extensionmessages, and check theapprovedandeffectiveSettingsfields of the profile entry. -
Slow responses – Check the logs of the extension in CloudWatch Logs after your next invocation. Then check the cache metrics. A low hit ratio means that more requests reach the AWS service.
-
High memory use – Review the cache settings of the extension.
For detailed steps, see Troubleshooting AWS Systems Manager Cloud Extensions.
Best practices
-
Set up alarms early – Create alarms before you deploy to production.
-
Establish a baseline – Record the normal hit ratio of the cache of each extension so that you can compare it with later results.
-
Watch metrics when versions change – Check metrics closely after you move a profile entry to a new extension version.
-
Check the logs after a change – After you change a profile, check the logs of the extension in CloudWatch Logs after your next invocation.
-
Retain logs – Set a retention period for your CloudWatch Logs log groups.
-
Review regularly – Review your metrics periodically to find optimization opportunities.