Is it possible to set up a custom domain on the SS...
# help
a
Is it possible to set up a custom domain on the SST Api construct?
f
sst.Api
 construct uses HTTP API behind the scene. Try this: • create an ACM Certificate with DNS validation - https://docs.aws.amazon.com/cdk/api/latest/docs/aws-certificatemanager-readme.html#dns-validation • create an API Gateway DomainName - https://docs.aws.amazon.com/cdk/api/latest/docs/aws-apigatewayv2-readme.html#custom-domain
sst.Api
will have built-in support for custom domain later
a
Hmm, so I can create a new HttpApi, like this?
_const_ httpApi = new apig.HttpApi(this, 'HttpApi', {
defaultDomainMapping: ...
})
const api = new sst.Api(this, 'Api', {
httpApi: httpApi,
f
Oh no, if you use the
sst.Api
construct
Copy code
const api = new sst.Api(this, ...)
And
api.httpApi
gives you the created HttpApi
You don’t need to manually create the
apig.HttpApi
yourself
a
I must be missing something obvious but I'm having a hard time figuring out how to set the defaultDomainMapping on httpApi. Could you provide an example?
f
@Andreas My bad. I had another look at the HttpApi doc and
defaultDomainMapping
has to be passed in on create. So I was wrong. You can’t set the domain on top the HttpApi created by
sst.Api
You would have to create the HttpApi construct yourself.
What’s your timeline like? I can try adding custom domain support for
sst.Api
sometime this week.
a
Oh, that would be great. Thank you so much!
f
@Andreas Just release v0.9.7 with custom domain support for Api construct. Some examples here - https://docs.serverless-stack.com/constructs/Api#configuring-a-custom-domain To upgrade:
Copy code
$ npm install --save --save-exact @serverless-stack/cli@0.9.7 @serverless-stack/resources@0.9.7