AWS: specify Lambda version for Cognito trigger

大城市里の小女人 提交于 2020-05-02 04:05:14

问题


I have a Cognito User Pool and corresponding a Identity pool.

I want to call a specific version of my Lambda function on Post authentication or some other trigger like that.

I don't see an option to specify a version code in the Console although the examples all have a version number.

http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html

{
    "version": number,
    "triggerSource": "string",
    "region": AWSRegion,
    "userPoolId": "string",
    ...
}

How do I specify the version of the lambda function?


回答1:


Cognito, always uses the latest version or whatever is the default version provided by lambda.

The version that you are referring in the documentation is the event version number. In case in the future Cognito introduces a breaking change to the format of the request you can protect your code from breaking by checking this version number.




回答2:


Actually it is possible updating user pool trigger configuration with AWS CLI using Lambda arn that includes alias, like

aws cognito-idp update-user-pool --user-pool-id _awsregion_id_ --lambda-config PostAuthentication=arn:aws:lambda:_awsregion_:_awsid_:function:_functionname_:_alias_


来源:https://stackoverflow.com/questions/46477594/aws-specify-lambda-version-for-cognito-trigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!