Skip to content

AWS.DataExchange reference

Source: src/AWS/DataExchange/AcceptDataGrant.ts

Runtime binding for dataexchange:AcceptDataGrant.

Accepts a data grant another account sent to this account, creating an entitled copy of the granted data set — the receiver-side automation of direct data sharing. Provide the implementation with Effect.provide(AWS.DataExchange.AcceptDataGrantHttp).

const acceptDataGrant = yield* AWS.DataExchange.AcceptDataGrant();
// runtime
const accepted = yield* acceptDataGrant({ DataGrantArn: grantArn });
yield* Effect.log(`entitled data set: ${accepted.DataSetId}`);

Source: src/AWS/DataExchange/CancelJob.ts

Runtime binding for dataexchange:CancelJob.

Cancels a job that has not yet been started (WAITING state). Provide the implementation with Effect.provide(AWS.DataExchange.CancelJobHttp).

const cancelJob = yield* AWS.DataExchange.CancelJob();
// runtime
yield* cancelJob({ JobId: job.Id! });

Source: src/AWS/DataExchange/CreateDataGrant.ts

Runtime binding for dataexchange:CreateDataGrant.

Creates a data grant sharing an owned data set with another AWS account directly (without an AWS Marketplace product). The receiver must accept the grant to get an entitled copy of the data set. Provide the implementation with Effect.provide(AWS.DataExchange.CreateDataGrantHttp).

const createDataGrant = yield* AWS.DataExchange.CreateDataGrant();
// runtime
const grant = yield* createDataGrant({
Name: "prices-for-analytics",
SourceDataSetId: dataSetId,
ReceiverPrincipal: "111122223333",
GrantDistributionScope: "NONE",
});

Source: src/AWS/DataExchange/CreateJob.ts

Runtime binding for dataexchange:CreateJob.

Creates an import/export job — the Data Exchange work unit that moves assets between S3 (or signed URLs, Redshift datashares, API Gateway APIs, Lake Formation permissions) and a revision. Import/export jobs additionally need S3 permissions on the source/destination bucket — attach the matching AWS.S3 bindings to the same host. Provide the implementation with Effect.provide(AWS.DataExchange.CreateJobHttp).

const createJob = yield* AWS.DataExchange.CreateJob();
const startJob = yield* AWS.DataExchange.StartJob();
// runtime
const job = yield* createJob({
Type: "IMPORT_ASSETS_FROM_S3",
Details: {
ImportAssetsFromS3: {
DataSetId: dataSetId,
RevisionId: revisionId,
AssetSources: [{ Bucket: bucket, Key: "prices.csv" }],
},
},
});
yield* startJob({ JobId: job.Id! });

Source: src/AWS/DataExchange/DataSet.ts

An AWS Data Exchange data set — the top-level container that data providers publish revisions of data into. An owned data set holds revisions, each of which holds assets (e.g. S3 snapshot files) that subscribers receive.

Basic S3-snapshot data set

import * as AWS from "alchemy/AWS";
const dataSet = yield* AWS.DataExchange.DataSet("Prices", {
description: "Daily commodity price snapshots",
});

Named data set with tags

const dataSet = yield* AWS.DataExchange.DataSet("Prices", {
name: "commodity-prices",
assetType: "S3_SNAPSHOT",
description: "Daily commodity price snapshots",
tags: { team: "data" },
});
const revision = yield* AWS.DataExchange.Revision("PricesV1", {
dataSetId: dataSet.dataSetId,
comment: "Initial snapshot",
});

Source: src/AWS/DataExchange/DeleteAsset.ts

Runtime binding for dataexchange:DeleteAsset.

Deletes an asset from the bound (not-yet-finalized) revision. The data set and revision ids are injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.DeleteAssetHttp).

const deleteAsset = yield* AWS.DataExchange.DeleteAsset(revision);
// runtime
yield* deleteAsset({ AssetId: assetId });

Source: src/AWS/DataExchange/DeleteDataGrant.ts

Runtime binding for dataexchange:DeleteDataGrant.

Deletes a sent data grant, revoking the receiver’s entitlement. Provide the implementation with Effect.provide(AWS.DataExchange.DeleteDataGrantHttp).

const deleteDataGrant = yield* AWS.DataExchange.DeleteDataGrant();
// runtime
yield* deleteDataGrant({ DataGrantId: grantId });

Source: src/AWS/DataExchange/EventAction.ts

An AWS Data Exchange event action — an auto-export rule that copies every newly published revision of an ENTITLED data set into your S3 bucket the moment the provider publishes it. This is the subscriber-side automation primitive: subscribe to a product (or accept a data grant), attach an event action, and fresh data lands in your bucket with no polling.

Event actions require an entitled data set — creating one against an owned data set fails with a ValidationException.

Export new revisions to S3

import * as AWS from "alchemy/AWS";
const landing = yield* AWS.S3.Bucket("Landing", {});
const autoExport = yield* AWS.DataExchange.EventAction("AutoExport", {
dataSetId: entitledDataSetId,
exportRevisionToS3: { bucket: landing.bucketName },
});

Encrypted export with a key pattern

const autoExport = yield* AWS.DataExchange.EventAction("AutoExport", {
dataSetId: entitledDataSetId,
exportRevisionToS3: {
bucket: landing.bucketName,
keyPattern: "prices/${Revision.CreatedAt}/${Asset.Name}",
encryption: { type: "aws:kms", kmsKeyArn: key.keyArn },
},
});

Source: src/AWS/DataExchange/GetAsset.ts

Runtime binding for dataexchange:GetAsset.

Reads one asset of the bound revision — name, type-specific details (S3 snapshot size, API Gateway endpoint, …), and timestamps. The data set and revision ids are injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.GetAssetHttp).

const getAsset = yield* AWS.DataExchange.GetAsset(revision);
// runtime
const asset = yield* getAsset({ AssetId: assetId });
yield* Effect.log(`asset ${asset.Name}`);

Source: src/AWS/DataExchange/GetDataGrant.ts

Runtime binding for dataexchange:GetDataGrant.

Reads a sent data grant’s detail — receiver, acceptance state, and expiration. Provide the implementation with Effect.provide(AWS.DataExchange.GetDataGrantHttp).

const getDataGrant = yield* AWS.DataExchange.GetDataGrant();
// runtime
const grant = yield* getDataGrant({ DataGrantId: grantId });
yield* Effect.log(`state: ${grant.AcceptanceState}`);

Source: src/AWS/DataExchange/GetDataSet.ts

Runtime binding for dataexchange:GetDataSet.

Reads the bound data set’s detail — name, description, asset type, origin (OWNED or ENTITLED), and origin details. The data set id is injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.GetDataSetHttp).

// init — bind the operation to the data set
const getDataSet = yield* AWS.DataExchange.GetDataSet(dataSet);
// runtime
const detail = yield* getDataSet();
yield* Effect.log(`data set ${detail.Name} (${detail.AssetType})`);

Source: src/AWS/DataExchange/GetJob.ts

Runtime binding for dataexchange:GetJob.

Reads a job’s state (WAITING, IN_PROGRESS, COMPLETED, ERROR, …) and typed error details — the polling half of every import/export flow. Provide the implementation with Effect.provide(AWS.DataExchange.GetJobHttp).

const getJob = yield* AWS.DataExchange.GetJob();
// runtime
const done = yield* getJob({ JobId: job.Id! }).pipe(
Effect.repeat({
schedule: Schedule.spaced("2 seconds"),
until: (j) => j.State === "COMPLETED" || j.State === "ERROR",
times: 30,
}),
);

Source: src/AWS/DataExchange/GetReceivedDataGrant.ts

Runtime binding for dataexchange:GetReceivedDataGrant.

Reads a received data grant’s detail — sender, acceptance state, and expiration. Provide the implementation with Effect.provide(AWS.DataExchange.GetReceivedDataGrantHttp).

const getReceivedDataGrant =
yield* AWS.DataExchange.GetReceivedDataGrant();
// runtime
const grant = yield* getReceivedDataGrant({ DataGrantArn: grantArn });

Source: src/AWS/DataExchange/GetRevision.ts

Runtime binding for dataexchange:GetRevision.

Reads the bound revision’s detail — comment, finalized state, and revocation status. The data set and revision ids are injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.GetRevisionHttp).

const getRevision = yield* AWS.DataExchange.GetRevision(revision);
// runtime
const detail = yield* getRevision();
yield* Effect.log(`finalized: ${detail.Finalized}`);

Source: src/AWS/DataExchange/ListDataGrants.ts

Runtime binding for dataexchange:ListDataGrants.

Enumerates the data grants this account has sent. Provide the implementation with Effect.provide(AWS.DataExchange.ListDataGrantsHttp).

const listDataGrants = yield* AWS.DataExchange.ListDataGrants();
// runtime
const { DataGrantSummaries } = yield* listDataGrants();

Source: src/AWS/DataExchange/ListDataSetRevisions.ts

Runtime binding for dataexchange:ListDataSetRevisions.

Enumerates the bound data set’s revisions, newest first — the building block of “process the latest published revision” consumers. The data set id is injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.ListDataSetRevisionsHttp).

const listRevisions = yield* AWS.DataExchange.ListDataSetRevisions(dataSet);
// runtime
const { Revisions } = yield* listRevisions();
const latest = (Revisions ?? []).find((r) => r.Finalized);

Source: src/AWS/DataExchange/ListDataSets.ts

Runtime binding for dataexchange:ListDataSets.

Enumerates the account’s data sets — Origin: "OWNED" for data sets this account publishes, Origin: "ENTITLED" for active subscriptions. Provide the implementation with Effect.provide(AWS.DataExchange.ListDataSetsHttp).

// init — account-level binding, no resource argument
const listDataSets = yield* AWS.DataExchange.ListDataSets();
// runtime
const { DataSets } = yield* listDataSets({ Origin: "ENTITLED" });

Source: src/AWS/DataExchange/ListEventActions.ts

Runtime binding for dataexchange:ListEventActions.

Enumerates the account’s event actions (auto-export rules on entitled data sets), optionally filtered to one event source data set. Provide the implementation with Effect.provide(AWS.DataExchange.ListEventActionsHttp).

const listEventActions = yield* AWS.DataExchange.ListEventActions();
// runtime
const { EventActions } = yield* listEventActions();

Source: src/AWS/DataExchange/ListJobs.ts

Runtime binding for dataexchange:ListJobs.

Enumerates the account’s import/export jobs, optionally filtered to one data set or revision. Provide the implementation with Effect.provide(AWS.DataExchange.ListJobsHttp).

const listJobs = yield* AWS.DataExchange.ListJobs();
// runtime
const { Jobs } = yield* listJobs({ DataSetId: dataSetId });

Source: src/AWS/DataExchange/ListReceivedDataGrants.ts

Runtime binding for dataexchange:ListReceivedDataGrants.

Enumerates the data grants this account has received, optionally filtered by acceptance state (PENDING_RECEIVER_ACCEPTANCE, ACCEPTED). Provide the implementation with Effect.provide(AWS.DataExchange.ListReceivedDataGrantsHttp).

const listReceivedDataGrants =
yield* AWS.DataExchange.ListReceivedDataGrants();
// runtime
const { DataGrantSummaries } = yield* listReceivedDataGrants({
AcceptanceState: ["PENDING_RECEIVER_ACCEPTANCE"],
});

Source: src/AWS/DataExchange/ListRevisionAssets.ts

Runtime binding for dataexchange:ListRevisionAssets.

Enumerates the assets imported into the bound revision. The data set and revision ids are injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.ListRevisionAssetsHttp).

ListRevisionAssets: Reading Revisions & Assets

Section titled “ListRevisionAssets: Reading Revisions & Assets”
const listAssets = yield* AWS.DataExchange.ListRevisionAssets(revision);
// runtime
const { Assets } = yield* listAssets();
yield* Effect.log(`${(Assets ?? []).length} assets`);

Source: src/AWS/DataExchange/Revision.ts

A revision of an AWS Data Exchange data set — a versioned container of assets. Providers import assets into a revision (via DataExchange jobs) and then finalize it to make the snapshot available to subscribers.

import * as AWS from "alchemy/AWS";
const dataSet = yield* AWS.DataExchange.DataSet("Prices", {
description: "Daily commodity price snapshots",
});
const revision = yield* AWS.DataExchange.Revision("PricesV1", {
dataSetId: dataSet.dataSetId,
comment: "Initial snapshot",
});

Once assets have been imported into the revision (via a DataExchange import job), flip finalized to publish it. Finalizing an empty revision fails.

const revision = yield* AWS.DataExchange.Revision("PricesV1", {
dataSetId: dataSet.dataSetId,
comment: "Initial snapshot",
finalized: true,
});

Source: src/AWS/DataExchange/RevokeRevision.ts

Runtime binding for dataexchange:RevokeRevision.

Revokes the bound revision from subscribers with a required revocation comment — the remediation path when bad or sensitive data was published. The data set and revision ids are injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.RevokeRevisionHttp).

const revokeRevision = yield* AWS.DataExchange.RevokeRevision(revision);
// runtime
yield* revokeRevision({
RevocationComment: "Published with corrupted price data",
});

Source: src/AWS/DataExchange/SendApiAsset.ts

Runtime binding for dataexchange:SendApiAsset.

Invokes an API asset of an entitled API_GATEWAY_API data set — the Data Exchange data plane proxies the request to the provider’s API Gateway. The data set id is injected from the binding; pass the revision and asset ids of the API asset to call. Provide the implementation with Effect.provide(AWS.DataExchange.SendApiAssetHttp).

const sendApiAsset = yield* AWS.DataExchange.SendApiAsset(dataSet);
// runtime
const response = yield* sendApiAsset({
RevisionId: revisionId,
AssetId: assetId,
Method: "GET",
Path: "/prices",
});

Source: src/AWS/DataExchange/SendDataSetNotification.ts

Runtime binding for dataexchange:SendDataSetNotification.

Sends a provider-generated notification about the bound data set to its subscribers (DATA_UPDATE, DATA_DELAY, SCHEMA_CHANGE, or DEPRECATION) — delivered to each subscriber’s default EventBridge bus. The data set id is injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.SendDataSetNotificationHttp).

SendDataSetNotification: Notifying Subscribers

Section titled “SendDataSetNotification: Notifying Subscribers”
const notify = yield* AWS.DataExchange.SendDataSetNotification(dataSet);
// runtime — after publishing a new revision
yield* notify({ Type: "DATA_UPDATE", Comment: "Daily prices refreshed" });

Source: src/AWS/DataExchange/StartJob.ts

Runtime binding for dataexchange:StartJob.

Starts a created job. Jobs are created in the WAITING state and do nothing until started. The job runs with the caller’s forwarded permissions, so this binding also grants dataexchange:CreateAsset (import jobs) and dataexchange:GetAsset (export jobs); grant the S3 side of the transfer via the matching AWS.S3 bindings. Provide the implementation with Effect.provide(AWS.DataExchange.StartJobHttp).

const startJob = yield* AWS.DataExchange.StartJob();
// runtime
yield* startJob({ JobId: job.Id! });

Source: src/AWS/DataExchange/UpdateAsset.ts

Runtime binding for dataexchange:UpdateAsset.

Renames an asset of the bound revision (the asset name is the S3 key used when subscribers export it). The data set and revision ids are injected from the binding. Provide the implementation with Effect.provide(AWS.DataExchange.UpdateAssetHttp).

const updateAsset = yield* AWS.DataExchange.UpdateAsset(revision);
// runtime
yield* updateAsset({ AssetId: assetId, Name: "prices/2026-07-14.csv" });