Reputation: 1449
I need to transfer SQL Server RDS' secrets into my Python code that will be ran by Lambda.
What would be best approach to handle such transfer? Sholud it be done with boto3
or/with AWS' Secrets Manager?
Sample Python code:
import pyodbc
def lambda_handler(event,context):
conn = pyodbc.connect('Driver={SQL Server};'
'Server=server_name;'
'Database=db_name;'
'Trusted_Connection=yes;')
cursor = conn.cursor()
cursor.execute('SELECT * FROM db_name.Table')
for row in cursor:
print(row)
Upvotes: 0
Views: 691
Reputation: 1584
This is a great walkthrough with code examples and more importantly, shows how to setup the exceptions in Python for boto3 and SecretsManager.
Upvotes: 1