The previous example of a Lambda function that's used to virus scan files in S3 is a similar but more complex version of what we are going to set up in our own environment. Our function will get triggered when a file is uploaded to an S3 bucket that we specify, where it will then download that file, inspect the contents, and then place tags on the object in S3, depending on what it finds. This function will have a few programming mistakes that open it up to exploitation for the sake of our demo, so don't go running this in your production account!
Before we get started on creating the Lambda function, let's first set up the S3 buckets that will trigger our function and the IAM role that our function will assume. Navigate to the S3 dashboard (click on the Services drop-down menu and search for S3) and click on the Create bucket...