Elastic Infrastructure on AWS
Start-up

Elastic Infrastructure on AWS

Scalable, reliable & cost effective

Marco Kuendig
Marco Kuendig
CTO & Owner

At copebit, we specialize in constructing elastic infrastructure solutions, leveraging cloud-native technologies to optimize performance and cost-efficiency for our clients. Our core expertise lies in containerization with Kubernetes (especially AWS EKS), and implementing scalable solutions for compute resources, caching, and databases.

Building Well-Architected Environments

When creating environments like these, our process begins with thorough discovery sessions to analyze the requirements. These sessions ensure we understand the client's needs before we design and build the AWS infrastructure accordingly.

Potential Applications of Elastic Infrastructure

Technology Stack and Architecture

The provided image depicts an example AWS environment hosting a PHP application on virtual machines. This setup utilizes various AWS services including EC2 Autoscaling, Aurora Serverless v2, and Elasticache Serverless, all of which can be configured to dynamically scale resources in response to application, cache, and database demands.

AWS has simplified the creation of such elastic infrastructures, offering a wide range of autoscaled managed services. This eliminates the complexities of coordination, application-specific knowledge, and maintenance that were previously associated with building and managing such environments. With AWS and infrastructure as code, it is now possible to quickly deploy and manage scalable and elastic environments.

What is AutoScaling

Autoscaling groups systems together and scales them based on demand. A load balancer distributes traffic across instances, and autoscaling intelligence measures demand (CPU, memory, or connections on the load balancer). Scaling policies then adjust the number of instances or resources.

Autoscaling on EC2

EC2 Autoscaling is an effective tool for scaling virtual machines. It seamlessly integrates with EC2 instances, Auto Scaling Groups, Launch Templates, and Load Balancers. Your application must be designed to support autoscaling, ideally adhering to the 12-Factor App methodology.

Sample Terraform code of a scaling policy:

Autoscaling on Kubernetes

To efficiently scale applications on AWS EKS, we use Karpenter. Karpenter is an open-source autoscaling solution that works exceptionally well with Spot Instances.

Benefits of Karpenter

  • Rapid Scaling: Quickly responds to scaling events.

  • Cloud-Native Integration: Functions as a native Kubernetes element.

  • Open Source: Freely available and community-supported.

  • Spot Instances Compatibility: Optimizes costs with Spot Instances.

  • Secure and Reliable: Ensures robust security and reliability.

Sample Karpenter nodepool configuration:

How to scale Databases

AWS has offered various types of elastic databases for several years: NoSQL with DynamoDB, SQL with MySQL and Postgres, and GraphDB with Neptune.

Elastic SQL Databases

Aurora Serverless v2, which we use for all customers who need SQL and use Postgres or MySQL, is an excellent service. Aurora has separate compute and storage layers. Since Serverless V2, compute scaling has been very good, scaling up and down very rapidly. In the best case, Serverless V2 can scale up within 100ms using the new Caspian technology.

Database scaling Demo

This video demonstrates the seamless and fully elastic scaling of Aurora serverless v2. The database scales up rapidly in response to increased demand, and scales down automatically a few minutes after the load subsides.

We use the sysbench utility, running on an EKS AutoMode cluster with an active Nodepool, to simulate load. The sysbench utility launches 100 threads that send numerous requests to the database. Within a few dozens of seconds, the capacity section of the metrics shows that the database has automatically scaled.

The video also shows how scaling down occurred seamlessly in a previous test without any manual intervention.

Sample Terraform code to deploy an Aurora Serverless v2:

Caching Scaling

Elasticache Serverless, a fully managed service for caching with MemCache or Redis, has been available for approximately a year. It leverages AWS’s Caspian Technology to dynamically add CPU and other resources, enabling instant scaling of the underlying instances. Additionally, sharding can be used with Redis to create a cluster capable of scaling to even greater levels. Elasticache Serverless simplifies cache cluster management and offers faster and more efficient scaling compared to instance-based scaling, supporting both Redis and Memcache for various applications.

Scaling-up happens almost instantly, but scaling-down, similar to Aurora, requires replacing the underlying instance, since utilized memory cannot be removed from a service.

Summary of elastic AWS services

  • Compute: Virtual Machines with EC2 AutoScaling, Containers with ECS AutoScaling, Containers with Karpenter on EKS, Serverless with Lambda

  • Databases: NoSQL with DynamoDB AutoScaling, SQL with MySQL and Postgres on Aurora Serverless v2, Graph Databases with Neptune

  • Caching: Elasticache Serverless

  • Search: OpenSearch Serverless

  • Messaging: Kafka MSK Serverless

Conclusion

At copebit, we build cloud infrastructure that is both scalable and cost-effective. We leverage Kubernetes and other cloud-native technologies on AWS. We take the complexity out of building and managing cloud infrastructure so you can focus on what matters most — your business!

blog.aboutAuthor

Marco Kuendig
Marco Kuendig
CTO & Owner

He's the CTO & co-owner at copebit AG. He's highly certified, a Kubestronaut and an AWS Ambassador

blog.linkedInProfile