Amazon Q via SDK Best Practices
Data-source scoping and access-control hygiene for enterprise Q&A.
Busca en todas las páginas de la documentación
Data-source scoping and access-control hygiene for enterprise Q&A.
This is the checklist to work through before and after putting Amazon Q into production - mostly Q Business, since it is the SDK-driven half of the family, with a closing group on where Q Developer fits. Each item is a rule stated positively with a one-line rationale, grouped from setup outward through chat, access control, reliability, and security.
CreateApplication, CreateIndex, and sync jobs are asynchronous; don't assume a resource is ready just because the create call returned.metrics, not just status. A SUCCEEDED sync with an unexpectedly low document count can still signal a misconfigured connector.ChatSync for backend integrations. Reach for the streaming chat operation only when a live UI genuinely benefits from incremental output.conversationId/parentMessageId from the prior response on follow-up turns; omit both to start fresh.sourceAttributions. Users should be able to see which documents grounded an answer, both for trust and for catching stale content.authConfiguration - they authenticate to different systems.ACTIVE before relying on it. A plugin still provisioning won't be invoked by chat even if referenced.Log the fields you'll need to debug a chat integration in production.
# --- Python (boto3) ---
resp = qbiz.chat_sync(applicationId=application_id, userMessage="What's our PTO policy?")
print("conversation:", resp["conversationId"], "| message:", resp["systemMessageId"])
print("sources:", [a.get("title") for a in resp.get("sourceAttributions", [])])// --- TypeScript (AWS SDK v3) ---
const resp = await qbiz.send(new ChatSyncCommand({ applicationId, userMessage: "What's our PTO policy?" }));
console.log("conversation:", resp.conversationId, "| message:", resp.systemMessageId);
console.log("sources:", (resp.sourceAttributions ?? []).map((a) => a.title));PutGroup/PutUser in sync with your org. Re-run mappings on a schedule or on identity-system change events, not just once at setup.qbusiness calls, same as any other AWS service client.capacityConfiguration.units and raise it only when volume or latency demands it.DeleteApplication/DeleteIndex.qbusiness:* actions. Scope create/chat/admin permissions to the roles that actually need them, not broadly to every workload.PutGroup/PutUser changes. Access-mapping changes are security-relevant events and should be tracked like any other permission change.qbusiness; plan for IDE plugin, CLI, and CI/CD integration instead.Polling for a terminal status after every async operation - application, index, and sync creation - before assuming the next step can proceed.
Always surface sourceAttributions so users can see which documents an answer drew from, and thread conversations correctly so follow-ups have real context.
No. It depends on your connector crawling ACLs from the source and you mapping Identity Center groups/users to that data with PutGroup/PutUser.
Access control decides which documents can inform an answer; Guardrails decide what the response is allowed to say, applied uniformly to every user. Use both together.
Only the reliability/security mindset carries over. Q Developer doesn't expose the qbusiness-style SDK surface most of this checklist assumes - its rules live in IDE/CLI/CI hygiene instead.
On a schedule matched to how often the source actually changes - not more, since every sync costs time and index processing.
qbusiness:ChatSync (or the streaming equivalent) scoped to the specific application, separate from the create/admin permissions used during setup.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+).
Revisado por Chris St. John·Última actualización: 25 jul 2026