The following example:
- Subscribes to the Findings Topic
- Stores scan results in DynamoDB
- Queries DynamoDB and extracts the scan result before generating a pre-signed URL for download.
- Create a DynamoDB table:
- Visit the Amazon DynamoDB Management Console.
- Navigate to Tables.
- Click the Create table button.
- Set Table name to
bucketav-scan-results
. - Set Partition key to
bucket_key
(String). - Under Table settings, select Customize settings.
- Under Read/write capacity settings, select Capacity mode
On-demand
. - Click the Create table button.
- Create Lambda function:
- Visit the AWS Lambda Management Console
- Navigate to Functions.
- Click the Create function button.
- Double-check that that Author from scratch is selected.
- Set Function name to
bucketav-scan-results
. - Set Runtime to
Node.js 16.x
. - Expand Change default execution role.
- Set Execution role to
Create a new role from AWS policy templates
. - Set Role name to
bucketav-scan-results
. - Set Policy templates to
Simple microservice permissions DynamoDB
(search for DyanmoDB). - Click the Create function button.
- Under Function overview Info, click the Add trigger button.
- Select Source
SNS
. - Set SNS topic to the topic starting with
bucketav-FindingsTopic
. - Under Code source, set the source code to the contents of subscribe.js
- Click the Deploy button.
- Upload a file to any S3 bucket connected to bucketAV via EventBridge or an S3 Event Notification.
- Use download.js to generate the pre-signed URL.