{"id":10239,"date":"2024-11-14T10:33:57","date_gmt":"2024-11-14T10:33:57","guid":{"rendered":"https:\/\/cloudkul.com\/blog\/?p=10239"},"modified":"2024-11-14T10:33:59","modified_gmt":"2024-11-14T10:33:59","slug":"implementation-guide-for-aws-lambda-function","status":"publish","type":"post","link":"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/","title":{"rendered":"Implementation guide for AWS Lambda Function"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2024\/04\/building-a-serverless-architecture-via-aws-lambda-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"400\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2024\/04\/building-a-serverless-architecture-via-aws-lambda-1.png\" alt=\"lambda\" class=\"wp-image-17710\"\/><\/a><\/figure>\n\n\n\n<p>In our previous <strong>blog<\/strong>, we discussed <a href=\"https:\/\/cloudkul.com\/blog\/aws-lambda-building-a-serverless-architecture\/\">serverless architecture<\/a> and AWS lambda functions along with their benefits. <\/p>\n\n\n\n<p>Here in this blog, we will discuss how we can create a basic lambda function in AWS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Our Usecase<\/h2>\n\n\n\n<p>The lambda function that we are going to use is just a simple Lambda function that will show all the <a href=\"https:\/\/cloudkul.com\/blog\/aws-ec2-and-its-pricing-plans\/\">EC2 instances<\/a> in your AWS account whether they are running or not.<\/p>\n\n\n\n<p>We are not using any kind of filters here but if you want to use filters then you can add commands to your code accordingly.<\/p>\n\n\n\n<p>This function will only list down all the ec2 instances irrespective of in which AWS region they are.<\/p>\n\n\n\n<p><strong>Here is the code &#8211; <\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import json\nimport boto3\n\nec2 = boto3.resource('ec2')\n\n\ndef lambda_handler(event, context):\n    \n    instances = ec2.instances.filter()\n    \n    for instance in instances:\n        print(instance.id)\n        \n    return {\n        \"statusCode\": 200,\n        \"body\": True\n        }<\/pre>\n\n\n\n<p><strong>Runtime &#8211; <\/strong>Python 3.7<\/p>\n\n\n\n<p><strong>And here are the EC2 instances that we are going to list using the Lambda Function <em>&#8211; <\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/ec2-instances.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"527\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/ec2-instances-1024x527.png\" alt=\"ec2\" class=\"wp-image-10568\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Supported Languages<\/h2>\n\n\n\n<p>We are using Python in our code. But, if you wish then you can create a lambda function using any of the following Supported Languages &#8211; <\/p>\n\n\n\n<ul>\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">NodeJS<\/mark><\/li>\n\n\n\n<li>Python<\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Go<\/mark><\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Java<\/mark><\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Ruby<\/mark><\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">.Net<\/mark><\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">C#<\/mark><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Let&#8217;s create a Lambda Function in AWS<\/h2>\n\n\n\n<h5 class=\"wp-block-heading\">Step 1 &#8211; Search for Lambda<\/h5>\n\n\n\n<p>Now <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">search for the &#8216;Lambda&#8217;<\/mark><span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\"> <\/span>service under your AWS management console.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/1.-search-for-lambda-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"503\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/1.-search-for-lambda-1-1024x503.png\" alt=\"aws\" class=\"wp-image-10570\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 2 &#8211; Choose the AWS region <\/h5>\n\n\n\n<p>Then, <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">select the &#8216;AWS region&#8217;<\/mark> where you want to create the function from the following available regions or where your server is already running.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/2.-choose-region.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"506\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/2.-choose-region-1024x506.png\" alt=\"region\" class=\"wp-image-10571\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 3 &#8211; Create a Lambda function<\/h5>\n\n\n\n<p>Under the AWS lambda console,<span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"> <\/span><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">click on &#8216;create function&#8217;<\/mark>. Here on this page, you will find all your existing lambda functions here.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/3.-choose-create-function.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"503\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/3.-choose-create-function-1024x503.png\" alt=\"lambda\" class=\"wp-image-10572\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 4 &#8211; Choose &#8216;Use a Blueprint&#8217;<\/h5>\n\n\n\n<p>Choose any of the following to create your Lambda function, we have <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">chosen the &#8216;Use a Blueprint&#8217;<\/mark> option.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/4.-use-a-blueprint.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"501\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/4.-use-a-blueprint-1024x501.png\" alt=\"function\" class=\"wp-image-10573\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 5 &#8211; Choose <em>&#8216;Hello-word&#8217;<\/em>  Blueprint<\/h5>\n\n\n\n<p>Under Blueprints, search for &#8216;Hello-word&#8217; and <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">choose <em>&#8216;<\/em>Hello-word-python&#8217; Blueprint<\/mark>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/5.-search-hello-word.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"502\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/5.-search-hello-word-1024x502.png\" alt=\"create\" class=\"wp-image-10574\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 6 &#8211; Enter Basic details<\/h5>\n\n\n\n<p><strong>Enter Function name &#8211; <\/strong><em>mylambda<\/em><\/p>\n\n\n\n<p><strong>Runtime &#8211; <\/strong>Python 3.7<\/p>\n\n\n\n<p><strong>Under the execution role &#8211;<\/strong> choose &#8216;Create a new role with basic Lambda permissions&#8217;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/6.enter-basic-details.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"503\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/6.enter-basic-details-1024x503.png\" alt=\"name\" class=\"wp-image-10576\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 7 &#8211; Click on &#8216;create function&#8217;<\/h5>\n\n\n\n<p>After entering all the basic details, <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">click on &#8216;create function&#8217;<\/mark> in the right corner downwards.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/7.create-function.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"503\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/7.create-function-1024x503.png\" alt=\"code \" class=\"wp-image-10577\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 8 &#8211; Function created Successfully<\/h5>\n\n\n\n<p>Now your function has been created successfully as shown in the green color notification bar.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/8.function-created-succesfully.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"502\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/8.function-created-succesfully-1024x502.png\" alt=\"launch\" class=\"wp-image-10578\"\/><\/a><\/figure>\n\n\n\n<p>  <\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 9- Run Python code<\/h5>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Now you can put your code into the console<\/mark><em>.<\/em> <\/p>\n\n\n\n<p>After pushing the code, you need to <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Deploy your code<\/mark><strong><span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"> <\/span><\/strong>after making the required changes to it. <\/p>\n\n\n\n<p>Once deployed, you will have to<strong> <\/strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Test it<\/mark><strong><span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"> <\/span><\/strong>to check the output of the code.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/9.-test-and-deploy-code.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"542\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/9.-test-and-deploy-code-1024x542.png\" alt=\"deploy\" class=\"wp-image-10579\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 10 &#8211; Permission Error<\/h5>\n\n\n\n<p>At the runtime, an <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">&#8216;Unauthorized operation&#8217;<\/mark> error occurred that shows this lambda function is not authorized to access the EC2 instances.<\/p>\n\n\n\n<p>By default, lambda does not have any permission to access any of the c until we grant permissions to it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/10.-error-.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"530\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/10.-error--1024x530.png\" alt=\"myfunction\" class=\"wp-image-10580\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 11 &#8211; Create an IAM role to run the Lambda Function<\/h5>\n\n\n\n<p>Now, we need to create an <a href=\"https:\/\/cloudkul.com\/blog\/what-is-aws-iam\/\">IAM role<\/a> to grant <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Read-only access<\/mark><\/em><span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"> <\/span>to our lambda function so that this function can Read the EC2 instances in the AWS account.<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\"><strong>(i) Navigate to IAM Under AWS Management Console and then choose<em> &#8216;Roles&#8217; <\/em>from the left-hand side options<\/strong>.<\/mark><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11i-navigate-to-IAM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"528\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11i-navigate-to-IAM-1024x528.png\" alt=\"roles\" class=\"wp-image-10593\"\/><\/a><\/figure>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">(ii) Create an IAM Role <\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/10\/create-a-role.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"380\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/10\/create-a-role-1024x380.png\" alt=\"iam\" class=\"wp-image-16693\"\/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">(iii) Under AWS services, choose Lambda to grant permission to our lambda function. Then click on &#8216;Next: Permission&#8217;.<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/10\/11-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"516\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/10\/11-3-1024x516.png\" alt=\"permission\" class=\"wp-image-16694\"\/><\/a><\/figure>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">(iv) Now under policies, we need to choose the appropriate policy that we want to attach with the created role.<\/mark><\/strong><\/p>\n\n\n\n<p>As we have mentioned earlier, this lambda function will list down all the EC2 instances. In this case, we will choose Read-only permission for our ec2 instances. <\/p>\n\n\n\n<p>For that, we need to choose the &#8216;ec2readonly&#8217; policy. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11iv-choose-policy.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"527\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11iv-choose-policy-1024x527.png\" alt=\"create role\" class=\"wp-image-10596\"\/><\/a><\/figure>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">(v) <\/mark><\/strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Enter the <\/mark>required details and review the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">created Role.<\/mark><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11vcreate-and-review-role.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"529\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11vcreate-and-review-role-1024x529.png\" alt=\"review\" class=\"wp-image-10597\"\/><\/a><\/figure>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">(vi) Role has been created successfully, you can check by searching using your role name &#8211; &#8216;lambdaec2readonly&#8217;.<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11virole-created-successfully.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"529\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/11virole-created-successfully-1024x529.png\" alt=\"role\" class=\"wp-image-10598\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 12 &#8211; Change Role name<\/h5>\n\n\n\n<p>Again navigate LAMBDA under AWS Management close. Click on your created function and look for <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">&#8216;Configurations&#8217; to change the Role name.<\/mark> Click on &#8216;Edit&#8217; for this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/12-configurations.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"527\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/12-configurations-1024x527.png\" alt=\"config\" class=\"wp-image-10599\"\/><\/a><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Step 13 &#8211; Change IAM role <\/h5>\n\n\n\n<p>In Basic settings, under the Execution role please search for the role that you have created<span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"> <\/span><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">i.e., <em>lambdaec2readonly<\/em>.<\/mark><span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"> <\/span>Choose this role and then click on <em>&#8216;Save&#8217;.<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/13-change-role.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"529\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/13-change-role-1024x529.png\" alt=\"iam role\" class=\"wp-image-10600\"\/><\/a><\/figure>\n\n\n\n<p>You have successfully created the IAM role required to execute the lambda code.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 14 &#8211; Test the code Again<\/h5>\n\n\n\n<p>Now, <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">test the code again<\/mark><span style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"> <\/span>to check whether we have got the IAM role permission or not.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/14-test-succeeded.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"527\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/14-test-succeeded-1024x527.png\" alt=\"done\" class=\"wp-image-10601\"\/><\/a><\/figure>\n\n\n\n<p>Your code has been executed properly. You can check the status of the execution i.e., <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\"><strong>SUCCEEDED<\/strong>.<\/mark><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Step 15 &#8211; Final\/Execution Result<\/h5>\n\n\n\n<p><strong>Your code has been executed successfully.<\/strong> <\/p>\n\n\n\n<p>The results are those EC2 instances that are available in our AWS account. You can cross these instances as we have already mentioned the instance IDs in the initial phase of this installation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/15-final-output.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"523\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2021\/12\/15-final-output-1024x523.png\" alt=\"tested\" class=\"wp-image-10602\"\/><\/a><\/figure>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">Hope you are clear with each and every step of the installation guide as we tried to give you a simple way to create a LAMBDA Function in AWS.<\/mark><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>This is the first step in learning how to launch applications without the requirement for server provisioning or management. <\/p>\n\n\n\n<p>Lambda scales your applications automatically by executing your code in response to each trigger, adjusting to the size of your workload.<\/p>\n\n\n\n<p>This was a basic function that we have used to execute lambda. You can perform more actions by manipulating your code.<\/p>\n\n\n\n<p>In future blogs, we will be sharing more updates with you about the latest technologies and will keep updating you.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Need Support?<\/h2>\n\n\n\n<p>Thank You for reading this Blog!<\/p>\n\n\n\n<p>For further more interesting blogs, keep in toudch with us. If you need any kind of support, simply raise a ticket at\u00a0<strong><em><a href=\"https:\/\/webkul.uvdesk.com\/en\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/webkul.uvdesk.com\/en\/<\/a>.<\/em><\/strong> <\/p>\n\n\n\n<p><strong>For further help or queries, please\u00a0<a href=\"https:\/\/cloudkul.com\/contact\/\">contact<\/a>\u00a0us or raise a\u00a0<a href=\"https:\/\/webkul.uvdesk.com\/en\/customer\/create-ticket\/\">ticket<\/a>.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our previous blog, we discussed serverless architecture and AWS lambda functions along with their <a class=\"text-primary\" title=\"read more\" href=\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[32,2,45,87,46,340],"tags":[16,3,681,463,568,629,220,339],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Implementation guide for AWS Lambda Function - Cloudkul<\/title>\n<meta name=\"description\" content=\"The lambda function that we are going to use is a simple function that will show all the EC2 instances running in your AWS account without using any filter.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Implementation guide for AWS Lambda Function - Cloudkul\" \/>\n<meta property=\"og:description\" content=\"The lambda function that we are going to use is a simple function that will show all the EC2 instances running in your AWS account without using any filter.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudkul\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-14T10:33:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-14T10:33:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2024\/04\/building-a-serverless-architecture-via-aws-lambda-1.png\" \/>\n<meta name=\"author\" content=\"Tanya Garg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/CloudWebkul\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/\",\"url\":\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/\",\"name\":\"Implementation guide for AWS Lambda Function - Cloudkul\",\"isPartOf\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\"},\"datePublished\":\"2024-11-14T10:33:57+00:00\",\"dateModified\":\"2024-11-14T10:33:59+00:00\",\"author\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/65b93d1aa584abd012eb60a25839b984\"},\"description\":\"The lambda function that we are going to use is a simple function that will show all the EC2 instances running in your AWS account without using any filter.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Implementation guide for AWS Lambda Function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\",\"url\":\"https:\/\/cloudkul.com\/blog\/\",\"name\":\"Cloudkul\",\"description\":\"Host your eCommerce Store on AWS with Optimized Performance\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudkul.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/65b93d1aa584abd012eb60a25839b984\",\"name\":\"Tanya Garg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9ea334eba6adf9dfe79873bc0bee8dad?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9ea334eba6adf9dfe79873bc0bee8dad?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"caption\":\"Tanya Garg\"},\"description\":\"Business Developer Executive at Webkul\",\"sameAs\":[\"https:\/\/cloudkul.com\/\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/CloudWebkul\"],\"url\":\"https:\/\/cloudkul.com\/blog\/author\/tanyagarg-bd037\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Implementation guide for AWS Lambda Function - Cloudkul","description":"The lambda function that we are going to use is a simple function that will show all the EC2 instances running in your AWS account without using any filter.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/","og_locale":"en_US","og_type":"article","og_title":"Implementation guide for AWS Lambda Function - Cloudkul","og_description":"The lambda function that we are going to use is a simple function that will show all the EC2 instances running in your AWS account without using any filter.","og_url":"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/","og_site_name":"Cloudkul","article_published_time":"2024-11-14T10:33:57+00:00","article_modified_time":"2024-11-14T10:33:59+00:00","og_image":[{"url":"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2024\/04\/building-a-serverless-architecture-via-aws-lambda-1.png"}],"author":"Tanya Garg","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/CloudWebkul","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/","url":"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/","name":"Implementation guide for AWS Lambda Function - Cloudkul","isPartOf":{"@id":"https:\/\/cloudkul.com\/blog\/#website"},"datePublished":"2024-11-14T10:33:57+00:00","dateModified":"2024-11-14T10:33:59+00:00","author":{"@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/65b93d1aa584abd012eb60a25839b984"},"description":"The lambda function that we are going to use is a simple function that will show all the EC2 instances running in your AWS account without using any filter.","breadcrumb":{"@id":"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cloudkul.com\/blog\/implementation-guide-for-aws-lambda-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Implementation guide for AWS Lambda Function"}]},{"@type":"WebSite","@id":"https:\/\/cloudkul.com\/blog\/#website","url":"https:\/\/cloudkul.com\/blog\/","name":"Cloudkul","description":"Host your eCommerce Store on AWS with Optimized Performance","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudkul.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/65b93d1aa584abd012eb60a25839b984","name":"Tanya Garg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9ea334eba6adf9dfe79873bc0bee8dad?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9ea334eba6adf9dfe79873bc0bee8dad?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","caption":"Tanya Garg"},"description":"Business Developer Executive at Webkul","sameAs":["https:\/\/cloudkul.com\/","https:\/\/twitter.com\/https:\/\/twitter.com\/CloudWebkul"],"url":"https:\/\/cloudkul.com\/blog\/author\/tanyagarg-bd037\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/10239"}],"collection":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/comments?post=10239"}],"version-history":[{"count":84,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/10239\/revisions"}],"predecessor-version":[{"id":18626,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/10239\/revisions\/18626"}],"wp:attachment":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media?parent=10239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/categories?post=10239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/tags?post=10239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}