amazon-ses
設定 Amazon SES V2 以進行正式郵件發送——包括網域身分建立、DKIM/SPF/DMARC 驗證、一次性 DNS 記錄呈現,…
npx skills add https://github.com/aws/agent-toolkit-for-aws --skill amazon-sesAmazon SES
Overview
Recommended: Use the AWS MCP Server with SES permissions for sandboxed execution and CloudTrail audit logging. Without MCP: All operations use standard AWS CLI syntax (
aws sesv2 ...).
Takes a user who is not an email authentication expert from a new SES account to a complete default sending setup and an SES-accepted test message, and on request to a real inbox and production access. Read account and identity state first, complete only what is missing, and request production access only after domain setup is complete and the user consents.
Routing
| If the user wants to... | Read |
|---|---|
Set up email sending (including when the request says only "email", "AWS email", or "SES"), send a first or test email, leave the sandbox, resume onboarding, or diagnose MessageRejected: Email address is not verified | SES onboarding |
| Set up a domain choosing the authentication details yourself, configure email authentication, or troubleshoot DKIM | Setting up SES domain identity |
Guardrail — where this skill's own files live (MCP vs local install)
- Loaded through the AWS MCP
retrieve_skilltool: the skill is not on the local filesystem. You MUST fetch each reference viaretrieve_skillwith thefileparameter (e.g.file="references/onboarding.md"). Do NOTfile_readthese paths locally — they do not exist on disk. - Installed locally (e.g.
~/.kiro/skills/amazon-ses/,.kiro/skills/amazon-ses/, or~/.claude/skills/amazon-ses/): read files from the local skill directory using the relative paths above.
This applies only to the skill's own files. User data and session artifacts are always read from and written to the user's working directory — never fetch or write customer data through retrieve_skill.
Critical Rules
- MUST use the SES v2 API (
aws sesv2 ...), never v1aws ses ...: a v1 command gives no sign that it is the wrong API, and production-access requests plus DKIM and MAIL FROM in one identity read exist only in v2. - MUST NOT volunteer API mechanics, internal limit figures, or other plumbing. Explain only what the user must decide, consent to, pay for, or act on, unless they ask or a reference requires the disclosure.
- MUST ask for missing inputs in ONE question set, and only for inputs the requested scope
needs; if nothing is missing, ask nothing. A progress update such as "I'll create it next" is
not a stopping point: continue until the scope is complete or a conflict, service error,
timeout, or missing reference-owned consent blocks it. Ask setup questions once, upfront:
after the read-only discovery and before any write, put every missing input and the Route 53
permission (
CREATEonly the missing SES records in the named zone, nothing replaced or deleted) in one question; skip what the request already gave, and do not ask for it again; record collisions still need the user. The full journey keeps its separate consent for production access and for a real send. - MUST NOT ask for the AWS CLI profile or Region while either resolves. Honour
--profileonly if the user names one. Region order: user-named;AWS_REGION;AWS_DEFAULT_REGION;aws configure get region(with--profilewhen named; it does not read the environment). State the Region and theaws sts get-caller-identityaccount before any mutation. Ask only when no Region resolves, or when credentials fail (then ask which account and Region to use once refreshed), folded into the one question set. - MUST pass request payloads as inline JSON strings, never
file://paths, which do not resolve through the AWS MCP server. - MUST read state before each step and skip satisfied steps: never
create-email-identityan existing identity (AlreadyExistsException), and never re-runput-email-identity-dkim-signing-attributeswhenDkimAttributes.StatusisSUCCESS(it can change the tokens). Gate that recovery on status, not on whether CNAMEs resolve;setting-up-ses-domain-identity.mdowns it. - For domain setup, create a domain identity. Create an email-address identity only when the user explicitly chooses to verify that address.
Invariants
These hold everywhere; references may add step detail but never contradict or relax them.
- Domain setup complete means one
get-email-identityresponse showsVerifiedForSendingStatus: true,DkimAttributes.Status: SUCCESS, andMailFromAttributes.MailFromDomainStatus: SUCCESS. While MAIL FROM is unresolved, SES uses the fallback:USE_DEFAULT_VALUEsends from anamazonses.comsubdomain (SPF does not align, so DMARC needs DKIM), andREJECT_MESSAGEreturnsMailFromDomainNotVerifiedwithout delivery. - Sandbox recipient rule. While
ProductionAccessEnabledisfalse— whateverDetails.ReviewDetails.Statussays — you can only send to (1) an address verified as its own email identity, (2) the Amazon SES mailbox simulator, or (3) any address at any verified domain in the account. The restriction is on the recipient, not the sender; never work around it. When explaining it, name all three options in that numbering before proposing production access, and never say "each recipient must be individually verified". - The sender must be verified in every account state, so
MessageRejected: Email address is not verifiedcan mean an unpermitted sandbox recipient or an unverified sender; read the address in the error before choosing a fix. - DKIM
SUCCESSis this skill's bar, above the SES minimum of a verified sender: required before claiming setup or authentication complete and before sending. The default setup's simulatorMessageIdproves SES acceptance only. - Validate every substituted value, then quote it for its context. Single-quote a value
substituted into a shell command; JSON-encode a value inside inline JSON and single-quote only
the whole blob. Reject any value containing a quote, backtick,
$,;, backslash, or whitespace and ask again; never escape it into shape. Shapes:DOMAINand the MAIL FROM subdomain — DNS labels only, letters, digits, hyphens and dots; From and every recipient a single address with one@(several recipients go in theToAddressesarray);MAIL_TYPETRANSACTIONALorMARKETING;WEBSITE_URLanhttp(s)URL of 1–1000 characters, not necessarily at the domain;REGIONa Region code;PROFILEa profile name. JSON-encode subject and body text with a serializer.
IAM Permissions
Grant only the actions the workflow being run calls — never ses:* or *FullAccess. Each
reference lists its actions under Required IAM actions. Scope per-identity actions to
arn:aws:ses:{region}:{account-id}:identity/{domain} or .../identity/{address} for every
identity actually read, created, or sending; a send is authorized by the identity covering its
From address. Scope Route 53 zone actions to arn:aws:route53:::hostedzone/{bare_zone_id} (strip
the /hostedzone/ prefix). Only sts:GetCallerIdentity, ses:GetAccount,
ses:ListEmailIdentities, ses:ListConfigurationSets, route53:ListHostedZones,
route53:ListHostedZonesByName, route53:TestDNSAnswer and the account-level SES writes need
*. Grant ses:PutAccountDetails deliberately, only for a production-access request.
Security Considerations
- Ephemeral credentials. Use IAM roles with STS — never long-lived access keys.
- Consent gates. A production-access review, a real send, and a Route 53 change commit the user in ways no API can undo. Each gate is owned by the reference that performs the action; never pass one because this file summarizes it.
- Delivery TLS is opportunistic by default. The default configuration set uses
TlsPolicy: OPTIONAL: SES attempts TLS and may send without it when the receiver cannot establish it — an interoperability trade-off. Requiring TLS rejects mail to such receivers, so it is an explicit later decision the user makes. - Redact before sharing. Remove credentials, recipient addresses and message content from logs, CLI output or Support case text before quoting or sharing it.
- Never place message bodies or recipient lists in logs, and never hardcode credentials, endpoints, or secrets; keep application credentials in Secrets Manager or Parameter Store.
- Enable CloudTrail for SES API auditing, alarm on repeated
AccessDeniedExceptionand unusual send volume, and encrypt the trail and its CloudWatch Logs group with KMS — SES entries carry email addresses, domain names, and account details.