

Until now, whenever you create a web page or API backend that runs entirely on Spotinst Serverless, you’ve been working with a default URL: (https://{Application ID}-{Environment Name}-execute-function1.spotinst.io/{Function ID}).
While it still works well, it can get messy when you’re trying to remember what the function does, running external-facing web services, or trying to send a URL to a client.
Creating your own custom Spotinst Serverless Endpoint
Let’s use the above example as our URL.
Here’s how you can set one up:
First things first: Set up your domain
You’ll need to have your domain set up with a DSN.Create a CNAME reference within your DSN web service
Once you’ve created or located your DSN, you then you need to create aCNAME
reference under that domain that points to your function environment URL:
{App-d1ecaf45-mapreduce-execute-function1.spotinst.io}
Set up a domain alias for your environment
Once you set up your CNAME, Go to theSpotinst console
and go to theEndpoints tab
under the environment you want to link to.
Add your new custom domain URL to the domain alias section
- Create Endpoint paths to your functions
You then have to setIP paths
to the functions within your environment, again under the Spotinst console. Under the same tag, edit thefunction endpoints
by adding a Path. A Path is just a string that starts with“/” - “/home”
for example.
Then you need to select a method – GET, PUT, PATCH, POST, DELETE, OPTIONS, or ALL
. Then select the function that you want to map to that function path
, and your function is now connected to your new custom endpoint.
When you add a custom endpoint to your functions, the SSL certification will still be present on the function level, allowing you to maintain a secure connection to your application. However, because it is routed through a CNAME on a DNS server
, the connection is redirected causing a certificate name mismatch. But even so the endpoint remains secure.
Now you can send your application out to customers with a professional URL that is easy to remember any type into any web browser. Or even use as a REST API endpoint
for internal use within your company. The possibilities are endless.