woodpav
woodpav

Reputation: 2027

AWS: specify Lambda version for Cognito trigger

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?

Upvotes: 2

Views: 1700

Answers (2)

alessio
alessio

Reputation: 189

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_

Upvotes: 1

Vasileios Lekakis
Vasileios Lekakis

Reputation: 5572

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.

Upvotes: 2

Related Questions