Created
February 18, 2016 22:29
-
-
Save sapessi/11a87ed83954461d5e43 to your computer and use it in GitHub Desktop.
Specify an API Gateway authorizer using a Lambda qualifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First we update the authorizer to call the right lambda function including the qualifier :xxx at the end of the function ARN | |
aws apigateway update-authorizer --rest-api-id XXXXXXXXX --authorizer-id XXXXX --patch-operations op=replace,path=/authorizerUri,value=arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:XXXXXXXXXXX:function:Authorize2:AliasOrVersion/invocations | |
# Then we give API Gateway permission to invoke the authorizer using resource policies on the Lambda function | |
aws lambda add-permission --function-name Authorize2 --statement-id mystatement12334 --action lambda:InvokeFunction --principal apigateway.amazonaws.com --qualifier AliasOrVersion --source-arn arn:aws:execute-api:us-west-2:XXXXXXXXXXX:XXApiIdXX/authorizers/XXAuthorizerIdXX | |
# You can check the structure of your authorizer with | |
aws apigateway get-authorizer --rest-api-id XXXXXX --authorizer-id XXXX | |
# You can also check the policy against the lambda function with | |
aws lambda get-policy --function-name Authorize2 --qualifier AliasOrVersiuon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Users, please refer to this corrected example for the first command (syntax corrected)
http://stackoverflow.com/questions/38469633/custom-authorizer-stages-configuration-values/38487226#38487226