I want to setup a custom domain with the serverless framework and AWS.
This is what I have in serverless.yml
service: chapiLabs-rest-api
plugins:
  - serverless-domain-manager
  - serverless-express
custom:
  customDomain:
    domainName: chapitime.chapilabs.com
    basePath: ''
    stage: ${self:provider.stage}
    certificateName: '*.chapilabs.com'
    createRoute53Record: true
package:
  exclude:
    - node_modules
  include:
    - dist
provider:
  name: aws
  runtime: nodejs8.10
webpackIncludeModules:
  forceInclude:
    - mysql
    - mysql2
    - sequelize
functions:
  get:
    handler: dist/get.get
    events:
      - http:
          path: v1/client/{id}
          method: get
          request:
            parameters:
              paths:
                id: true
  create:
    handler: dist/auth.auth
    events:
      - http:
          path: v1/auth
          method: post
I used this npm package as plugin: https://github.com/amplify-education/serverless-domain-manager
I added a certificate via DNS using CloudFlare

Then I made a deploy and got the next log.

In cloudflare I added a CNAME to add the ACM validation and another CNAME pointing cloudfront.

But the domain name is not working. Any ideas why? I didn't bought the domain in AWS.
After some deployments the cloudfront url changed and I didn't noticed. I just updated the CNAME record in CloudFlare and it started working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With