Q:

adding aliased lambda function in cognito pool trigger drop down selection

I have created a lambda function, published a version of it and pointed that version to an alias.
ARN for my lambda function:
"ARN - arn:aws:lambda:aws_region:aws_id:function:function_name:production".
So in cognito pool triggers, I need to assign this lambda function into "Custom message" section, but it's a drop down which populates lambda function without any aliased name. Problem is, how to assign the aliased version of the lambda function from drop down into the cognito pool triggers.

A:

You can use the AWS cli to create the pool and set the ARN of the aliased Lambda.
create-user-pool
    --pool-name my-pool
    --lambda-config CustomMessage=arn:aws:lambda:aws_region:aws_id:function:function_name:production

If the pool is already created:
update-user-pool
    --user-pool-id <pool-id>
    --lambda-config CustomMessage=arn:aws:lambda:aws_region:aws_id:function:function_name:production

A:

Expanding on @alexis-n-o answer, you will very likely need to grant cognito permission to invoke the aliased lambda function.  The console does this for you automatically.
Create or update pool
create-user-pool
    --pool-name my-pool
    --lambda-config CustomMessage=arn:aws:lambda:aws_region:aws_id:function:function_name:production

update-user-pool
    --user-pool-id <pool-id>
    --lambda-config CustomMessage=arn:aws:lambda:aws_region:aws_id:function:function_name:production

Assign cognito permission to invoke the lambda:
aws lambda add-permission 
--function-name arn:aws:lambda:<lambda-region>:<account>:function:<lambda-name>:<alias-name> 
--source-arn <user-pool-arn> 
--action lambda:* 
--statement-id <your-statement-id-here> 
--principal cognito-idp.amazonaws.com

