Demo of creating an AWS Lambda Function

3 min readFeb 27, 2021

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

cd Lambda

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

aws s3 cp s3://devops4solutions-source

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
aws iam create-role --role-name PayrollProcessingLambdaRole1 --description "Provides AWS Lambda with access to s3 and cloudwatch to execute the PayrollProcessing function" --assume-role-policy-document file://lambda-trust-policy.jsonaws iam attach-role-policy --role-name PayrollProcessingLambdaRole1 --policy-arn arn:aws:iam::aws:policy/AWSLambdaExecute