{"id":23405,"library":"cdk-serverless-clamscan","title":"cdk-serverless-clamscan","description":"An AWS CDK construct library that provides a serverless architecture to scan objects in Amazon S3 for viruses using ClamAV. Current version 2.13.47, requires Python ~=3.9. Development is active with frequent releases (multiple per week).","status":"active","version":"2.13.47","language":"python","source_language":"en","source_url":"https://github.com/awslabs/cdk-serverless-clamscan","tags":["cdk","aws","clamav","serverless","s3","virus-scanning"],"install":[{"cmd":"pip install cdk-serverless-clamscan","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"The construct extends CDK constructs and requires CDK to deploy.","package":"aws-cdk-lib","optional":false}],"imports":[{"note":"The package name uses underscores, not hyphens. Also, it's not a submodule of cdk.","wrong":"from cdk.serverless.clamscan import ClamScan","symbol":"ClamScan","correct":"from cdk_serverless_clamscan import ClamScan"},{"note":"ClamScanProps is exported at the top level, not a nested module.","wrong":"from cdk_serverless_clamscan.clamscan import ClamScanProps","symbol":"ClamScanProps","correct":"from cdk_serverless_clamscan import ClamScanProps"}],"quickstart":{"code":"from constructs import Construct\nfrom aws_cdk import Stack\nfrom cdk_serverless_clamscan import ClamScan, ClamScanProps\n\nclass ScanStack(Stack):\n    def __init__(self, scope: Construct, id: str, **kwargs):\n        super().__init__(scope, id, **kwargs)\n        ClamScan(\n            self,\n            'ClamScan',\n            props=ClamScanProps(\n                definition_pipeline_schedule='rate(1 hour)'\n            )\n        )","lang":"python","description":"Deploys the serverless ClamAV scanning infrastructure in a CDK stack."},"warnings":[{"fix":"Use ClamScan(self, 'Id', props=ClamScanProps(...)).","message":"Constructor signature changed in v2.0.0: 'ClamScanProps' is now passed as 'props' keyword argument, not as positional dict.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Pass an existing role via 'scan_role_arn' in ClamScanProps.","message":"In v2, the 'scan_role_arn' property is no longer automatically created; you must supply a role with appropriate IAM permissions if you need custom scanning roles.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Set ClamScanProps(add_event_notifications=False) and manually add the S3 notification.","message":"The construct automatically attaches to S3 buckets via S3 Event Notifications. If you already have event notifications on the bucket, you must explicitly set 'add_event_notifications: False' in ClamScanProps to avoid duplication.","severity":"gotcha","affected_versions":"all"},{"fix":"Always specify definition_pipeline_schedule as a rate or cron expression, e.g., 'rate(1 hour)'.","message":"The ClamAV virus definitions update pipeline requires 'definition_pipeline_schedule' - if omitted, it defaults to no schedule and definitions might become stale.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to latest: pip install --upgrade cdk-serverless-clamscan. In v2, the class is 'ClamScan'.","cause":"Installed an older version (<2.0.0) where the main class was named differently (e.g., 'ClamScanner') or the import path differs.","error":"AttributeError: module 'cdk_serverless_clamscan' has no attribute 'ClamScan'"},{"fix":"Wrap the props dict in ClamScanProps(...). For example, ClamScan(self, 'Scan', props=ClamScanProps(...)).","cause":"Passing a dict directly to the construct instead of ClamScanProps object.","error":"jsii.errors.JSIIError: Expected object reference, got undefined"},{"fix":"Either set add_event_notifications=True (default) or provide a valid IAM role ARN via scan_role_arn.","cause":"When disabling automatic event notifications, a custom role must be provided for the scanning Lambda.","error":"ValueError: The 'scan_role_arn' property is required when 'add_event_notifications' is False"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}