AWS.SimpleDB reference
BatchDeleteAttributes
Section titled “BatchDeleteAttributes”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.
BatchDeleteAttributes: Deleting Items
Section titled “BatchDeleteAttributes: Deleting Items”const batchDeleteAttributes = yield* AWS.SimpleDB.BatchDeleteAttributes(domain);
yield* batchDeleteAttributes({ Items: [{ ItemName: "user#1" }, { ItemName: "user#2" }],});BatchPutAttributes
Section titled “BatchPutAttributes”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.
BatchPutAttributes: Writing Items
Section titled “BatchPutAttributes: Writing Items”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 }], }, ],});DeleteAttributes
Section titled “DeleteAttributes”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.
DeleteAttributes: Deleting Items
Section titled “DeleteAttributes: Deleting Items”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" }],});Domain
Section titled “Domain”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.
Domain: Creating Domains
Section titled “Domain: Creating Domains”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",});DomainMetadata
Section titled “DomainMetadata”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.
DomainMetadata: Domain Introspection
Section titled “DomainMetadata: Domain Introspection”const domainMetadata = yield* AWS.SimpleDB.DomainMetadata(domain);
const metadata = yield* domainMetadata();// metadata.ItemCount, metadata.AttributeValueCount, ...GetAttributes
Section titled “GetAttributes”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.
GetAttributes: Reading Items
Section titled “GetAttributes: Reading Items”const getAttributes = yield* AWS.SimpleDB.GetAttributes(domain);
const response = yield* getAttributes({ ItemName: "user#123", ConsistentRead: true,});// response.Attributes: [{ Name: "email", Value: "a@b.com" }, ...]ListDomains
Section titled “ListDomains”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).
ListDomains: Domain Introspection
Section titled “ListDomains: Domain Introspection”// init — account-level binding, no resource argumentconst listDomains = yield* AWS.SimpleDB.ListDomains();
// runtimeconst page = yield* listDomains({ MaxNumberOfDomains: 100 });// page.DomainNames: ["users-shard-0", "users-shard-1", ...]PutAttributes
Section titled “PutAttributes”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.
PutAttributes: Writing Items
Section titled “PutAttributes: Writing Items”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 }, ],});Select
Section titled “Select”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: Querying Items
Section titled “Select: Querying Items”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'`,});