as far as I know AWS lambda will consider as fail if function taks over 3 seconds
def copy_to_redshift(cur, key):
sql = '''
copy <table_name>
from '<s3 bucket url>'
credentials 'aws_access_key_id=<..>;aws_secret_access_key=<..>'
json 'auto'
''' % (key)
cur.execute(sql)
I use this code to load data from s3 to redshift. it is take over 3 seconds and I got this log from lambda
Task timed out after 3.00 seconds
How can I reduce this performance?
my s3 file size is 7M and have 50000 rows.
lucky my redshift could load successfully even lambda finish as fail and I think function doesn't need to wait until copy sql.
is it possible to just give sql and terminate function?