Dynamic Email Groups for Reporting Tool
Introduction
The reporting tool has been enhanced with a new dynamic email management system. This update introduces a more flexible and maintainable way to manage email notifications for different reporting groups using DynamoDB, replacing the previous static configuration approach.
Features
Dynamic Email Management
- New DynamoDB Table: Introduced a new DynamoDB table (
reporting-{environment}-group-emails
) to store email configurations for different groups - Flexible Email Configuration: Each group can now have its own set of email recipients
- Improved Error Handling: Enhanced error reporting for missing or invalid email configurations
Architecture Improvements
- Removed hardcoded email parameters from CloudFormation templates
- Simplified deployment configuration by eliminating the need for email parameters in environment configurations
- Improved separation of concerns between group configuration and email management
Examples
DynamoDB Table Structure
The new email configuration is stored in DynamoDB with a simple schema:
{
"group": "string", // Primary key - group name
"emails": ["string"] // List of email addresses for the group
}
Behavior Examples
When Emails are Configured
When a group has email recipients configured, the system will:
- Generate the report
- Save it to S3
- Send email notifications to all configured recipients
Example log output:
[INFO] CSV file created at backups/AllContracts/daily_backup_report.csv with 5 records
[INFO] Email sent successfully to recipient@example.com
When Emails are Not Configured
If a group doesn’t have any email recipients configured, the system will:
- Generate the report
- Save it to S3
- Log a warning message
Example log output:
[ERROR] No email provided for group Internal
Conclusion
This update significantly improves the flexibility and maintainability of email notifications in the reporting tool. Teams can now manage email recipients for different groups independently through DynamoDB, without requiring deployment changes.
Next Steps
- Configure email recipients for your reporting groups in the new DynamoDB table
- Review and update any existing automation that may have depended on the previous email configuration method
- Monitor the CloudWatch logs for any email delivery issues or configuration problems