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 pymysql | |
import os | |
def lambda_handler(event, context): | |
# Establish a connecto the the MySQL database | |
connection = pymysql.connect(host=os.environ['db_host'], user=os.environ['db_username'], password=os.environ['db_password'], database=os.environ['db_name']) | |
# Add a new user and print the updated user list | |
add_new_user(connection, 'JohnDoe', 'johndoe@example.com') |
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 os | |
import json | |
import requests | |
def lambda_handler(event, context): | |
msg = {'text': event['Records'][0]['Sns']['Message']} | |
headers = {'Content-Type': 'application/json'} | |
response = requests.post(os.environ['TEAMS_WEBHOOK_URL'], headers=headers, data=json.dumps(msg).encode('utf-8')) | |
return { | |
'statusCode': 200, |