Back to APIs

Manage your AWS databases, storage, and compute resources.

Using the AWS API with Trigger.dev

You can use Trigger.dev with any existing Node SDK or even just using fetch. Using io.runTask makes your AWS background job resumable and appear in our dashboard.

Use io.runTask() and the official SDK or fetch.

Example code using AWS

Below are some working code examples of how you can use AWS with Trigger.dev. These samples are open source and maintained by the community, you can copy and paste them into your own projects.

1
import { TriggerClient } from "@trigger.dev/sdk";
2
3
// SNS Message blog https://repost.aws/knowledge-center/sns-lambda-webhooks-chime-slack-teams
4
// Create topic in SNS console
5
// Create Lambda function
6
// Configure Lambda function custom code from the blog and update trigger HTTP endpoint and secret
7
// Deploy and test
8
9
const aws = client.defineHttpEndpoint({
10
id: "aws",
11
source: "aws.com",
12
icon: "aws",
13
verify: async (request) => {
14
const secret = request.headers.get("x-aws-secret");
15
if (secret === process.env.AWS_WEBHOOK_SECRET) {
16
return { success: true };
17
}
18
return { success: false, reason: "Verification failed" };
19
},
20
});
21
22
client.defineJob({
23
id: "http-aws",
24
name: "HTTP aws",
25
version: "1.0.0",
26
enabled: true,
27
//create a trigger from the HTTP endpoint
28
trigger: aws.onRequest(),
29
run: async (request, io, ctx) => {
30
const body = await request.json();
31
await io.logger.info(`Body`, body);
32
},
33
});