Skip to content

Instantly share code, notes, and snippets.

@akiltipu
Created July 12, 2023 06:31
Show Gist options
  • Save akiltipu/a3ee36a771dea5e9589e41772c4fba25 to your computer and use it in GitHub Desktop.
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.
# 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