A certain company needs a new HR system for managing its employees, salaries, vacations and payments.
Web-based system with the following capabilities:
- Perform CRUD operations on employees
- Support file attachments
- Allow managers to request employee salary changes
- Allow HR manager to approve or reject salary change requests
- Support file attachments
- Manage vacation days
- Support file attachments
- Use external payment system
- Classic information system
- Not a lot of users
- Not a lot of data
- Interface to external system
- Technology: Legacy system written in C
- Communication: File-based (input only)
- Frequency: Files received once a month
- Manages DNS records for the HR system domain.
- Resolves user requests to CloudFront.
- Provides SSL/TLS certificates for HTTPS.
- Secures communication between users and the system.
- Serves the frontend PWA from Amazon S3.
- Caches static assets such as:
- JavaScript
- CSS
- Images
- Documents
- Reduces latency and improves load times by serving content closer to users.
- Single entry point for all backend APIs.
- Routes requests to the correct Lambda service.
- Can handle:
- Authentication
- Authorization
- Throttling
- Request validation
- Monitoring
Separate Lambda functions are used for:
- Employee Management
- Salary Management
- Vacation Management
- Cost efficient for low-traffic systems
- No need to manage servers
- Automatically scales
- Pay only when functions are invoked
- Lambda may have cold start delays after inactivity.
- Acceptable for this HR system because:
- HR operations are administrative tasks
- Not customer-facing real-time operations
- Small delays are acceptable
- Backend Lambdas run inside a VPC.
- The database is placed in a private subnet.
- The database is not publicly accessible from the internet.
- Only backend services inside the VPC can access the database.
- Relational database fits the HR system data model well.
- Suitable for:
- Employees
- Salaries
- Vacation records
- Approval workflows
- Payment records
- File attachments are stored in S3 instead of the database.
- Backend generates pre-signed URLs.
- Frontend uploads files directly to S3.
- Reduces backend workload
- Avoids sending large files through Lambda
- More scalable and efficient
EventBridge Scheduler + Scheduled AWS Lambda + S3
- EventBridge Scheduler triggers a Lambda function once per month.
- The Lambda retrieves approved payment data from Amazon RDS.
- The Lambda generates the payment file required by the legacy external system.
- The generated file is stored in an S3 payment file bucket.
- The external payment system reads or imports the file from S3.
- This fits the requirement because the external system communicates through file-based input, not direct API calls.
sequenceDiagram
autonumber
actor User
participant R53 as Route 53
participant CF as CloudFront
participant S3Frontend as S3 Frontend PWA
participant API as API Gateway
participant Emp as Employee Lambda
participant Salary as Salary Lambda
participant Vacation as Vacation Lambda
participant DB as Amazon RDS
participant FileS3 as S3 File Storage
User->>R53: Access HR System
R53->>CF: Resolve domain
CF->>S3Frontend: Request frontend assets
S3Frontend-->>CF: Return HTML/CSS/JS
CF-->>User: Load PWA
User->>API: Send API request
alt Employee Management
API->>Emp: Forward employee request
Emp->>DB: CRUD employee data
DB-->>Emp: Return result
Emp-->>API: Response
end
alt Salary Management
API->>Salary: Forward salary request
Salary->>DB: Process salary workflow
DB-->>Salary: Return result
Salary-->>API: Response
end
alt Vacation Management
API->>Vacation: Forward vacation request
Vacation->>DB: Manage vacation records
DB-->>Vacation: Return result
Vacation-->>API: Response
end
User->>API: Request pre-signed upload URL
API->>Emp: Generate S3 pre-signed URL
Emp-->>API: Return upload URL
API-->>User: Return upload URL
User->>FileS3: Upload attachment directly
sequenceDiagram
autonumber
participant Scheduler as EventBridge Scheduler
participant PaymentLambda as Scheduled Payment Lambda
participant DB as Amazon RDS
participant S3 as S3 Payment File Bucket
participant External as External Payment System
Scheduler->>PaymentLambda: Trigger monthly payment export
PaymentLambda->>DB: Retrieve approved payment data
DB-->>PaymentLambda: Return payment data
PaymentLambda->>PaymentLambda: Generate payment file
PaymentLambda->>S3: Upload payment file
External->>S3: Read / pull payment file
S3-->>External: Return payment file