# Custom domain and APIG

**URL:** <https://forum.serverless.com/t/custom-domain-and-apig/296>\
**Category:** Serverless Framework\
**Created:** [September 14, 2016, 10:26am UTC](https://forum.serverless.com/t/custom-domain-and-apig/296 "2016-09-14T10:26:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![petteri](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@petteri](https://forum.serverless.com/u/petteri)\
**Post date:** [September 14, 2016, 10:26am UTC](https://forum.serverless.com/t/custom-domain-and-apig/296/1 "2016-09-14T10:26:26Z")

</div>

What is the correct way to create custom API mapping? It looks like if I map the domain in AWS UI, sls remove will fail as it’s not able to remove APIG resource. I probably should define the custom domain in serverless.yml but how?

DELETE\_FAILED AWS::ApiGateway::RestApi ApiGatewayRestApi Deleting RestApi xxx failed. Please remove all base path mappings related to the RestApi in your domains: xxx

---

<div class="post-metadata">

**Author:** ![flomotlik](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/flomotlik/32/3_2.png) [@flomotlik](https://forum.serverless.com/u/flomotlik)\
**Post date:** [September 17, 2016, 1:46pm UTC](https://forum.serverless.com/t/custom-domain-and-apig/296/2 "2016-09-17T13:46:08Z")

</div>

@petteri custom APIG domain names are something that isn’t natively supported in the framework yet, but an important feature going forward.

---

<div class="post-metadata">

**Author:** ![AnalogJ](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/analogj/32/277_2.png) [@AnalogJ](https://forum.serverless.com/u/AnalogJ)\
**Post date:** [November 8, 2016, 6:08pm UTC](https://forum.serverless.com/t/custom-domain-and-apig/296/3 "2016-11-08T18:08:25Z")

</div>

I wrote a custom script that automates custom domain setup with APIG, however it won’t help you with your deletion issue.

> **[Sparktree - Custom Domains for AWS Lambda/API Gateway using Letsencrypt](https://blog.thesparktree.com/post/152904762374/custom-domains-for-aws-lambdaapi-gateway-using)**
>
> AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume - there is no charge when...
