Objective: Create an Amazon EventBridge Rule
DailyDynamoDBBackupto trigger the Lambda functionBackupDynamoDBAndSendEmail(created in section 3.3, configured in section 8.1) on a scheduled basis, automatically backing up data from the DynamoDB tablestudentDatato the S3 Bucketstudent-backup-20250706(section 6.5) and sending notification emails via Amazon SES. The schedule runs daily at 07:00 AM +07 (00:00 UTC) with a flexible time window of 5 minutes, ensuring integration with the serverless system and the web interface via CloudFront.
BackupDynamoDBAndSendEmail periodically (daily at 07:00 AM +07, i.e., 00:00 UTC).student-backup-20250706, and sends notification emails via SES, reducing manual intervention.0 0 * * ? * and a 5-minute Flexible Time Window to optimize performance.StudentWebsiteDistribution, sections 7.1–7.3) from S3 student-management-website-2025 (sections 6.1–6.4) calls the student API (stage prod, section 4.8) with Invoke URL (e.g., https://abc123.execute-api.us-east-1.amazonaws.com/prod) and StudentApiKey (section 4.2).studentData and send email via SES.student-backup-20250706 and send notification email.https://d12345678.cloudfront.net).DynamoDBBackupRoleStudent (section 6.5) grants Lambda access to DynamoDB, S3, SES.Amazon_EventBridge_Scheduler_LAMBDA_7e5e967abf to trigger Lambda.You need to complete:
student-backup-20250706.BackupDynamoDBAndSendEmail with role DynamoDBBackupRoleStudent.student API, StudentApiKey, StudentUsagePlan, GET /students, POST /students, POST /backup methods, enable CORS, deploy the prod stage.index.html, styles.css, scripts.js).student-management-website-2025 and student-backup-20250706.StudentWebsiteDistribution.BackupDynamoDBAndSendEmail with 128 MB Memory, 512 MB Ephemeral Storage, role DynamoDBBackupRoleStudent, and environment variables S3_BUCKET_NAME, SENDER_EMAIL, RECIPIENT_EMAIL.events:PutRule, events:PutTargets, iam:CreateRole, iam:PassRole, and the AWS region is us-east-1.Access AWS Management Console and Amazon EventBridge
us-east-1 to synchronize with DynamoDB studentData, S3 (student-management-website-2025, student-backup-20250706), Lambda, API Gateway, SES, CloudFront.
Select Rules

Configure the Rule
DailyDynamoDBBackup (reflects daily backup purpose).
Set the Schedule
0 0 * * ? * (runs at 00:00 UTC, i.e., 07:00 AM +07, every day).
0 0 * * ? * = minute 0, hour 0, every day/month, any day of week, every year.0 0 * * SUN.
Configure Flexible Time Window
studentData, does not affect timeliness.
Select Target API
BackupDynamoDBAndSendEmail is the backup execution target.
Select Lambda Function
BackupDynamoDBAndSendEmail.us-east-1 and you have lambda:ListFunctions permission.
Configure Execution Role
Amazon_EventBridge_Scheduler_LAMBDA_7e5e967abf.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:us-east-1:<AWS_ACCOUNT_ID>:function:BackupDynamoDBAndSendEmail",
"Principal": {"Service": "scheduler.amazonaws.com"}
}
]
}
<AWS_ACCOUNT_ID> with your AWS account ID.
Review and Create Schedule
DailyDynamoDBBackup.cron(0 0 * * ? *).BackupDynamoDBAndSendEmail.
Check the Rule
DailyDynamoDBBackup with:
cron(0 0 * * ? *).BackupDynamoDBAndSendEmail.DailyDynamoDBBackup > Edit > Schedule pattern, enter */5 * * * ? *, click Update rule.student-backup-20250706 for a JSON file (e.g., students-backup-20250708T0700.json).admin@studentapp.com with subject Backup Completed: students-backup-20250708T0700.json and body Backup saved to s3://student-backup-20250706/students-backup-20250708T0700.json.fields @timestamp, @message
| filter @message like /Backup completed/
| sort @timestamp desc
Amazon_EventBridge_Scheduler_LAMBDA_7e5e967abf has lambda:InvokeFunction permission.DynamoDBBackupRoleStudent has dynamodb:Scan, s3:PutObject, ses:SendEmail permissions (section 8.1).student-backup-20250706 bucket and Bucket Policy (section 6.5):
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowLambdaPutObject",
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/DynamoDBBackupRoleStudent"},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::student-backup-20250706/*"
}
]
}
<AWS_ACCOUNT_ID> with your AWS account ID.no-reply@studentapp.com, admin@studentapp.com in SES (section 3).ses:SendEmail permission in DynamoDBBackupRoleStudent.0 0 * * ? *.
| Factor | Details |
|---|---|
| Security | - Ensure the role Amazon_EventBridge_Scheduler_LAMBDA_7e5e967abf only grants lambda:InvokeFunction permission for BackupDynamoDBAndSendEmail. - Do not embed StudentApiKey in scripts.js. Use CloudFront Functions: javascript <br> function handler(event) { <br> var request = event.request; <br> request.headers['x-api-key'] = { value: 'xxxxxxxxxxxxxxxxxxxx' }; <br> return request; <br> } <br> |
| Optimization | - Enable CloudWatch Logs for Lambda (section 8.1). - Check the rule using AWS CLI: bash <br> aws events describe-rule --name DailyDynamoDBBackup <br> |
| Integration | - Verify CORS in API Gateway (section 4.7): Access-Control-Allow-Origin: https://d12345678.cloudfront.net. - Test the POST /backup endpoint via CloudFront URL to ensure integration with the web interface. |
| Integration Testing | - Access the CloudFront URL (https://d12345678.cloudfront.net): - POST /students: Save record, send SES email. - GET /students: Display table. - POST /backup: Create file in student-backup-20250706, send email. - Use Developer Tools > Network to inspect API requests. |
| Error Handling | - Rule not running: Check Enabled status, events:PutRule, events:PutTargets permissions. - Lambda error: Check CloudWatch logs, DynamoDBBackupRoleStudent permissions. - File not appearing: Verify student-backup-20250706 bucket policy. - Email not sent: Verify SES email and ses:SendEmail permission. |
Best practice tip: Test the rule immediately with schedule
*/5 * * * ? *, then revert to0 0 * * ? *. Check CloudWatch Logs and S3 to verify backup. Configure S3 Lifecycle Rule forstudent-backup-20250706to manage old files.
The DailyDynamoDBBackup rule is created to trigger the Lambda BackupDynamoDBAndSendEmail daily at 07:00 AM +07, saving data from DynamoDB studentData to S3 student-backup-20250706 and sending email via SES. The system is integrated with the student API and the web interface via CloudFront.
Next step: Monitor backups in S3 and SES emails,