components icon indicating copy to clipboard operation
components copied to clipboard

alternative cloudfront domains wiped on each deploy

Open tomyates opened this issue 2 years ago • 2 comments

I have the following serverless.yaml:

component: website               # (required) name of the component. In that case, it's website.
name: sa-front                   # (required) name of your website component instance.
app: sa-front                    # (optional) serverless dashboard app. default is the same as the name property.
stage: dev                       # (optional) serverless dashboard stage. default is dev.

inputs:
  domain: uat.domainname.com   # (optional) domain name. this could also be a subdomain.
  region: eu-west-1              # (optional) aws region to deploy to. default is us-east-1.
  src:
    src: ./src
    hook: npm run build
    dist: ./build

When I run sls deploy it wipes any alternative domains I've added in cloudfront and I have to re-add them manually. Is there a way of setting this alternative domains in the serverless.yaml file?

tomyates avatar Aug 11 '21 12:08 tomyates

Anyone got any thoughts? Thinking I could write a script to add the cnames to cloudfront after sls deploy?

tomyates avatar Aug 12 '21 21:08 tomyates

Solved this issue by just creating a new CloudFront instance for all the alternative domains which pointed to the same s3 bucket.

tomyates avatar Aug 15 '21 21:08 tomyates