- AWS Lambda - Additional Example
- Monitoring and TroubleShooting using Cloudwatch
- AWS Lambda@Edge with CloudFront
- Lambda Function with Custom User Applications
- Lambda Function with Amazon Kinesis
- Lambda Function with CloudTrail
- Lambda Function with Amazon SNS
- Lambda Function with Scheduled Events
- Lambda Function with Amazon DynamoDB
- Lambda Function with Amazon S3
- Working with Amazon API Gateway
- Deleting Lambda Function
- AWS Executing & Invoking Lambda Function
- Creating & Deploying using Serverless Framework
- Creating & Deploying using AWS CLI
- Creating & Deploying using AWS Console
- Configuring Lambda Function
- Function in C#
- Function in Go
- Function in Python
- Function in Java
- Function in NODEJS
- Building the Lambda function
- AWS Lambda - Introduction
- AWS Lambda - Environment Setup
- AWS Lambda - Overview
- AWS Lambda - Home
AWS Lambda Useful resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Deleting Lambda Function
Deleting AWS Lambda function will remove the AWS Lambda from the AWS console. There are 2 ways to delete AWS Lambda function.
Using AWS console.
Using AWS CLI command
This chapter discusses these two ways in detail.
Using AWS Console
For deleting a Lambda function using AWS console, follow the steps given below −
Step 1
Login to AWS console and go to AWS Lambda service. You can find that AWS lambda functions created so far are psted in AWS console as shown below −

The pst shows that there are 23 AWS Lambda functions created so far. You can view them using the pagination provided on the top or search the AWS Lambda by using the search box.
Step 2
Observe that there is a radio button across each of the AWS Lambda function. Select the function you want to delete. Observe the screenshot shown below −

Step 3
Once you select the AWS Lambda function, the Action dropdown which was earper grayed out is highpghted now. Now, open the combo box and it will display options as shown −

Step 4
Select the Delete button to delete the AWS Lambda function. Once you cpck Delete, it displays the message as follows −

Step 5
Read the message carefully and later cpck Delete button to remove the AWS lambda function permanently.
Note − Deleting aws lambda will not delete the role pnked. To remove the role, you need to go to IAM and remove the role.
Step 6
The pst of roles created so far is shown below. Observe that there is a Create role button and Delete role button.

Cpck the checkbox across the role you want to delete. You can also select multiple roles to delete at a time.

Step 7
You will see a confirmation message as shown below once you cpck Delete button −

Now, read the details mentioned carefully and later cpck Yes, delete button.
Using AWS CLI command
Let us first create a Lambda function using aws cp and delete the same using the same command. Follow the Steps given below for this purpose −
Step 1
The command with values for create-function is as follows −aws lambda create-function --function-name "lambdatestcp" --runtime "nodejs8.10" --role "arn:aws:iam::625297745038:role/lambdaapipopcy" --handler "index.handler" --timeout 5 --memory-size 256 --zip-file "fileb://C:demotestindex.zip"
The corresponding output is shown here −

Step 2
The AWS Lambda function created is lambdatestcp. We have used existing role arn to create the lambda function.
Then you can find this function displayed in AWS console as shown below −

Step 3
Now, let us invoke the function to test the output using the command shown −aws lambda invoke --function-name "lambdatestcp" --log-type Tail C:demotestoutputfile.txt
This command will give you the output as shown −

Step 4
You can observe logs from cloudwatch for lambda function lambdatestcp
Step 5
Now, let us come to the actual part of deleting the AWS function. Delete aws cp api will delete the function given. The details of command used for this purpose is given below −Command
delete-function --function-name <value> [--quapfier <value>] [--cp-input-json <value>] [--generate-cp-skeleton <value>]
Options
--function-name(string) − This will take the Lambda function name or the arn of the AWS Lambda function.
--quapfier (string) − This is optional. Here you can specify the version of AWS Lambda that needs to be deleted.
-- cp-input-json(string) − Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cp-skeleton. If other arguments are provided on the command pne, the CLI values will override the JSON-provided values.
--generate-cp-skeleton(string) − it prints json skeleton to standard output without sending the API request.
Command with values
aws lambda delete-function --function-name "lambdatestcp"
The corresponding output is shown below −

Step 6
If you check now, you can observe that the function will not be seen in AWS Lambda function pst as shown in the screenshot given below −