# Custom domain name which is not controlled by current aws account

**URL:** <https://forum.serverless.com/t/custom-domain-name-which-is-not-controlled-by-current-aws-account/4528>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [May 17, 2018, 11:40pm UTC](https://forum.serverless.com/t/custom-domain-name-which-is-not-controlled-by-current-aws-account/4528 "2018-05-17T23:40:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/bill/32/1072_2.png) [@bill](https://forum.serverless.com/u/bill)\
**Post date:** [May 17, 2018, 11:40pm UTC](https://forum.serverless.com/t/custom-domain-name-which-is-not-controlled-by-current-aws-account/4528/1 "2018-05-17T23:40:43Z")

</div>

I deploy a serverless project in non-prod accounts, which used subdomain in the aws account, such as

```
api.dev.example.com
api.uat.example.com

```

now, I’d like to deploy it to a production aws account, with domain name `api.example.com`

But `example.com` is not in control of this aws account, what should I do?

---

<div class="post-metadata">

**Author:** ![jonsmirl](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jonsmirl/32/776_2.png) [@jonsmirl](https://forum.serverless.com/u/jonsmirl)\
**Post date:** [May 20, 2018, 1:30am UTC](https://forum.serverless.com/t/custom-domain-name-which-is-not-controlled-by-current-aws-account/4528/2 "2018-05-20T01:30:22Z")

</div>

Write the AWS domain out to a file during deploy. Then make a script to add a CNAME record at your non-Amazon domain provider which points to the AWS domain name.

I do this for dev too. We have a test domain and then then I make sub-domains off from it with each developer’s name. So [www.jim.testme.com](http://www.jim.testme.com) CNAME aws.url, [www.bill.testme.com](http://www.bill.testme.com) CNAME another aws url. Now each developer has an easy to remember URL to work with.

I have split my YAML into static and volatile files. I only run the static stuff about once a month. The static YAML file creates the AWS URLs and adds the CNAME records. There is a shell script that does the deploy, reads the output, and then fixes up the CNAMEs.

---

<div class="post-metadata">

**Author:** ![johntellsall](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/johntellsall/32/2060_2.png) [@johntellsall](https://forum.serverless.com/u/johntellsall)\
**Post date:** [June 7, 2018, 11:53pm UTC](https://forum.serverless.com/t/custom-domain-name-which-is-not-controlled-by-current-aws-account/4528/3 "2018-06-07T23:53:20Z")

</div>

hi everyone!

I’m in the same challenge: when I deploy, each environment is in its own AWS account, but there’s only one account which owns the Route53 (DNS) domain. Like @bill , when I deploy my “dev” Serverless Lambdas, I want them to appear in `dev.example.com`, where [example.com](http://example.com) is controlled by the Prod AWS account.

Partial solution:

- deploy Dev like normal, put a CNAME in the Prod account pointing to it (@jonsmirl 's solution)

This solution is simple. As a Dev I do my Serverless deploy, using my Dev account. It spits out a long URL, like [https://6dzyltptt3.execute-api.us-east-1.amazonaws.com](https://6dzyltptt3.execute-api.us-east-1.amazonaws.com). If I curl this domain, I get “hello world” like expected.

If I set up a CNAME in the Prod account, pointing to 6dzyltptt etc, it doesn’t work as expected. The certificate isn’t set up correctly:

> $ curl [https://6dzyltptt3.execute-api.us-east-1.amazonaws.com/development/hello](https://6dzyltptt3.execute-api.us-east-1.amazonaws.com/development/hello)  
> Hello, world! 23:37:52
> 
> $ curl [https://beer-dev.example.com/development/hello](https://beer-dev.example.com/development/hello)  
> curl: (35) error:14077410:SSL routines:SSL23\_GET\_SERVER\_HELLO:sslv3 alert handshake failure

I like the idea of having “static” and “dynamic” files!

Any ideas how we can get cross-account Serverless environments working?
