Skip to content

Tenant

Source: src/AWS/SES/Tenant.ts

An Amazon SES v2 tenant — a logical container that groups related SES resources (email identities, configuration sets, templates) together, each with its own reputation metrics, sending status, and optional tenant-scoped suppression list. Useful for isolating email sending across customers or business units within a single SES account.

Associate resources with a tenant using SES.TenantResourceAssociation. Deleting the tenant removes its resource associations but leaves the underlying resources in place.

Basic Tenant

import * as SES from "alchemy/AWS/SES";
const tenant = yield* SES.Tenant("CustomerA", {});

Tenant with a Scoped Suppression List

// SES requires the reasons and the scope together, so they travel as one
// prop rather than two independently-optional ones.
const tenant = yield* SES.Tenant("CustomerA", {
suppression: { reasons: ["BOUNCE", "COMPLAINT"], scope: "TENANT" },
});

Tenant with Tags

const tenant = yield* SES.Tenant("CustomerA", {
tags: { Customer: "acme", CostCenter: "growth" },
});
const tenant = yield* SES.Tenant("CustomerA", {});
const identity = yield* SES.EmailIdentity("Sender", {
emailIdentity: "mail.acme.example.com",
});
const configSet = yield* SES.ConfigurationSet("AcmeTracking", {});
// A resource must be associated before the tenant can send with it.
yield* SES.TenantResourceAssociation("AcmeIdentity", {
tenantName: tenant.tenantName,
resourceArn: identity.identityArn,
});
yield* SES.TenantResourceAssociation("AcmeConfigSet", {
tenantName: tenant.tenantName,
resourceArn: configSet.configurationSetArn,
});
// With scope "TENANT" the list is separate from the account's.
const tenant = yield* SES.Tenant("CustomerA", {
suppression: { reasons: ["BOUNCE", "COMPLAINT"], scope: "TENANT" },
});
// init — account-level bindings, scoped per call via TenantName
const suppress = yield* SES.PutSuppressedDestination();
const listSuppressed = yield* SES.ListSuppressedDestinations();
// runtime
yield* suppress({
EmailAddress: "hard-bounce@example.com",
Reason: "BOUNCE",
TenantName: yield* tenant.tenantName,
});
const { SuppressedDestinationSummaries } = yield* listSuppressed({
TenantName: yield* tenant.tenantName,
});