awslabs / cdk-serverless-clamscan

Apache License 2.0
243 stars 67 forks source link

Is it possible to add multiple buckets to the same ServerlessClamscan? #1244

Closed namila-perera closed 4 months ago

namila-perera commented 5 months ago

I am trying to add multiple buckets to the same scanner, but scanning only works in a single bucket. Should I create two scanners in case I want to scan two buckets?

    const bucketArnList = this.getBucketArnList();
    let buckets: cdk.aws_s3.IBucket[] =[];
    bucketArnList.forEach((bucket_arn: string) => {
        const bucket_name = bucket_arn.replace('arn:aws:s3:::','');
        const source_bucket = Bucket.fromBucketArn(this, bucket_name, bucket_arn);
        buckets.push(source_bucket);
    });

    const scanner = new ServerlessClamscan(this, 'antimalware-scanner',
      {
          acceptResponsibilityForUsingImportedBucket:true,
          buckets: buckets
      }
  );
dontirun commented 5 months ago

You should be able to do this with 1 instance of ServerlessClamscan.

namila-perera commented 5 months ago

I destroyed the whole stack and redeployed it.. and it started working on both buckets :) Thanks a lot!