I am a newbie to AWS Lambda Services. I have created a serverless lambda method and successfully deployed it on the AWS cloud.
Next I created a Lambda custom Authorizer and configured the API Gateway for the Lambda method and custom Authorizer.
As, I need to expose many other server less lambda methods therefore I decided to move my lambda method in a serverless .Net API Project. I can deploy this api project to AWS cloud and then manually I can setup the authorizer to use my custom Authorize lambda method.
The struggling part is, I want to configure all these things through serverless.template file.
I am struggling in getting the RESTAPIID for my custom authorizer method and how to set authorizer for my lambda function using the serverless.template file. Below is the configurations I have done. Also, how to get AuthorizerUri?
I do not want to hard code any thing.
"Resources" : {
**//How I can create this serverless function to use my custom authorizer?**
"Create" : {
"Type" : "AWS::Serverless::Function",
"Properties": {
"Handler": "Osn.Ott.Telco.Connector.UI.Web.Controllers.V10::Osn.Ott.Telco.Connector.UI.Web.Controllers.V10.SubscriptionController::Create",
"Runtime": "dotnetcore2.1",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"FunctionName" : "CreateCustomer",
"Policies": [ "AWSLambdaBasicExecutionRole" ],
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/create",
"Method": "POST"
}
}
}
}
},
"CustomAuthorizer" : {
"Type" : "AWS::ApiGateway::Authorizer",
"Properties" : {
"AuthorizerUri" : {"Fn::GetAtt" : [ "Create", "Arn"]},
"IdentitySource" : "method.request.header.Authorization,method.request.context.resourcePath, method.request.context.path",
"Name" : "CustomAuthorizer",
"Type" : "REQUEST",
**//How I can get this id?**
"RestApiId" : {"Fn::GetAtt" : [ "ServerlessRespApi", ""]}
}
}
}