Objectives
Lab Details
  1. Create a S3 bucket named images-YOUR_NAME.
  2. Create another S3 bucket named images-YOUR_NAME-resized.
  3. Upload this picture into the first bucket that you created. You will use this file later in the lab when you manually invoke the Lambda function.
  4. Create a new Lambda function named CreateThumbnail. The content of the function definition can be found in this file. Change the Runtime to Python 3.9 and the Handler to lambda_function.lambda_handler.
  5. Test your function. Create a test event and use the Event template Amazon S3 Put. Replace the example-bucket with the name of your image bucket. Make sure that you change the bucket name in both places. Change "key": "test/key" with "key": "brewers_logo.jpeg". Click Create and run the test function that you just created. Verify that you now have a resized image in your resized S3 bucket.

    Take a screenshot of the thumbnail image in your S3 bucket.

  6. Add a Lambda trigger. Modify your CreateThumbnail function within Lambda by clicking on the Add Trigger. You are setting up a S3 trigger based on your S3 image bucket that should get triggered for All object create events
  7. Verify that your Lambda trigger is working properly. Upload a new image into your images-YOUR_NAME bucket. After the upload completes, check your images-YOUR_NAME-resized bucket to confirm that a thumbnail image was created as a result of your trigger.

    Take a screenshot of the new thumbnail image in your S3 bucket that was created as a result of your Lambda trigger.

  8. After completing the lab and getting credit in the GradeCenter, delete the Lambda and S3 resources to avoid being billed.
What did I learn?