Set Alternate domain name on cloudFront event

Hi,

I have a React application on AWS S3 managed by CloudFront.

I want to generate a dynamic sitemap using lambda edge function, I tried to do it with serverless but on new deploy the manual configuration is override and I do not know how to configure it in serverless.yml

This is my serverless.yml

service: app

provider:
  name: aws
  runtime: nodejs14.x
  environment:
    STAGE: ${opt:stage, self:provider.stage}

custom:
  stage: ${opt:stage, self:provider.stage}
  funcsPerStage:
    staging:
      auth:
        handler: handler
        events:
          - cloudFront:
              eventType: viewer-request
              origin: s3://xxx.s3.amazonaws.com/front/staging

functions: ${self:custom.funcsPerStage.${self:custom.stage}}

The deployment is working fine, but I need to set up

  • Alternate domain name
  • Custom SSL certificate
  • Default root object
  • Error pages

How can I do it with my serverless configuration ?

Thanks

I have having the same issue. Did you figure this out? I am thinking that I can do the initial deploy via sls deploy, then update the settings I need manually within the console. If I need to update my function in the future, I’ll limit the scope of my deployment to just the function code…