We are storing some of our SQL dumps from AWS RDS to GCP cloud storage as a long term secondary backup .For the past four days the data were not transferred to GCP, on analysis we found out that was because of daylight saving changes and fixed the issue.
Now in the future we would like to get some notification from GCP to email / text message - positive scenario /pager duty - negative scenario (Email alone at this time). Postive scenario for emailing is successful upload of a new file to GCS bucket. But as google does not have any native support for emailing or text, Please suggest us a solution. I have configured the the following
Configured bucket to notify changes to pub sub https://cloud.google.com/storage/docs/reporting-changes
Configured the pub /sub notification as a pull delivery type https://cloud.google.com/storage/docs/pubsub-notifications
But now how do I send email / text out of GCP. We are Major AWS shop. Can we use SES or SNS or any other type of notification to get the data out of PUB/SUB.
Can we use SES or SNS or any other type of notification to get the data out of PUB/SUB?
Yes. I have done this (SES) using Google Cloud Functions with a Pub/Sub trigger. I am assuming SNS would be just as easy.
However, I find it much easier to setup Google Cloud Functions to use an SMTP client to fire off an email. I have also used Twilio to fire off SMS text messages.
To use AWS SNS or SES, you will need to package the boto3 libraries with your deployment and your AWS credentials. You can also use the AWS REST interface so that no external libraries are required.
For an email SMTP client, Google Cloud Functions has smtplib
included, so this is a very easy path. You just need an email username and password to SMTP. For this I use Gmail or Office 365 credentials. 20 lines of python code and you are done.
[EDIT]
When using Google Cloud Functions to send email, use SSL for the transport. For Office 365 and Gmail this port 587. Do not attempt to use port 25, which does not use SSL, as almost everyone blocks port 25.