Demo of creating an AWS Lambda Function

In this blog, we will run a Demo of creating an AWS Lambda Function which will convert a csv file into a json file.


  1. Clone this git repo
  2. Refer this blog for basic understanding of AWS Lambda

For this we will use S3 bucket as a source where we will store the csv file that will trigger the lambda function and convert the file in json and store it in another bucket.

We will be creating below resources. You can refer the git repo

  1. Create source S3 bucket
  2. Create target S3 bucket
  3. Create a lambda function in python
  4. Zip the file
  5. Upload a zip file in source S3 bucket
  6. Create a lambda function
  7. Create an IAM role and add permission
  8. Create a trigger
  9. Test it

Create source and target bucket

Now we will create a Lambda function which will do the parsing and store the new file in the target bucket

We have successfully uploaded the zip file in our source bucket

Create an IAM role

  • which gives access to the lambda function with policy AWSLambdaExecute

Create a Lambda function

You can use the aws-cli or can create directly from GUI also

Add permission

Now add trigger whenever an object is put in the S3 bucket

Sometimes you see this error when you are trying to use the same bucket. To fix this issue, go to S3 bucket -> Properties -> Event -> Delete Event Notification

Test it

Copy csv file in the source bucket using below command

Now you can see that in the target ,a new json file is uploaded


  1. Safari Book

Devops Automation Enginneer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store