问题描述
我已经使用AWS API Gateway前端成功配置了对我的Lambda函数的IAM身份验证访问,但是无法找到如何将IAM用户身份传递给我的Lambda函数.
I've successfully configured IAM-authenticated access to my Lambda function with AWS API Gateway front-end, but unable to find how to pass IAM user identity to my Lambda function.
我完全需要IAM用户身份,并且无法在调用IAM用户凭据的情况下运行Lambda函数.我需要的只是在Lambda函数中调用IAM用户身份.
I need exactly IAM user identity and can not run Lambda function under calling IAM-user credentials.All I need - is to get calling IAM-user identity in my Lambda function.
可以选择吗?
推荐答案
支持从当您发布问题时,Amazon API Gateway 请求上下文尚不可用,但最近已添加,请参阅公告:上下文变量:
Support for accessing identity and other information from the Amazon API Gateway request context hadn't been available when you posted the question, but recently been added, see Announcement: Context Variables:
访问$ context变量具有$context Variable Reference
,并且有许多$context.identity.*
参数可以解决您的用例.
The referenced documentation on Accessing the $context Variable features a $context Variable Reference
and there are various $context.identity.*
parameters that should address your use case.
如Soenke对OP的答复中所述,类似Amazon API中的问题网关论坛,目前尚未提供 integration 参数,导致Cognito标识符包含在此$context.identity.*
上下文变量中:
As outlined in Soenke's answer to the OPs similar question in the Amazon API Gateway forum, there is an as of yet undocumented integration parameter that results in the Cognito identifier being included in this $context.identity.*
context variables:
这篇关于AWS API网关:如何将IAM身份传递给Lambda函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!