简体   繁体   中英

Register AWS Redshift activity

As per AWS docs, there's no Redshift-Lambda integration yet. What we would like to do is monitoring redshift activity in order to do something when a redshift table is created, a copy from S3 is made or a bulk insert is performed. Is there a way to register this kind of activity, and then do something similar to run a lambda function ir order run a small script or so?

Redshift provides an event notification mechanism. You can find a full list of the event categories and messages here . If that covers the kind of information you are interested in you can simply have your Lambda function add the SNS topic used by Redshift for event notification as an event source and your Lambda function will get called every time an event is sent by Redshift.

You can enable audit logs that end up in s3.

All the info you want is also available in various admin tables with prefixes like stl_ , stv_ and pg_ . For example, COPY commands from S3 are recorded in stl_load_commits , and stl_utilitytext has info on non-select queries like CREATE .

As for triggering events, you could have S3 trigger a lambda when one of the log files lands or run occasional jobs that query the system tables and take action with something like cron jobs or airflow .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM