来自 AWS 签名的 IAM 用户 ID?

IAM user id from AWS signature?

我已经将我的 api 网关配置为通过 IAM 进行授权并且工作正常。在我的后端应用程序 (nodejs/elasticbealstalk) 中,我想知道 aws 签名属于哪个用户,以便我可以实现条件逻辑。这可能吗?

我知道我可以使用 AWS SDK 解析访问令牌并调用列表用户(然后迭代直到找到匹配项)。有没有更好的方法?

这在 $context.identity.user 中可用,如 documentation. You can just pass this in the request payload by using a mapping template or pass it as a parameter as mentioned here

中所述