serverless-s3-sync just specifc folders to s3

Viewed 774

I am currently using the serverless-s3-sync plugin for syncing my local directory into an S3 Bucket.

My code in the serverless.yml looks like this:

custom:
  s3Sync:
    - bucketName: mydestintationBucket
      localDir: .
      acl: public-read

My problem is I don't want to sync the whole directory to the S3 bucket. Is there a way to define just specific folders/files for sync to S3, or is there a better/other way to do so (e.g. another plugin)?

1 Answers

With the current version 1.10.6 you can't link files explicitely. You can however add (multiple) directories.

custom:
  s3Sync:
    - bucketName: mydestintationBucket
      prefix: folderA
      localDir: ./folderA
    - bucketName: mydestintationBucket
      prefix: folderB
      localDir: ./folderB

This will ignore all the files from folderC or the other files from ..

Related