AWS Lambda supports function testing with event creation inside the console, but with this simple process, we can just test the function by uploading some images to the source folder in our S3 bucket and seeing the result in the destination folder.
I’ve prepared some .jpg images on my machine. You can put in any type of image that the PIL library supports, any error (including incompatible image file type) in the execution of the Lambda function will be logged into a CloudWatch Log group.
From the AWS console, go back to S3.
Locate and select the bucket that we’ve created in this workshop.
Locate and click on the source/ folder to go inside the folder
Choose Upload
In the Upload window, select Add files
Choose an image file or multiple image files that you want to upload in the file by choosing in the popup window
Image in the source folder
After Lambda invocation, in the destination folder
One more thing, you should also take a look at the log files that have been created for every Lambda invocation to inspect the operation.
Look for CloudWatch in the search bar of your AWS Console
In the left menu, expand Logs then select Log group
You should see the Log group with the prefix aws/lambda/ plus our function name WatermarkS3Upload
if you completed all the previous steps. Click on it
Select the latest log group and expand the logs to explore.
My function logs
That’s it, you’ve basically finished this workshop. Now let’s go ahead and delete the resources to restore your account to the state it was in to avoid unwanted charges.