|
|
@@ -0,0 +1,24 @@
|
|
|
+import json
|
|
|
+import pymysql
|
|
|
+import boto3
|
|
|
+
|
|
|
+def updata_db(key1,value1):
|
|
|
+ conn2 = pymysql.connect(
|
|
|
+ host='DNSName',
|
|
|
+ port=3306,
|
|
|
+ user='admin',
|
|
|
+ passwd='xcloud1234',
|
|
|
+ db='cmd',
|
|
|
+ charset='utf8mb4')
|
|
|
+
|
|
|
+ cs2 = conn2.cursor()
|
|
|
+ select_sql = f'INSERT INTO table() VALUES ("{key1}", "{value1}");'
|
|
|
+ cs2.execute(select_sql)
|
|
|
+ conn2.commit()
|
|
|
+ cs2.close()
|
|
|
+ conn2.close()
|
|
|
+
|
|
|
+def lambda_handler(event, context):
|
|
|
+ # TODO implement
|
|
|
+ print(event)
|
|
|
+
|