AWS Logo
Menu
3 Ws and H story of AWS containerization in AppMod

3 Ws and H story of AWS containerization in AppMod

Container Services for App Modernization

Published Oct 7, 2024

Some Backstory...

There is a belief in me that everyone follows the trend. And the trend is to write, play, experiment with AI/ML, GenAI. But my roots are still with application development, and that's what I enjoy the most.
While I struggled to pen down and finish my last blog on GenAI and AI (Thanks to lost access of GitHub) - I want to bring back everyone to the real world where 70% people are still struggling with Application modernization, move to cloud and adapting to the newer ways post Generative AI storm.
So with 2 of my most favorite technological things (Application Development and AWS) in mind, I thought to write a blog about containers and the variety of services AWS offers. And you know, remind people that the world still needs application modernization, cloud migration etc. - so don't leave your basics.

Some basics:

I don't need to tell my smart readers that AWS offers comprehensive services that can cater to any kind of containerization needs. All the services is designed to meet certain specific criteria and use cases. From managed solutions to highly customizable container orchestration platforms.
Now let me back the above sentence with some proof... ;-)
Image source: Here. Btw, the same link is where I found my inspiration to write this blog as well.
For the context of this blog, I'll first compare AWS’s popular containerization services (that I have used, that is... ;-) ), here they are:
  • Amazon Elastic Container Service (ECS)
  • Amazon Elastic Kubernetes Service (EKS),
  • AWS Fargate
  • Amazon Lightsail Containers.

Comparison Matrix:

Let's now dive into 3 Wives and a Husband (so many jokes comes to my mind - not the time and place.) that might arise during Migration or Modernization journey. I may add very simple fixes - but I am very confident that simple fixes are never applicable in real world - so please contact or write to me your unique problem, I will surely try and help out as much as I can.
CriteriaAmazon ECSAmazon EKSAWS FargateAmazon Lightsail Containers
Infrastructure ManagementManaged (with EC2 or Fargate options)Managed control plane, self-managed EC2 or Fargate nodesFully serverless, no infrastructure managementFully serverless, no infrastructure management
Orchestration SystemAWS-native container orchestrationKubernetesServerless execution, ECS/EKS integratedLightweight orchestration
DevOps ComplexityLowHigh (requires Kubernetes expertise)Very Low (no server management)Minimal (very basic dev-friendly setup)
Scalability
Scalability
CI/CD IntegrationExcellent (integrates well with CodePipeline, Jenkins, etc.)Complex (requires Kubernetes-native tools, Helm, etc.)Seamless integration with CodePipeline, CodeBuildBasic integration, more developer focused
Auto ScalingSupported (Manual for EC2)SupportedAutoAuto with pre-defined limits
Multi-cloud CompatibilityLimited to AWSExcellent for Cross Cloud, Hybrid Cloud and Multi CloudTightly coupled with AWSTightly coupled with AWS
Migration ComplexityFrom AWS to AWS - Easy, But from AWS to other - Moderate to high.Low if you know k8sFrom AWS to AWS - Less but from AWS to other - highVery High
Security & NetworkingAll AWS Managed Services can be leveragedAll AWS Managed Services can be leveraged but still needs something additional from Kubernetes standpointFully ManagedFully Managed
Large/Long running appsWell Suited specially with EC2 and its reserved instance setupYes - for all enterprise/large scale needsNo - best for short/on-demand tasks or jobsNo - only good for light weigh applications and tasks
Operation ComplexityLow with Fargate, Moderate with EC2Moderate to High - if you have decent understanding of KubernetesLow - Mostly Serverless but so is the application built on it. Not made for high workloadsLow - but same as Fargate. Best suited for light weight / small scale applications and tasks.
Long Term ResultsExcellent - specially with EC2Excellent - for all kinds of enterprisesExcellent - for serverless app but not for enterprisesModerately good - for small / light applications.
Monitoring & LoggingCloudWatch, CloudTrail, ECS task logs, VPC Flow logs etc..Best suited for Cloud native products like Prometheus etc..CloudWatch (Basic)CloudWatch (Basic)
Learning CurveLessSteep - Not made for faint-hearted... :DLowLow
Best Use CasesAWS-centric microservicesEnterprise App ModernizationSimple AWS-centric microservicesPrototyping or MVE (Minimum viable experimentation) products.

Amazon Elastic Container Service (ECS)

Amazon ECS is a fully managed container orchestration service that integrates closely with other AWS services, offering a simplified way to run and scale containerized applications.

Why choose ECS?

  • Tight AWS Integration: If your infrastructure is AWS-centric, ECS is a natural choice because it integrates seamlessly with services like Amazon CloudWatch, IAM, VPC, and ALB (Application Load Balancer).
  • Simplicity: ECS abstracts much of the complexity associated with container orchestration. It’s easier to use compared to Kubernetes for teams that don't require Kubernetes’s level of customization.
  • Support for Multiple Launch Types: ECS supports EC2 for managing underlying instances or Fargate for serverless containers.
  • Granular IAM Role Management: ECS allows per-task IAM roles, offering more fine-grained permissions.

ECS Sample Deployment

  1. Define a task definition JSON:
  1. Register the task definition:
  1. Create an ECS service to run the task:

Gotchas with ECS

  • Cluster Auto Scaling: Unlike EKS, ECS does not come with auto-scaling groups out of the box. You need to configure this manually if using the EC2 launch type.
  • Limited Flexibility: ECS is easier to use but less flexible than EKS, which may limit its use in complex, multi-cloud environments.

How to overcome these challenges?

  • Use AWS Auto Scaling: Use ECS’s integration with AWS Auto Scaling to ensure tasks and EC2 instances scale appropriately based on load.
  • Use Fargate for Less Management: If managing instances becomes cumbersome, migrate workloads to Fargate.

Amazon Elastic Kubernetes Service (EKS)

Amazon EKS is AWS's managed Kubernetes offering, allowing you to use Kubernetes for container orchestration. It’s ideal for teams already familiar with Kubernetes or those working in hybrid/multi-cloud environments.

Why choose EKS?

  • Kubernetes Compatibility: If you already use Kubernetes on-premises or in other clouds, EKS allows you to migrate without changing your workflow.
  • Highly Customizable: Kubernetes offers much more customization compared to ECS. This is useful for highly complex applications or those needing a specific configuration.
  • Multi-Cloud & Hybrid-Cloud: EKS is a strong choice when deploying across multiple clouds or in hybrid environments where consistency between on-premises and cloud is key.

EKS Sample Deployment

  1. Create an EKS Cluster:
  1. Deploy an application on the cluster using kubectl:
  1. Expose the deployment to the internet:

Gotchas with EKS

  • Learning Curve: Kubernetes has a steep learning curve and a complex operational model, which might delay migrations.
  • Management Overhead: Although EKS is managed, you are still responsible for scaling, security patches, and control plane configuration.
  • Cluster Auto-Scaling: Setting up Kubernetes cluster auto-scaling can be complex.

How to overcome these challenges?

  • Leverage EKS Blueprints: Use EKS Blueprints (Terraform or AWS CloudFormation templates) to set up clusters faster with best practices.
  • Managed Node Groups: Use managed node groups, which automatically take care of patching and updating EC2 instances in your Kubernetes cluster.

AWS Fargate

AWS Fargate is a serverless compute engine for containers that works with both ECS and EKS. It eliminates the need to manage servers, making it a perfect choice for teams wanting a "no infrastructure" container solution.

Why choose Fargate?

  • Serverless: No need to manage or provision EC2 instances. AWS automatically handles everything for you.
  • Cost-Effective for Small Workloads: For applications that don’t require constant uptime, Fargate can be more cost-effective than running EC2 instances.
  • Seamless Scaling: Fargate automatically scales your containers up and down based on demand.

Fargate Sample Deployment (using ECS)

  1. Define a task definition for Fargate:
  1. Run the task:

Gotchas with Fargate

  • Cold Start Latency: Fargate tasks can experience longer start times compared to ECS or EKS on EC2, particularly for the first start after a period of inactivity.
  • Cost Scaling: For long-running, high-throughput applications, Fargate might be more expensive than EC2-based ECS or EKS clusters.

How to overcome these challenges?

  • Use Fargate Spot Instances: Leverage Fargate Spot for fault-tolerant applications to reduce costs by up to 70%.
  • Optimize Container Start Times: Pre-warm containers by scheduling regular task invocations during low-traffic periods.

Amazon Lightsail Containers

Lightsail Containers is AWS’s simplified service for developers who want to deploy lightweight containerized applications without diving deep into infrastructure management.

Why choose Lightsail Containers?

  • Easy to Use: Lightsail is designed for developers who need to get applications up and running quickly.
  • Great for Prototyping: Ideal for smaller applications, testing, or development environments where ease of use matters more than fine-grained control.

Lightsail Sample Deployment

  1. Create a container service:
  1. Deploy a container:

Gotchas with Lightsail

  • Limited Customization: Lightsail is designed for simplicity, which can be limiting for advanced use cases requiring fine-grained control.
  • Scaling Limitations: While Lightsail supports scaling, it’s not designed for massive enterprise-scale applications.

How to overcome these challenges?

  • Migrate to ECS/Fargate: Once the application outgrows Lightsail, you have to migrate to ECS or Fargate for more flexibility and scalability.

Caution and Conclusion

Your use case matters alot when making decisions as Architect but below is a little summary helpful guide or above story:
  • Choose ECS for AWS-centric workloads and simplicity.
  • Choose EKS if you need Kubernetes or operate in a multi-cloud environment.
  • Choose Fargate when you prefer a serverless solution without infrastructure management.
  • Choose Lightsail for lightweight applications or quick deployments.
As with any cloud journey, there are gotchas, but with careful planning, automation, and optimization, these can be mitigated.

Generative AI's role:

Ah yes - I forgot - Generative AI and Tools developed using it will have a huge say in this area going forward. Small application migrations can very easily be automated upto 50% using these tools.
More info on how GenAI will have a say - may be next time... This already has become a long blog.. :D

 

Comments