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 is a working code example 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.

    import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
    import { z } from "zod";
    const asana = require("asana");
    // Create a personal access token: https://developers.asana.com/docs/personal-access-token
    const asanaClient = asana.Client.create().useAccessToken(
    process.env.ASANA_ACCESS_TOKEN
    );
    client.defineJob({
    id: "asana-get-user",
    name: "Asana Get User",
    version: "1.0.0",
    trigger: eventTrigger({
    name: "asana.get.user",
    schema: z.object({
    // This can either be the string "me", an email, or the GID of a user.
    // You can get your user GID by first logging in to Asana in your browser,
    // then visiting https://app.asana.com/api/1.0/users/me.
    userGid: z.string(),
    }),
    }),
    run: async (payload, io, ctx) => {
    // Wrap an SDK call in io.runTask so it's resumable and displays in logs
    const user = await io.runTask(
    "Get user",
    async () => {
    // This is the regular Asana SDK
    return asanaClient.users.getUser(payload.userGid);
    },
    // Add metadata to improve how the task displays in the logs
    { name: "Get Asana User", icon: "asana" }
    );
    },
    });
    ,