Create AWS Lambda function and Trigger Step by Step
Log on to AWS Console
Log in to the AWS console(https://aws.amazon.com/console/) with your username and password, If you don't have an account already created on AWS, you can create one.
Steps to create the account first-time https://repost.aws/knowledge-center/create-and-activate-aws-accountIf you created an account on AWS first time then it will be a root and admin account, you should not use this account for all the operations. Rather than create a new IAM user with admin permission and perform all the operations using an IAM user. Follow the steps to create the IAM admin user https://docs.aws.amazon.com/streams/latest/dev/setting-up.html
Create Lambda Function
Once you log in to the AWS console using your IAM user, It will land you on the AWS console Home page then follow the below-mentioned steps to create the Lambda Function:
Search for Lambda in the services search
Click on Lambda which is shown in the above picture and it will open the Lambda Function dashboard then click on Create function which is displayed below the screenshot
-
Enter the Lambda function name then choose the runtime language from the drop-down, I have entered the function name as testfunction and chosen the runtime language as Python 3.8
-
The next step is to create a new role for the execution of the lambda function, if created a role already then you can choose "use an existing role" As I have an existing role with the permission of Lambda execution and S3 full permission so I am using my existing role and choose it from the drop-down of Existing role
-
Leave the other option as default and click on the Create function which is on the right side of your screen at the end, your function will get created.
-
upon clicking on the function, your function will get created and it will be displayed like below:
Create Trigger to integrate S3 bucket Lambda Function
- Click on add trigger button which in the almost upper left side of the screen
-
- Then select a source, click on the drop-down and type s3 in the search then choose these services here I have selected S3
- Then choose the bucket from the bucket search, I have chosen test-ramkumar-bucket then select the Event type, where I selected "put"
- Then add the prefix and suffix which are optional.I have chosen Prefix as input as I want to get trigger the lambda function when a file added into the input folder of my bucket test-ramkumar-bucket click on I acknowledge which is the last option on the page and finally click on ADD
Subscribe to my newsletter
Read articles from Ram Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ram Kumar
Ram Kumar
I am a seasoned DevOps Engineer/Consultant with a passion for helping organizations streamline their software delivery processes. With expertise in tools like GIT, Jenkins, Docker, Kubernetes, AWS, GCP and terraform. I specialize in designing and implementing automated build, test, and deployment pipelines to accelerate time-to-market and improve quality. I have extensive experienced on various Linux flavor's , Shell Scripting, Oracle Andin, SQL, PL/SQL. In my posts, I'll be sharing insights on DevOps best practices, infrastructure automation, and optimizing software delivery workflows. Stay tuned for valuable tips and tricks to enhance your DevOps practices and deliver reliable software to your customers. Let's connect and embark on a journey towards efficient and reliable software delivery! Feel free to reach out for any DevOps-related questions or discussions. Looking forward to connecting with fellow DevOps enthusiasts! #DevOpsConsultant #Automation #SoftwareDelivery #DevOpS Engineer