Could you please demonstrate aws lambda with python

0 votes
Jun 23, 2019 in AWS by Priyanka
132 views

1 answer to this question.

0 votes

Hey @Priyanka, 

Python Lambda functions are functions that do not have any name. They are also known as anonymous or nameless functions. The word ‘lambda’ is not a name, but its a keyword. This keyword specifies that the function that follows is anonymous.

A Lambda function is created using the lambda operator and its syntax is as follows:

SYNTAX:

lambda arguments: expression

Python lambda function can have any number of arguments but it takes just one expression. The inputs or arguments can start at 0 and go up to any limit. Just like any other functions, it’s perfectly fine to have lambda functions with no inputs. Therefore, you can have lambda functions in any of the following formats:

EXAMPLE:

lambda : “Specify the purpose”

Here, the lambda function is not taking any arguments.

EXAMPLE:

lambda a1: “Specify the use of a1“

Here, lambda is taking one input which is a1.

Similarly, you can have lambda a1, a2, a3..an.

Let’s take a few examples to demonstrate this:

EXAMPLE 1:

a = lambda x: x*x
print(a(3)

OUTPUT: 9

Have a look at this blog for detailed explanation: https://www.edureka.co/blog/python-lambda/

answered Jun 24, 2019 by Kalgi
• 51,850 points

Related Questions In AWS

+1 vote
10 answers
0 votes
1 answer
0 votes
1 answer

Python Pusher in AWS Lambda

Using virtualenv to keep track of dependencies will be ...READ MORE

answered May 30, 2018 in AWS by Cloud gunner
• 4,630 points
261 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Pass account id of an AWS sub account using a variable as an argument in CloudWatch Alarm Actions with python (boto3)?

Python String and Integer concatenation >>> print("arn:aws:swf:us-east-2:{0}:action/actions/AWS_EC2.InstanceId.Stop/1.0".format(acccnum)) arn:aws:swf:us-east-2:12312312312312:action/actions/AWS_EC2.InstanceId.Stop/1.0 >>> print("arn:aws:swf:us-east-2:" ...READ MORE

answered Oct 5, 2018 in AWS by Priyaj
• 57,530 points
340 views
+13 votes
2 answers
+1 vote
1 answer

Hi could you plz help me on creating appspec file for code deploy .

Hi @Sri, you could use something like ...READ MORE

answered Dec 3, 2019 in AWS by Kalgi
• 51,850 points
319 views