fbpx

Environment Domain Aliases

Environment Domain Aliases will replace the default domain of all Functions in your environment. Once the Domain Alias is set up, you will be able to use your own custom domain in order to trigger your Functions.

Set DNS Record

First, create a DNS record set that points to your environment URL. Your environment URL can be found in the Spotinst console. For example:

https://app-123xyz-raffleapp-execute-function1.spotinst.io/fx-abc987

The Domain Alias will only replace the URL starting with ‘app’ and ending at ‘/’. Like this:

app-123xyz-raffleapp-execute-function1.spotinst.io

With this, go to a DNS record setter and point your domain to this URL.

Set Alias

Next, you will need to set the alias in your Spotinst environment. This does not need to be done within a function and can be set any way you are most comfortable.

Create Using the console:

1. Navigate to the Endpoints section under your environment:

2. Click ‘Edit’ and enter your Domain Alias

Create Using the API:

The API request is connecting your domain the environment that you want. This is the API request

HTTPS Request 

POST alias?accountId=${accountId}

Host

api.spotinst.io/functions/ 

Body

{
  "alias": {
    "host": "myAlias.com",
    "environmentId": ${Your Environment ID}
  }
}

Headers

Authorization: Bearer ${Spotinst API Token}
Content-Type: application/json
Note: You are able to connect multiple aliases to the same environment