Skip to content

Latest commit

 

History

History
107 lines (62 loc) · 6.94 KB

monitoring-servicemap.md

File metadata and controls

107 lines (62 loc) · 6.94 KB

Example workflows using other AWS services

AWS Lambda integrates with other AWS services to help you monitor, trace, debug, and troubleshoot your Lambda functions. This page shows workflows you can use with AWS X-Ray, AWS Trusted Advisor and CloudWatch ServiceLens to trace and troubleshoot your Lambda functions.

Topics

Prerequisites

The following section describes the steps to using AWS X-Ray and Trusted Advisor to troubleshoot your Lambda functions.

Using AWS X-Ray

AWS X-Ray needs to be enabled on the Lambda console to complete the AWS X-Ray workflows on this page. If your execution role does not have the required permissions, the Lambda console will attempt to add them to your execution role.

To enable AWS X-Ray on the Lambda console

  1. Open the Functions page on the Lambda console.

  2. Choose your function.

  3. Choose the Configuration tab.

  4. On the Monitoring tools pane, choose Edit.

  5. Under AWS X-Ray, turn on Active tracing.

  6. Choose Save.

Using AWS Trusted Advisor

AWS Trusted Advisor inspects your AWS environment and makes recommendations on ways you can save money, improve system availability and performance, and help close security gaps. You can use Trusted Advisor checks to evaluate the Lambda functions and applications in your AWS account. The checks provide recommended steps to take and resources for more information.

Pricing

  • With AWS X-Ray you pay only for what you use, based on the number of traces recorded, retrieved, and scanned. For more information, see AWS X-Ray Pricing.
  • Trusted Advisor cost optimization checks are included with AWS Business and Enterprise support subscriptions. For more information, see AWS Trusted Advisor Pricing.

Example AWS X-Ray workflow to view a service map

If you've enabled AWS X-Ray, you can view a ServiceLens service map on the CloudWatch console. A service map displays your service endpoints and resources as nodes and highlights the traffic, latency, and errors for each node and its connections.

You can choose a node to see detailed insights about the correlated metrics, logs, and traces associated with that part of the service. This enables you to investigate problems and their effect on an application.

To view service map and traces using the CloudWatch console

  1. Open the Functions page on the Lambda console.

  2. Choose a function.

  3. Choose Monitoring.

  4. Choose View traces in X-Ray.

  5. Choose Service map.

  6. Choose from the predefined time ranges, or choose a custom time range.

  7. To troubleshoot requests, choose a filter.

Example AWS X-Ray workflow to view trace details

If you've enabled AWS X-Ray, you can use the single-function view on the CloudWatch Lambda Insights dashboard to show the distributed trace data of a function invocation error. For example, if the application logs message shows an error, you can open the ServiceLens traces view to see the distributed trace data and the other services handling the transaction.

To view trace details of a function

  1. Open the single-function view in the CloudWatch console.

  2. Choose the Application logs tab.

  3. Use the Timestamp or Message to identify the invocation request that you want to troubleshoot.

  4. To show the Most recent 1000 invocations, choose the Invocations tab.
    [Sorting the most recent 1000 invocations by request ID.]

  5. Choose the Request ID column to sort entries in ascending alphabetical order.

  6. In the Trace column, choose View.

    The Trace details page opens in the ServiceLens traces view.
    [Function trace details in the ServiceLens traces view.]

Example AWS Trusted Advisor workflow to view recommendations

Trusted Advisor checks Lambda functions in all AWS Regions to identify functions with the highest potential cost savings, and deliver actionable recommendations for optimization. It analyzes your Lambda usage data such as function execution time, billed duration, memory used, memory configured, timeout configuration and errors.

For example, the Lambda Functions with High Error Rate check recommends that you use AWS X-Ray or CloudWatch to detect errors with your Lambda functions.

To check for functions with high error rates

  1. Open the Trusted Advisor console.

  2. Choose the Cost Optimization category.

  3. Scroll down to AWS Lambda Functions with High Error Rates. Expand the section to see the results and the recommended actions.

What's next?