Once you have deployed your Serverless project and you start hiding deployments in CI pipelines etc, it is easy to forget the URL's to your API's (after all they are not very memorable!).
Added to that if you need to completely re-deploy your stack your API urls will change. This article describes how to find out what your urls are. It is also possible to use a custom url for your API, but this does add the complexity of managing SSL certificates. For more info on this see this article on how to add a custom url.
Once you are ready to deploy the function, you can simply run:
serverless deploy -v
This will give you an output with Service information
, which will contain endpoints
list. Example:
Service Information
service: serverless-hello-world
stage: dev
region: us-east-1
api keys:
None
endpoints:
GET - https://qewroweire.execute-api.us-east-1.amazonaws.com/dev/hello-world
GET - https://qewroweire.execute-api.us-east-1.amazonaws.com/dev/hello-world2
functions:
helloWorld: serverless-hello-world-dev-helloWorld
helloWorld2: serverless-hello-world-dev-helloWorld2
Serverless uses CloudFormation to manage your stack.
CloudFormation
in the region where you deployed your function or functions.serverless-hello-world-dev
.ServiceEndpoint
. In our case it's https://qewroweire.execute-api.us-east-1.amazonaws.com/dev
You can also see information on your api from the API gateway service dashboard page:
e.g.
The Serverless will use CloudFormation stack url and append the function name to generate the url for each lambda function. For example, hello-world
function will reside at https://xwynzpjjlc.execute-api.us-east-1.amazonaws.com/dev/hello-world
xwynzpjjlc
in our case is a AWS generated ID of our stack.us-east-1
AWS region where the function is hosted.dev
is a stage (or you can call it environment). For example it could be production
or staging
hello-world
endpoint url.Further reading: