AWS Lambda Integration with Kloudfuse :: Kloudfuse Docs

AWS Lambda Integration with Kloudfuse

Kloudfuse integrates with AWS Lambda to collect metrics, logs, and traces from your serverless functions.

Add Extension Layers to the Lambda Function

Kloudfuse requires that you configure two extension layers for the lambda function.

Add these layers in the AWS Lambda console of the Lambda function:

Layer ARN:

`arn:aws:lambda:us-west-2:464622532012:layer:Datadog-Extension:33`

Layer ARN:

arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:21

Configure the Datadog Extension Layer

Add the following environment variables to the Lambda configuration:

Configure Cloudwatch Metrics

After you integrate CloudWatch with Kloudfuse, it pushes Lambda-related metrics by default.

See Cloudwatch Metrics.

Configure CloudTrail

Configure CloudTrail to send Lambda events to the EventBridge, and then onward to Kloudfuse.

  1. Create a new Trail from the AWS CloudTrail console.

  2. In Step 2 Choose log events, make these selections:

Update Helm Values in Kloudfuse

  1. Enable Lambda enrichment in custom_values.yaml file.
ingester:
     config:
       awsScrapeLambdaConfigs: true
  1. Kloudfuse must scrape the Lambda configuration from AWS, so it must have a policy with following permissions:
{
       "Action": [\
           {\
               "lambda:GetPolicy",\
               "lambda:List*",\
               "lambda:ListTags"\
           }\
       ]
}

Ensure that the permissions map to the node-pool used for EKS cluster that hosts the Kloudfuse platform.

  1. Create an IAM scraper role with a policy that enables scraping on AWS labels.

See AWS documentation on how to Define custom IAM permissions with customer managed policies.

  1. Enable Kloudfuse to consume the new policy; there are two approaches: through AWS credentials or through Role ARNs.

AWS credentials

  1. Retrieve your aws credentials; see Configure tool authentication with AWS.

  2. In the Kloudfuse namespace, create a kube secret name aws-access-key, with keys accessKey and secretKey.

kubectl create secret generic aws-access-key --from-literal=accessKey=<AWS_ACCESS_KEY_ID> --from-literal=secretKey=<AWS_SECRET_ACCESS_KEY>
  1. Specify the secretName in the custom-values.yaml file.
ingester:
  config:
    awsScraper:
      secretName: aws-access-key
  1. By default, Kloudfuse attempts to scrape from all regions. Customize this by adding the following configuration in the custom-values.yaml file:
ingester:
  config:
    awsScraper:
      secretName: aws-access-key
      regions:
    - <add region>

Role ARNs

  1. Add the scraper Role ARNs that you created with the new permissions to the awsRoleArns list to your custom-values.yaml file.
ingester:
  config:
    awsRoleArns:
    - role: <ADD ROLE ARN HERE>
  1. By default, Kloudfuse attempts to scrape from all regions. Customize this by adding the following configuration in the custom-values.yaml file:
ingester:
  config:
    awsRoleArns:
      role: <ADD ROLE ARN HERE>
      regions:
    - <add region>
  1. You may have to modify the Trust Relationship for the policy of the scrape role ARN, to add a Principal on the account for the node-group (Node IAM Role ARN) where the Kloudfuse platform runs.
{
    "Version": "2012-10-17",
    "Statement": [\
        {\
            "Sid": "Statement1",\
            "Effect": "Allow",\
            "Principal": {\
                "AWS": "arn:aws:iam::ACCOUNT-NUMBER:role/eksctl-XXXXX-nodegroup-ng-XXXXXX-NodeInstanceRole-XXXXXXXXXX"\
            },\
            "Action": "sts:AssumeRole"\
        }\
    ]
}
  1. To modify the node-group IAM role where Kloudfuse Platform runs, add the following permissions policy to the node-group (Node IAM Role ARN) to assume the role.
{
    "Version": "2012-10-17",
    "Statement": [\
        {\
            "Effect": "Allow",\
            "Action": "sts:AssumeRole",\
            "Resource": <REPLACE SCRAPER ROLE ARN HERE>\
        }\
    ]
}
  1. Complete a helm upgrade to save the changes.
helm upgrade --create-namespace --install kfuse . -f <custom_values.yaml>

Configure EventBridge

After you integrate EventBridge with Kloudfuse, it pushes Lambda-related events to Kloudfuse.

See AWS EventBridge Integration with Kloudfuse.