Data and spreadsheets
Amazon Redshift email validation integration
Two SQL functions return the status of an address, or the reason, action and error in full, straight from an Amazon Redshift query. They are Lambda UDFs: Redshift sends batches of rows to a Lambda function in your AWS account, which checks each address with our API.
Read the full setup guideGet an API key
- Setup guide
- One zip: the Lambda function and the SQL
SELECT email, f_validate_email(email) AS status FROM customers;
SELECT email, JSON_EXTRACT_PATH_TEXT(f_validate_email_details(email), 'reason') AS reason FROM customers;At a glance.
- Status
- Setup guide. Not listed on a marketplace yet: you set it up yourself in a few steps, below and in the full guide.
- For
- Data teams who keep customer or lead addresses in Amazon Redshift and want each one’s status as a column they can join, filter and send on, without moving the data elsewhere first.
- You need
- An AWS account where you can create a Lambda function, a secret and an IAM role, a Redshift cluster or Serverless workgroup where you can create external functions, and an API key made for it, with a daily credit cap.
- Costs
- 1 credit = 1 validated address, as with any API request. Free: unknown results, API errors, malformed addresses, test addresses on sandbox.email-validation.org, addresses on reserved domains such as example.com and, in a bulk list, repeats of an address (charged once).
- Full guide
- Read the full setup guide
Typical uses.
Clean a customer table
Check each distinct address into a results table, then join to it in every query, view or export that needs the status.
Check new sign-ups each day
Run the check-once script on a schedule: it checks only addresses that have no result yet, so each run spends credits on new rows only.
Keep bad addresses out of sends
Filter the audiences you send to other tools on the status, so addresses that cannot receive mail and throwaway inboxes never leave the warehouse.
Set it up. 4 steps.
The short version of the full setup guide, which stays the reference when a step does not match what you see.
Download the zip and make a key
Download the zip from the guide, create an API key with Validate addresses and a daily credit cap, and store it in AWS Secrets Manager.
Deploy the Lambda function
Upload the two files of
handler/as a Node.js function with the secrets extension layer, and give Redshift a role that may invoke it.Create the functions
Run
sql/1-functions.sqlwith the role’s ARN. It takes the functions back fromPUBLIC, so only the roles you grant can spend credits.Check each address once
Run
sql/2-check-once.sqlto fillev_email_results, then tryf_validate_email('no_mailbox@sandbox.email-validation.org'): test addresses cost nothing.
Good to know.
It has not run in a real Redshift or AWS account yet: it was built from the AWS documentation and tested against stand-ins.
Every non-NULL row a query passes to the functions is checked each time the query runs; the same address twice in one batch is checked once. A query over a large table spends credits again on every run: the check-once script and a join avoid that.
A row that could not be checked gets a NULL status and an error code that says why, never an invented status. A wrong key fails the whole query with a message that never contains the key.
The function never logs an address or the key. Redshift’s query history and the tables you write keep what you put in them.
For EU data residency, set
EV_REGIONtoeuon the Lambda function: the same key works on both hosts.
Connect Amazon Redshift.
Test it on our sandbox addresses for free, then on your own contacts.
Updated · Maintained by: Email Validation LLC