VCC Assignment 3: Create a Local VM and Auto-Scale It to Any Public Cloud Platform When Resource Usage Exceeds 75% in Local VM
Student Name: Ashutosh Nigam
Roll Number: M25AI2006
Course: Virtual Cloud Computing (VCC)
Cloud: Amazon Web Services (AWS)
Assignment Report: M25AI2006_Assignment_3.pdf
Create a local VM and implement a mechanism to monitor resource usage. Configure it to auto-scale to a public cloud (e.g., GCP, AWS, or Azure) when resource usage exceeds 75%.
- Set up a local virtual machine environment
- Implement real-time resource monitoring for CPU and Memory
- Configure auto-scaling policies that trigger cloud deployment when local resources exceed 75% utilization
- Demonstrate the complete workflow from local deployment to cloud migration
- Provide comprehensive documentation and demonstration of the system
This ASP.NET Core Web API application serves as a System Resource Monitor and Load Generator designed to test and demonstrate hybrid cloud auto-scaling capabilities. The application provides endpoints to:
- Monitor system resources (CPU, Memory)
- Trigger controlled CPU spikes
- Trigger controlled Memory spikes
- Provide real-time system status
This API acts as the core application deployed on a local VM that can be monitored by tools like Prometheus/Grafana, which then trigger auto-scaling to cloud platforms when resource thresholds are exceeded.
- Framework: ASP.NET Core 8.0
- Language: C# with .NET 8.0
- API Documentation: Swagger/OpenAPI
- Architecture: RESTful Web API
Before running this application, ensure you have:
- .NET 8.0 SDK installed
- Windows, Linux, or macOS operating system
- A code editor (Visual Studio, VS Code, or Rider recommended)
- Postman or similar tool for API testing (optional, Swagger UI included)
-
Clone or navigate to the project directory:
cd VCC.Assignment3 -
Restore dependencies:
dotnet restore
-
Build the project:
dotnet build
-
Run the application:
dotnet run
-
Access the application:
- Swagger UI: http://localhost:5000/swagger or https://localhost:5001/swagger
- API Base URL: http://localhost:5000/api or https://localhost:5001/api
- Open
VCC.Assignment3.slnin Visual Studio - Press
F5to run with debugging orCtrl+F5to run without debugging - Browser will automatically open with Swagger UI
Check if the API is running.
Response:
{
"status": "API is running"
}Get current system resource information.
Response:
{
"systemName": "Microsoft Windows 10...",
"osArchitecture": "X64",
"frameworkDescription": ".NET 8.0.0",
"processorCount": 8,
"systemUptime": "01.12:34:56",
"totalMemoryGB": 16.0,
"usedMemoryGB": 8.5,
"memoryUsagePercent": 53.12
}Trigger a controlled memory spike for testing auto-scaling.
Query Parameters:
spikeSize(optional): Size of memory to allocateSmall_500MB(default): 500 MBMedium_1GB: 1 GBLarge_2GB: 2 GBXLarge_3GB: 3 GBXXLarge_4GB: 4 GB
Example:
POST http://localhost:5000/api/system/memory-spike?spikeSize=Medium_1GB
Response:
{
"message": "Memory spike triggered",
"sizeAllocatedMB": 1024,
"chunks": 102
}Trigger a controlled CPU spike for testing auto-scaling.
Query Parameters:
duration(optional): Duration of CPU spikeShort_5Seconds(default): 5 secondsMedium_10Seconds: 10 secondsLong_15Seconds: 15 secondsXLong_30Seconds: 30 secondsXXLong_60Seconds: 60 secondsXXLong_120Seconds= 120,XXLong_240Seconds= 240
Example:
POST http://localhost:5000/api/system/cpu-spike?duration=Medium_10Seconds
Response:
{
"message": "CPU spike triggered",
"durationSeconds": 10,
"actualDurationMs": 10005,
"cpuUtilizationTarget": "80%",
"threadsUsed": 6,
"totalProcessors": 8
}- Run the application
- Navigate to http://localhost:5000/swagger
- Expand any endpoint and click "Try it out"
- Modify parameters if needed and click "Execute"
- View the response below
VCC.Assignment3/
│
├── Controllers/
│ └── SystemController.cs # API endpoints for system monitoring and load generation
│
├── Properties/
│ └── launchSettings.json # Application launch configuration
│
├── appsettings.json # Application configuration
├── appsettings.Development.json # Development environment settings
├── Program.cs # Application entry point and configuration
├── VCC.Assignment3.csproj # Project file
└── README.md # This file
Student: Ashutosh Nigam
Roll Number: M25AI2006
- ASP.NET Core Documentation
- Prometheus & Grafana Community
- Virtual Cloud Computing Course Materials
- How to Install and Configure Prometheus and Grafana on Ubuntu
- Node Exporter Full
- Installing Grafana
- Prometheus vs Grafana
