I am trying to provision Lambda and API Gateway using CloudFormation template and trying to invoke Lambda in one of the method, but getting issue like function arn is invalid. Please provide some resolution on this
{
"AWSTemplateFormatVersion":"2010-09-09",
"Transform":"AWS::Serverless-2016-10-31",
"Description":"Testing.",
"Parameters":{
},
"Conditions":{
},
"Resources":{
"AspNetCoreFunction":{
"Type":"AWS::Serverless::Function",
"Properties":{
"Handler":"<Handler_details>",
"Runtime":"dotnetcore3.1",
"CodeUri":"",
"MemorySize":256,
"Timeout":30,
"Role":"$Function_Role",
"Policies":null,
}
},
"gateway":{
"Type":"AWS::ApiGateway::RestApi",
"Properties":{
"Name":"Test",
"Description":"Testing",
"ApiKeySourceType":"HEADER",
"EndpointConfiguration":{
"Types":[
"REGIONAL"
]
}
}
},
"ApiMethod":{
"Type":"AWS::ApiGateway::Method",
"Properties":{
"RestApiId":{
"Ref":"gateway"
},
"HttpMethod":"ANY",
"AuthorizationType":"NONE",
"Integration":{
"IntegrationHttpMethod":"POST",
"TimeoutInMillis":29000,
"Type":"AWS_PROXY",
"Uri":{
"Fn::Sub":[
"arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${lambdaArn}/invocations",
{
"lambdaArn":{
"Fn::GetAtt":[
"AspNetCoreFunction",
"Arn"
]
}
}
]
}
}
}
}
}
I have tried to use below uri, behalf above uri which is mentioned in above code, but still having same issue.
"uri": "Fn::Sub":["arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/${AspNetCoreFunction.Arn}/invocations"]