|
| 1 | +# Redis Sync Lambda |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +**Redis Sync** is an AWS Lambda function designed to monitor a configuration S3 bucket and synchronize its contents with an ElastiCache Redis instance. Whenever a new configuration file is uploaded or updated in the S3 bucket, the Lambda function processes the file, applies any required transformations, and uploads the result to the Redis cache. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- **S3 Event Driven:** Automatically triggered by S3 events (e.g., file uploads or updates) in the config bucket. |
| 10 | +- **Transformation Support:** Applies custom transformation logic to configuration files before caching. |
| 11 | +- **Redis Integration:** Uploads processed configuration data to ElastiCache Redis for fast, centralized access. |
| 12 | +- **Logging:** Provides detailed logging for monitoring and troubleshooting. |
| 13 | + |
| 14 | +## How It Works |
| 15 | + |
| 16 | +1. **S3 Event Trigger:** The Lambda is triggered by S3 events on the config bucket. |
| 17 | +2. **File Processing:** The Lambda reads the new or updated file from S3. |
| 18 | +3. **Transformation:** If required, the file content is transformed to the appropriate format. |
| 19 | +4. **Redis Upload:** The transformed data is uploaded to the Redis cache under a key corresponding to the file. |
| 20 | +5. **Monitoring:** Logs are generated for each step, aiding in monitoring and debugging. |
| 21 | + |
| 22 | +## Configuration |
| 23 | + |
| 24 | +- **Environment Variables:** |
| 25 | + - `CONFIG_BUCKET_NAME`: Name of the S3 bucket to monitor. |
| 26 | + - `AWS_REGION`: AWS region for S3 and Redis. |
| 27 | + - `REDIS_HOST`: Redis endpoint. |
| 28 | + - `REDIS_PORT`: Redis port (default: 6379). |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +1. **Deploy the Lambda** using your preferred IaC tool (e.g., Terraform, AWS SAM). |
| 33 | +2. **Configure S3 event notifications** to trigger the Lambda on object creation or update. |
| 34 | +3. **Ensure Redis and S3 permissions** are set for the Lambda execution role. |
| 35 | + |
| 36 | +## Development |
| 37 | + |
| 38 | +- Code is located in the `src/` directory. |
| 39 | +- Unit tests are in the `tests/` directory. |
| 40 | +- Use the provided Makefile and Dockerfile for building, testing, and packaging. |
| 41 | + |
| 42 | +## License |
| 43 | + |
| 44 | +This project is maintained by NHS. See [LICENSE](../LICENSE) for details. |
0 commit comments