How to add CloudWatch Lambda Insights to serverless config?

此生再无相见时 提交于 2021-02-07 14:30:10

问题


How to add CloudWatch Lambda Insights to serverless config? I don't want to do this manually, so I expect this to be an option.

I've added tracing like this:

tracing:
    lambda: true

But this only enables AWS X-ray and not the other option.


回答1:


I found out that it isn't a setting but a layer in the lambda. I managed to create it with this piece of code:

provider:
  name: aws
  iamManagedPolicies:
    - "arn:aws:iam::aws:policy/CloudWatchLambdaInsightsExecutionRolePolicy"

functions:
  functionName:
    layers:
      - arn:aws:lambda:<REGION>:580247275435:layer:LambdaInsightsExtension:<VERSION>

The latest version of the lambda insights layer can be found at: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-extension-versions.html



来源:https://stackoverflow.com/questions/65217527/how-to-add-cloudwatch-lambda-insights-to-serverless-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!