Process Amazon S3 Events with AWS Lambda

Lab Steps

lock
Logging in to the Amazon Web Services Console
lock
S3 Events overview
lock
Creating an S3 Bucket
lock
Implement a Lambda Function to process S3 events
lock
Test the S3 Trigger

The hands-on lab is part of these learning paths

SysOps Administrator – Associate Certification Preparation for AWS
course-steps
32
certification
5
lab-steps
30
quiz-steps
4
description
5
Certified Developer – Associate Certification Preparation for AWS
course-steps
30
certification
6
lab-steps
22
description
2
Getting Started with Serverless Computing on AWS
course-steps
8
certification
1
lab-steps
9

Ready for the real environment experience?

DifficultyBeginner
Time Limit1h
Students2290
Ratings
4.4/5
starstarstarstarstar-half

Description

Amazon Simple Storage Service (S3) lets you store, retrieve, update, and version objects in the Cloud. Not only does it guarantee durability and high availability at low cost, but it also enables event-driven systems by notifying you whenever objects are created, updated, or deleted. This lets you connect S3 to SQS queues, SNS notifications, or AWS Lambda for custom processing.

In this lab, we will learn how to process new image files uploaded into S3 with a Lambda Function. As a simple example, we will use Python to compress the input image and generate a gzipped version.

Learning Objectives

Upon completion of this lab you will be able to:

  • Use Lambda to respond to events in Amazon S3
  • Utilize Python Lambda functions for event processing including use of the boto3 library
  • Compress data to reduce costs

Intended Audience

  • Developers working with event-driven paradigms
  • Practitioners looking to automate processing of S3 files

Prerequisites

Experience with S3 and the Lambda command-line will be beneficial but is not required.

The following courses can be used to fulfill the prerequisites:

Updates

July 29th, 2020 - Updated lab to reflect the latest console experience and resolved an issue in the Python code causing the function to fail to zip processed images

January 10th, 2019 - Added a validation Lab Step to check the work you perform in the Lab

September 10, 2018 - Updated instructions and images to improve the lab experience

About the Author

Alex is an Italian Software Engineer with a great passion for web technologies and music.

He spent the last 5 years building web products and deepening his knowledge on full-stack web development and software design, with a main focus on frontend and UX.

Despite being a passionate coder, Alex worked hard on his software and sound engineering background, which provides him the tools to deal with multimedia, signal processing, machine learning, AI, and many interesting topics related to math and data science.

Indeed, he had the opportunity to study and live in a very young and motivating environment in Bologna and Milan, two of the biggest and oldest Italian Universities. These experiences lead him to work on several projects involving robotics, machine intelligence, music semantic analysis and modern web development.