Can I Identify the IAM Role Used to Access an API Gateway Endpoint?
Asked by
CuriousCoder42
I'm curious if there's a way to retrieve the IAM role that was used when accessing an API Gateway endpoint that has IAM authorization enabled. Specifically, I want to know if this role information can be passed along to my backend application so it can execute different logic based on the role. Just to clarify, I'm working with API Gateway version 2 that uses HTTP proxy.
Answers
You can reference the IAM role in API Gateway v2 using mapping templates to extract relevant information! Check the documentation for mapping variables; while it may seem like it's more focused on REST APIs, trying out your specific setup could yield results.
Reply to this answer
Add your answer
Answers are reviewed before publication.
DataDude99: Just a heads up, you'd need to ensure your configurations are set correctly for HTTP proxy, as some details might not directly apply.