1

I have to send a mail to the support team in my organization whenever the RDS databases are created right now I am using the lambda function which is getting triggered by the eventbridge rule through CreateDBInstance event but the ask is I want to send a mail only when the database is in available state. I have multiple accounts which the users would be spinning up multiple databses is there any efficient way that I can send the mail only when the database status is available.

I have created a lambda function which is getting triggered by a eventbridge rule but it is sending when the rds database is still in the creating process.

3
  • You need to implement some sort of backoff on the event so that you can check it's actual availability status and retry the event some time a little later. SQS would be one method to give you the ability to manage event reprocessing (docs.aws.amazon.com/lambda/latest/dg/with-sqs.html) Commented Nov 7, 2023 at 15:12
  • Just a question for clarity since I'm not an expert on the RDS side: you'll only ever get one cluster created event (ID RDS-EVENT-0170) per cluster, i.e., there's no additional events when the cluster state changes from say provisioning to running? Commented Nov 8, 2023 at 7:38
  • The problem with rds event is that the events keep on generating until the life of the rds instance or cluster. Commented Nov 9, 2023 at 12:21

1 Answer 1

0

Instead of setting a single rule, why not set EventBridge Cron job, in which it invokes a Lambda function, which polls the RDS status. Should it not be ready, the Lambda simply quits.

When RDS is finally up, Lambda sends the email and then deletes the EventBridge Cron job.

https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule-schedule.html

Sign up to request clarification or add additional context in comments.

2 Comments

I want to send the database availability in the real time. The users who create the database tend to delete them as soon as the usecase is fullfilled.
It can be realtime, poll it every second if you like. It's up to you the rate of polling. But the bottom line is there is no event fired when a database becomes active.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.