Search code examples
amazon-web-servicesdnsamazon-cloudfrontaws-api-gateway

How can I create an AWS API Gateway custom domain to a domain which is already used in a CloudFront distibution with any downtime?


I'm trying to switch my site, which is currently CloudFront and Elastic Beanstalk, to API Gateway.

When I try to create the Custom Domain in API Gateway I get a message that there is already a CloudFront distribution for that domain, which is true. But if I remove that distribution my site will be down until the new distribution (for the API Gateway) will be up.

Is there anyway I can swap these or something ?

I do have control over the DNS records.


Solution

  • The solution that worked in the end :

    1. Change the DNS to point directly at Elastic Beanstalk
    2. Disable & Delete the original CloudFront distribution
    3. Create a 'Custom Domain' in APIG (this also creates a CloudFront dist.)
    4. Change the DNS to point at the new CloudFront dist. (you get the URL in the APIG console under Custom Domains)

    Each of these steps takes a little time ... but there is no downtime.