Skip to content

AWS.SimpleDB reference

Source: src/AWS/SimpleDB/BatchDeleteAttributes.ts

Runtime binding for sdb:BatchDeleteAttributes.

Bind this operation to a Domain inside a function runtime to get a callable that automatically injects the domain name. Deletes attributes (or whole items, when an entry lists no attributes) on up to 25 items in a single call.

const batchDeleteAttributes =
yield* AWS.SimpleDB.BatchDeleteAttributes(domain);
yield* batchDeleteAttributes({
Items: [{ ItemName: "user#1" }, { ItemName: "user#2" }],
});

Source: src/AWS/SimpleDB/BatchPutAttributes.ts

Runtime binding for sdb:BatchPutAttributes.

Bind this operation to a Domain inside a function runtime to get a callable that automatically injects the domain name. Puts attributes on up to 25 items in a single call.

const batchPutAttributes = yield* AWS.SimpleDB.BatchPutAttributes(domain);
yield* batchPutAttributes({
Items: [
{
ItemName: "user#1",
Attributes: [{ Name: "plan", Value: "free", Replace: true }],
},
{
ItemName: "user#2",
Attributes: [{ Name: "plan", Value: "pro", Replace: true }],
},
],
});

Source: src/AWS/SimpleDB/DeleteAttributes.ts

Runtime binding for sdb:DeleteAttributes.

Bind this operation to a Domain inside a function runtime to get a callable that automatically injects the domain name. Omitting Attributes deletes the whole item.

Delete a Whole Item

const deleteAttributes = yield* AWS.SimpleDB.DeleteAttributes(domain);
yield* deleteAttributes({ ItemName: "user#123" });

Delete a Single Attribute

yield* deleteAttributes({
ItemName: "user#123",
Attributes: [{ Name: "plan" }],
});

Source: src/AWS/SimpleDB/Domain.ts

An Amazon SimpleDB domain — the container for SimpleDB items and attributes, analogous to a table.

SimpleDB is a legacy service (closed to accounts that never used it and slated for migration via the SimpleDBv2 export API), but domains remain fully manageable on grandfathered accounts. A domain has no mutable configuration: the name is its identity, so any name change replaces the domain. SimpleDB has no tagging API, so Alchemy cannot brand domains for ownership detection.

Basic Domain

import * as AWS from "alchemy/AWS";
const domain = yield* AWS.SimpleDB.Domain("MyDomain", {});

Named Domain

const domain = yield* AWS.SimpleDB.Domain("MyDomain", {
domainName: "my-application-data",
});

Source: src/AWS/SimpleDB/DomainMetadata.ts

Runtime binding for sdb:DomainMetadata.

Bind this operation to a Domain inside a function runtime to get a callable that returns the domain’s item/attribute counts and sizes.

const domainMetadata = yield* AWS.SimpleDB.DomainMetadata(domain);
const metadata = yield* domainMetadata();
// metadata.ItemCount, metadata.AttributeValueCount, ...

Source: src/AWS/SimpleDB/GetAttributes.ts

Runtime binding for sdb:GetAttributes.

Bind this operation to a Domain inside a function runtime to get a callable that automatically injects the domain name.

const getAttributes = yield* AWS.SimpleDB.GetAttributes(domain);
const response = yield* getAttributes({
ItemName: "user#123",
ConsistentRead: true,
});
// response.Attributes: [{ Name: "email", Value: "a@b.com" }, ...]

Source: src/AWS/SimpleDB/ListDomains.ts

Runtime binding for sdb:ListDomains.

Account-level operation — invoked with no resource argument. Lists the domain names in the current region, one page (up to 100 names) per call; pass the response’s NextToken back to continue. Useful for the classic SimpleDB domain-sharding pattern where an application spreads items across many domains and discovers them at runtime. Provide the implementation with Effect.provide(AWS.SimpleDB.ListDomainsHttp).

// init — account-level binding, no resource argument
const listDomains = yield* AWS.SimpleDB.ListDomains();
// runtime
const page = yield* listDomains({ MaxNumberOfDomains: 100 });
// page.DomainNames: ["users-shard-0", "users-shard-1", ...]

Source: src/AWS/SimpleDB/PutAttributes.ts

Runtime binding for sdb:PutAttributes.

Bind this operation to a Domain inside a function runtime to get a callable that automatically injects the domain name.

const putAttributes = yield* AWS.SimpleDB.PutAttributes(domain);
yield* putAttributes({
ItemName: "user#123",
Attributes: [
{ Name: "email", Value: "a@b.com", Replace: true },
{ Name: "plan", Value: "pro", Replace: true },
],
});

Source: src/AWS/SimpleDB/Select.ts

Runtime binding for sdb:Select.

Bind this operation to a Domain inside a function runtime. Select addresses the domain inside the expression itself rather than via a request field, so the client accepts either a literal expression or a function of the domain’s resolved physical name.

Select All Items

const select = yield* AWS.SimpleDB.Select(domain);
const result = yield* select({
SelectExpression: (domain) => `select * from \`${domain}\``,
ConsistentRead: true,
});
// result.Items: [{ Name: "user#123", Attributes: [...] }, ...]

Select with a Where Clause

const result = yield* select({
SelectExpression: (domain) =>
`select * from \`${domain}\` where plan = 'pro'`,
});