Skip to content

TenantResourceAssociation

Source: src/AWS/SES/TenantResourceAssociation.ts

An association between an Amazon SES v2 tenant and a resource — an email identity, configuration set, or email template. Once associated, the resource can be used when sending email on behalf of the tenant. A single resource can be associated with multiple tenants.

This is an existence-only link with no mutable properties: changing either the tenant or the resource replaces the association.

Associate an Email Identity with a Tenant

import * as SES from "alchemy/AWS/SES";
const tenant = yield* SES.Tenant("CustomerA", {});
const identity = yield* SES.EmailIdentity("Sender", {
emailIdentity: "sender@example.com",
});
const association = yield* SES.TenantResourceAssociation("SenderLink", {
tenantName: tenant.tenantName,
resourceArn: identity.identityArn,
});

Associate a Configuration Set

const configSet = yield* SES.ConfigurationSet("AcmeTracking", {});
yield* SES.TenantResourceAssociation("ConfigSetLink", {
tenantName: tenant.tenantName,
resourceArn: configSet.configurationSetArn,
});

Associate an Email Template

const template = yield* SES.EmailTemplate("Welcome", {
subject: "Welcome, {{name}}!",
text: "Thanks for signing up, {{name}}.",
});
yield* SES.TenantResourceAssociation("TemplateLink", {
tenantName: tenant.tenantName,
resourceArn: template.templateArn,
});

Share One Identity Across Two Tenants

// A resource can belong to any number of tenants.
const acme = yield* SES.Tenant("Acme", {});
const globex = yield* SES.Tenant("Globex", {});
yield* SES.TenantResourceAssociation("AcmeSender", {
tenantName: acme.tenantName,
resourceArn: identity.identityArn,
});
yield* SES.TenantResourceAssociation("GlobexSender", {
tenantName: globex.tenantName,
resourceArn: identity.identityArn,
});