In this assignment, you will build a serverless solution to monitor AWS Reserved Instances across multiple services and alert stakeholders before reservations expire. Reserved Instances offer significant cost savings (up to 75%) compared to on-demand pricing, but if not renewed in time, they can lead to unexpected cost increases.
The Lambda-based solution does the following:
- Collects data about active reserved instances across multiple AWS services
- Identifies reservations nearing expiration (7 days and 1 day warnings)
- Sends properly formatted alerts via either SNS or SQS
- Includes proper error handling and logging
- Uses IAM roles with least privilege permissions
- Technical Components
- AWS Lambda function with Python runtime
- IAM roles and policies
- SNS/SQS for notifications
- AWS SDK (boto3) for service interaction
This assignment will strengthen your understanding of:
- AWS cost optimization strategies
- Serverless architecture patterns
- AWS resource monitoring
- Best practices for alerting and notification systems
- IAM security principles
Upon completion, you will have built a practical solution that addresses a common cloud operations challenge while gaining hands-on experience with key AWS services.
Assignment 1: Create an EventBridge Rule for Daily Execution Create an EventBridge rule that runs every 24 hours to trigger the instance reservation alerter Lambda function.
Requirements:
Use Terraform to define the EventBridge rule Configure the rule to run once every 24 hours using an expression. Name the rule following the pattern instance_reservation_alerter_daily_trigger
Assignment 2: Create a Code Change Trigger Configure a Lambda deployment trigger that automatically runs the function after code changes are deployed.
Requirements:
Ensure the function executes once after each code update
Assignment 3: Conditional SNS Topic Creation Create an SNS topic only if the client is not a managed services client.
Requirements:
Add a new variable is_managed_services Create SNS topic only when is_managed_services is false Name the SNS topic with a standard pattern including the client name
Assignment 4: Update Lambda Role Permissions Enhance the Lambda IAM role with proper permissions to read reservation information from all relevant services.
Requirements:
- Add permissions to describe reserved instances from EC2, RDS, and RedShift
- Ensure the role has STS permissions to get account identity