Skip to content

Instantly share code, notes, and snippets.

@ninadnaik10
Last active May 21, 2025 15:50
Show Gist options
  • Select an option

  • Save ninadnaik10/7e9faf7f9d68035a5fe5a89a3a599c0d to your computer and use it in GitHub Desktop.

Select an option

Save ninadnaik10/7e9faf7f9d68035a5fe5a89a3a599c0d to your computer and use it in GitHub Desktop.
Arxena internship - cloud infrastructure cost saving

Arxena Internship: Cloud Infrastructure Optimizations and Cost Savings

Two key optimizations were implemented to reduce EC2 instance costs and improve operational efficiency for backend services.

Optimization 1: Consolidating Arxena Backend Python Instances

  • Previous Setup: The Arxena Backend Python service was initially distributed across multiple smaller EC2 instances: one t2.micro, two t2.small, and one t2.medium. This configuration had a combined on-demand cost of $0.104 per hour.
  • New Setup: To simplify management and potentially optimize resource utilization, these instances were consolidated into a single t2.large instance.
  • Cost Impact: The new t2.large instance costs $0.0928 per hour. This change resulted in a direct hourly saving of $0.0112, representing a 10.8% reduction in hourly costs for this service.

Cost Breakdown: Arxena Backend Python

Configuration Instance Type Count On-Demand Price/hr Total Cost/hr
Original t2.micro 1 $0.0116 $0.0116
t2.small 2 $0.023 $0.046
t2.medium 1 $0.0464 $0.0464
Original Total $0.104
New t2.large 1 $0.0928 $0.0928
New Total $0.0928
Savings $0.0112/hr
Savings % 10.8%

Optimization 2: Decoupling Build and Serve Processes for NestJS (Twenty CRM) Application

  • Previous Setup: The NestJS (Twenty CRM) application and its CI/CD build process were both handled on a single t2.large EC2 instance. This led to two main issues:
    1. Performance Disruption: During CI/CD tasks, high CPU and RAM usage significantly impacted the live application's performance.
    2. Cost Inefficiency: The t2.large instance was oversized for simply serving the application when builds were not running, leading to unnecessary expenditure.
  • New Setup: To address these issues, the application serving and build processes were decoupled:
    1. The application is now served from a smaller, more appropriately sized t2.small instance.
    2. A bash script was developed to manage deployments: it provisions a t2.large instance from an existing Amazon Machine Image on-demand for the build process, transfers the compiled application files using SCP to the t2.small serving instance, and then terminates the temporary t2.large instance once the build is complete.
  • Cost Impact (Application Serving): By rightsizing the application server from a t2.large (costing $0.0928/hr) to a t2.small (costing $0.023/hr), the continuous running cost for the application server has been significantly reduced. This yields an hourly saving of $0.0698, a 75% reduction in the server's operational cost. The temporary t2.large instance used for builds operates for only a few minutes during deployments, which occur occasionally, making its contribution to overall costs negligible.

Cost Breakdown: NestJS (Twenty CRM) Application Server

Configuration Instance Type Count On-Demand Price/hr Total Cost/hr
Original t2.large 1 $0.0928 $0.0928
Original Total $0.0928
New t2.small 1 $0.023 $0.023
New Total $0.023
Savings $0.0698/hr
Savings % 75%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment