AWS Lambda function to send e-mail using SendGrid or Amazon SNS.
- SendGrid API
- Amazon SNS access permission
-
pip install sendgrid.
-
Create new function with this code.
-
Set SendGrid API key to environment valiables.
-
Add S3 trigger.
Trigger setting Event source bucket Any Event source type Create object or put Prefix Any Suffix Any -
Save this function.
-
Use sample file(./Test/sample.json) and replace each key value.
Key Description TYPE Set "sendgrid" or "sns" SEND_FROM Send from E-mail address SEND_TO Send to E-mail address CONTENT Body -
Upload sample file to S3 bucket.
mm948