- Newest
- Most votes
- Most comments
Out of the box, the customJWTAuthorizer expects one discovery URL and one issuer, which does not fit a scenario where each tenant has its own JWTs (often HS256, no JWKS endpoint, no shared secrets in AWS).
https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html
Short answer: You can't get the runtime to validate those JWTs directly — and under your constraints you don't need it to. Keep JWT validation in each tenant's backend, and let the backends call the one runtime with IAM.
Why customJWTAuthorizer can't do it: a runtime takes one inbound auth configuration — either SigV4 or CUSTOM_JWT, not both. CUSTOM_JWT takes a single OIDC discovery URL and validates tokens against the JWKS it publishes. That rules out HS256 tokens with no discovery endpoint, and it rules out N issuers on one runtime. It also has no tenant registry, so tenant enable/disable has to live somewhere else anyway.
Pattern that fits your constraints:
- Browser → tenant backend, exactly as today. The frontend token, the login flow, and the signing keys don't change, and no secret is copied anywhere.
- The tenant backend validates its own JWT locally. It issued the token, so it's the only party that can verify an HS256 signature without the secret leaving the tenant.
- The backend calls
InvokeAgentRuntimewith SigV4, using a dedicated IAM role per tenant backend, scoped to invoking that single runtime. Tenant identity now comes from the verified AWS caller, not from a claim the client controls. - Pass the user ID in the invocation payload. In the agent, namespace Memory with
actorId= the user and a session ID namespaced per tenant + user, and apply a per-tenant metadata filter on Knowledge Base retrieval, so memory, KB results, and logs stay isolated. - Tenant on/off: keep an allowlist (a DynamoDB table works) checked in the call path. Disabling a tenant is a config flip — nothing redeploys.
One trade-off to accept: with IAM inbound auth, user identity is asserted by the backend rather than verified by AgentCore, which is why scoping each tenant role to the one runtime matters. I use the same per-agent scoped-role approach in my own work: https://doi.org/10.5281/zenodo.23420912
answered 20 days ago
The IAM-based backend-to-runtime architecture proposed above is a good fit for this scenario. I would add a few security controls before considering it production-ready.
1. Establish a trusted user identity
The tenant backend should validate the existing application JWT and derive the user identity from its verified subject (sub) claim.
Never accept a user ID or tenant ID supplied independently by the browser as the source of authorization.
Amazon Bedrock AgentCore also supports user identity delegation through the X-Amzn-Bedrock-AgentCore-Runtime-User-Id header and the bedrock-agentcore:InvokeAgentRuntimeForUser permission.
This can improve user-level identity propagation and auditing. The backend must still ensure that the delegated user ID corresponds to the authenticated application user.
2. Derive tenant identity from the authenticated caller
Use a dedicated IAM role for each tenant backend, with permission scoped to the intended AgentCore Runtime.
The runtime should maintain a trusted mapping between the authenticated IAM principal and its tenant identifier.
Do not derive tenant identity exclusively from the invocation payload.
3. Enforce isolation at every data access boundary
For AgentCore Memory:
- Use a tenant-aware actor identifier.
- Namespace session IDs using tenant and user identifiers.
- Prevent users from accessing sessions belonging to other tenants.
For Knowledge Base retrieval:
- Apply tenant-specific metadata filters.
- Derive the filter from trusted backend identity.
- Enforce the filter inside the retrieval tool rather than relying on the agent prompt.
4. Treat observability as a separate isolation requirement
A shared runtime may produce centralized CloudWatch logs. Memory isolation does not automatically provide log isolation.
Include tenant ID, user ID, authenticated IAM principal, session ID, and authorization decision in structured audit events.
Apply appropriate IAM permissions and retention controls to prevent unauthorized access to another tenant's audit data.
5. Make tenant onboarding and offboarding dynamic
Maintain a tenant registry, for example in DynamoDB, containing:
- Tenant identifier
- IAM role or principal mapping
- Enabled/disabled status
- Allowed resources and configuration
Check the tenant status before every invocation. Disabling a tenant should immediately prevent new requests, without requiring a runtime redeployment.
Overall, I would use three independent security boundaries: backend authentication, IAM-based runtime invocation, and tenant-aware authorization at every data access point.
This provides defense in depth while allowing tenants to retain ownership of their existing identity systems.
answered 9 days ago
Relevant content
asked a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 8 months ago
