+91 9717614047







Lamda Function



1. First create s3 bucket.


2 Then create lamda function from scratch. Name your lamda function then select create a new role from AWS policy templates.


3.Give name to role like lamdafunctionrole then select policy Amazon S3 object read-only permissions. After that click on Create Function.


4. Then Copy the python code(lamdafunctioncode.docx) in lamda function. So how this function work. When Lamda invovke the function there runtime passes 2 arguments to the handler here. That will be event and context. Event is json form of doc has data about your function to process. Like information about the s3 bucket, where we upload our file. Then second argument context is have info about runtime enviorment, function n implications. All we are doing here is grabing bucket information from the event. The specific file we uploaded and we printout the CONTENT-TYPE such us video file, image image etc.


5. Then After hit deploy. And we are good to go. We have code that is trigger by an event.


6. Now we have to add trigger.Choose s3 select the bucket we have create earlier. choose All object create events and leave everything as same.

7. You can go back to s3 come in properties check Event notifications its should show lamda function should be wired up.


8. Go back lamda side click configuration then permissions scroll down then click view policy document that policy should say s3 bucket is allow to invovke lamda function.


9. Lets upload some data to s3 bucket to make sure it should work. Upload any image in s3 object. As we do that should triggered our lamda function. Back to Lamda click on monitor here we can view our cloudwatch matix. Give its 2-3 mins to come up.


We provide best AWS training classes in Gurgaon and Delhi. For more information about the course please call at +91 9717614047