# Better Stack Amazon CloudWatch log forwarding

## Start logging in 5 minutes

Forward logs from [Amazon CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html) to Better Stack.

<div style="position: relative; padding-bottom: 58.82352941176471%; height: 0;"><iframe src="https://www.youtube.com/embed/4tCj9kfc_cA?start=1634" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>

### 1. Create a new AWS Lambda

- Go to [AWS Console → Lambda → Functions → Create function](https://console.aws.amazon.com/lambda/home#/create/function).
- Create a **new Lambda function** with these settings:
  - Author from scratch
  - Function name: `logtail-aws-lambda`
  - Runtime: `Node.js 22.x`
  - Architecture: `x86_64`

### 2. Upload Better Stack AWS Lambda sources

- Download [logtail-aws-lambda.zip](https://github.com/logtail/logtail-aws-lambda/releases/latest/download/logtail-aws-lambda.zip) archive with code source.
- Go to [AWS Console → Lambda → Functions → logtail-aws-lambda](https://console.aws.amazon.com/lambda/home#/functions/logtail-aws-lambda).
- Select **Upload from → .zip file** and upload the `logtail-aws-lambda.zip` archive.

### 3. Configure environment variables

- Switch to **Configuration** tab.
- Select **Environment variables** section.
- Add two new variables with the following values:

```plain
[label Environment variables configuration]
BETTER_STACK_ENTRYPOINT:    https://$INGESTING_HOST
BETTER_STACK_SOURCE_TOKEN:  $SOURCE_TOKEN
```

### 4. Set up subscription filters in CloudWatch

- Go to [CloudWatch → Log groups](https://console.aws.amazon.com/cloudwatch/home#logsV2:log-groups).
- Open the log group you'd like to send to Better Stack.
- Switch to **Subscription filters** tab.
- Choose **Create → Create Lambda subscription filter** with these settings:
  - Lambda function: `logtail-aws-lambda`
  - Log format: `JSON`
  - Subscription filter name: `logtail-aws-lambda-filter`

You should see your logs in [Better Stack → Live tail](https://telemetry.betterstack.com/team/0/tail ";_blank").

## Need help?

Please let us know at hello@betterstack.com.  
We're happy to help! 🙏