I have an AWS Lambda function that converts an html document to a pdf document whenever a new document is uploaded to S3. Working great.
Once the pdf has been generated, my application code (which is a traditional server backed web service) needs to send an email to the user with a link to the pdf file. I can think of a few ways to handle this:
- Just assume the pdf conversion worked and trigger the email naively
- Send a webhook from the lambda function to my application code when the conversion happens
- In the background job check for the existence of the pdf before sending the email
In reality all of these will work, but I am curious if there is a suggested 'best practice' for handling AWS lambdas that are triggered asynchronously like this, rather then being directly triggered.