1
votes

I have a Python Lambda function that accesses my RDS Aurora DB, copies a table, by doing the following queries

conn = pymysql.connect(rds_host, user=username,
                       passwd=password, db=db_name, connect_timeout=10)
with conn.cursor() as cur:
    cur.execute("create table some_table_temp like some_table;")
    cur.execute("insert into some_table_temp select * from some_table;")

I ran the function successfully on my sandbox RDS Aurora DB. I then setup my Lambda function to use my staging environment (DB, VPC, subnet, security groups). I'm getting a connection object, and am able to create the some_table_temp table, but the succeeding insert query fails due to timeout since this table takes longer than 3.00s to copy in the staging environment.

2020-10-17T17:14:15.243Z 17d05521-d0da-441c-bd71-befa37e447cb Task timed out after 3.00 seconds

How can I increase the timeout for my DB queries?

Thanks.

1

1 Answers

0
votes

My Lambda function timeout was set to 3.00s (default) so increasing that fixed the issue.