Last active
March 1, 2024 13:48
-
-
Save juliafmorgado/8eb027cb9502b88d91d2710fbe99b347 to your computer and use it in GitHub Desktop.
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 json | |
import boto3 | |
from time import gmtime, strftime | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('contact-management-system-table') | |
now = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) | |
def lambda_handler(event, context): | |
name = event['firstname'] +' '+ event['lastname'] +' '+ event['phone_number'] | |
response = table.put_item( | |
Item={ | |
'ID': name, | |
'LatestGreetingTime':now | |
}) | |
return { | |
'statusCode': 200, | |
'body': json.dumps('Hello from Lambda, ' + name) | |
} | |
'statusCode': 200, | |
'body': json.dumps('Hello from Lambda, ' + name) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment