Add SNS Notification Support, Region Configuration, and Local Testing Script to MongoDB Backup Lambda #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR enhances the MongoDB backup Lambda function with the following features:
test-local.jsto allow local execution and debugging of the Lambda function..envfile and README have been updated to reflect new configuration options and usage instructions.Detailed Changes
1.
index.jsnotifySNShelper function to send notifications to the configured SNS topic.notifySNSwith appropriate messages.2.
.envSNS_TOPIC_ARNfor specifying the SNS topic to send notifications to.AWS_REGIONfor specifying the AWS region used by the SDK.3.
test-local.js.envusingdotenv.How to Use
Configure Environment Variables:
SNS_TOPIC_ARNto your SNS topic ARN (e.g.,arn:aws:sns:us-east-1:xxxxxxxxxxxx:mongodb-backup-events).AWS_REGIONto your preferred AWS region (e.g.,us-east-1).SNS Setup:
Deploy & Test:
Example
.envAdditionsFiles Changed
index.js– Main Lambda logic, SNS integration, region support, improved error handling..env– Added SNS and region configuration variables.test-local.js– Added for local development and debugging.Notes
SNS_TOPIC_ARNis not set, SNS notifications are skipped with a warning.AWS_REGIONis not set, it defaults tous-east-1.