Skip to content

DataSourceResource

Source: src/AWS/AppSync/DataSource.ts

An AppSync data source — the target a resolver reads from or writes to.

For AWS_LAMBDA and AMAZON_DYNAMODB targets a least-privilege service role is created automatically (unless an explicit serviceRoleArn is given): lambda:InvokeFunction on the function, or the DynamoDB read/write actions on the table and its indexes.

Lambda data source (auto-created invoke role)

const ds = yield* AppSync.DataSource("LambdaDS", {
api,
type: "AWS_LAMBDA",
lambdaConfig: { lambdaFunctionArn: fn.functionArn },
});

NONE data source (local compute)

const local = yield* AppSync.DataSource("Local", {
api,
type: "NONE",
});

DynamoDB data source

const ds = yield* AppSync.DataSource("TableDS", {
api,
type: "AMAZON_DYNAMODB",
dynamodbConfig: { tableName: table.tableName },
});