Created
July 12, 2023 06:31
-
-
Save akiltipu/a3ee36a771dea5e9589e41772c4fba25 to your computer and use it in GitHub Desktop.
Initial AWS Lambda Code for building End-to-End Web Application with AWS tutorial.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import the JSON utility package | |
import json | |
# import the Python math library | |
import math | |
# define the handler function that the Lambda service will use an entry point | |
def lambda_handler(event, context): | |
# extract the two numbers from the Lambda service's event object | |
mathResult = math.pow(int(event['base']), int(event['exponent'])) | |
# return a properly formatted JSON object | |
return { | |
'statusCode': 200, | |
'body': json.dumps('Your result is ' + str(mathResult)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment