Reliably identify which EC2/tenant is calling in Lambda
retained text
I am trying to figure out how others implement per tenant identification within lambda (or other AWS services). I am running multiple lambdas behind an API Gateway with IAM auth, and in the request from my EC2 instances, I do have access to the instance id from the session portion of the ARN (assumed-role/role/i-xxxx), but it feels a bit sketchy parsing the instance id out of it and relying on it. I am aware of outbound identity federation, which does have the ec2 ID as a claim in the jwt, but it seems like this is more suited for external services auth. Also have to consider rate limits on the token endpoint, and other limitations with JWT auth on the api gateway (only one issuer per endpoint)
document fetched 2026-11-11 00:38 · canonical https://reddit.com/r/aws/comments/1xsyir1/reliably_identify_which_ec2tenant_is_calling_in