The "cloud native" way of doing this is to use a queue.
It's not detailed in the question but my guess here is that there is a single submission to the application which is intended to cause a single email email notification. But the submission is (probably) stored in a database somewhere and when all of the instances run their cron jobs they all pick up the job out of the database and all send emails.
Instead: Have the submission of the job create a message in SQS and have the email notification system retrieve it from SQS. Even if there are multiple instances running the notification code only one of them will ever receive the SQS message - that's how the service is designed.
Brettskis SQS Solution is probably the correct and more robust solution at scale. However, it could be a bit lite over-engineer for such an easy task.
Just create an endpoint in your service for "notifications" (the same function that your cron job triggered), then have a cron job in cloud watch event bridge trigger it using SNS, or go via a private lambda if it's a private endpoint. T
This way, only one request will be sent even if you have multiple EC2s, and it's easy to test and trigger add hoc "notifications". And you won't have to spend money on SQS pooling (keep in mind that SQS pooling blooks one thread in your machine).
Hope this helps!
Email notifications with re:PostEXPERTasked a year ago
Question about EmailAccepted Answerasked 2 years ago
How associate one alarm with multiple instances?asked an hour ago
AWS SES email not received by recipientasked 8 months ago
Email abuse report - Amazon SESasked 6 months ago
how to use use multiple usage plans for the same API ?asked 11 hours ago
App settings: Email notifications problemasked 4 years ago
Cognito pool allows duplicate confirmed email address aliasesasked a year ago
How to fix duplicate transactional email issue caused by multiple EC2 instances?asked 12 days ago
Are multiple SPARL update queries in same POST message one transaction?asked 3 years ago