Skip to main content

Command Palette

Search for a command to run...

Trigger a function in AWS Lambda on uploading a file

Published
1 min read
Trigger a function in AWS Lambda on uploading a file
  1. Log in to your AWS account and on the dashboard, search for Lambda

  1. Click on Lambda, and you will land on the Lambda dashboard. Click on “Create a function”.

  2. Choose a function name, select a runtime that you are comfortable with. Leave everything else the same and click on create function on the bottom right

  3. Add a trigger

  4. Select source as S3. Then choose a bucket name and select event type as PUT if you want to trigger the function on image upload. Enter a suffix if you want a particular type of image to trigger the event

  5. Lambda needs permission to read from the S3 bucket. Go to configuration and click on permissions, then under click on role name.

  6. Click on add permission → Create Inline policy

  7. Add Permission. Click on Actions and import policy, and search for “AWSLambdaBasicExecutionRole” and add it. Save

  8. Now, upload an image to S3 and go to your Lambda console → Monitor → View CloudWatch logs