You need to configure serverless output to get api gateway api id
I have a server-side project that builds APIs APIs. One of the functions in the project should generate the API endpoint url.
My plan is to get the API id using the resource output in serverless.yml, then create the url and pass it to the lambda function as an env parameter.
My problem / question is how to get the API id as cloud education output in serverless.yml?
I tried:
resources:
Outputs:
RESTApiId:
Description: The id of the API created in the API gateway
Value:
Ref: name-of-api
but this gives an error:
The CloudFormation template is invalid: Unresolved resource dependencies [name-of-api] in the Outputs block of the template
+3
source to share
1 answer
The serverless framework has a documentation page on how they generate resource names.
See AWS CloudSormation Resource Reference
Thus, the generated RestAPI resource is named ApiGatewayRestApi
.
-1
source to share