Skip to content

lambda to eks pod migration

0

We have a requirement of converting existing lambdas into eks container (1 container a pod ). We have all the setup of eks pod creations and we have been working with pods for quite some time now. But converting lambdas into pods looks bit challenging.

  1. how trigger points like eventbridge, sqs can be managed?
  2. how sqs polling, timeouts will be setup with pods?
  3. how scaling will be managed etc.? Do we have a best way to do that?

Can i have now 2 containers, one (sidecar) for interacting with eventbridge (interacts earlier with lambda), second for main app logic for each lambda ?

2 Answers
0

Converting AWS Lambda functions to EKS pods requires careful consideration of several aspects:

  1. For trigger points like EventBridge and SQS:
  • You can implement controllers or operators in Kubernetes that listen to AWS events
  • Use AWS Event Source for Kubernetes to connect event sources to your pods
  • Implement a sidecar pattern where a container in your pod connects to AWS services and forwards events to your application container
  1. For SQS polling and timeouts:
  • Implement a consumer application in your pod that polls SQS queues
  • Configure appropriate visibility timeouts in your application code
  • Use backoff strategies for polling to avoid excessive API calls
  • Implement proper error handling and dead-letter queues
  1. For scaling:
  • Use Horizontal Pod Autoscaler (HPA) to scale based on CPU/memory metrics
  • Consider implementing custom metrics adapters to scale based on queue length
  • Use Vertical Pod Autoscaler to optimize CPU and memory allocation
  • For event-driven workloads, KEDA (Kubernetes Event-driven Autoscaling) can help scale based on event sources

When migrating from Lambda to EKS, consider these best practices:

  • Start with a hybrid approach, gradually shifting traffic from Lambda to EKS
  • Use TargetGroupBinding from AWS Load Balancer Controller if you need to maintain existing endpoints
  • Containerize your Lambda code, ensuring it's properly adapted for continuous running rather than function invocation
  • Consider using AWS Fargate for serverless container execution if you want to maintain a serverless operational model
  • Implement proper health checks and readiness probes for your pods
  • Set up appropriate monitoring and logging for your containerized applications

For controlled migration, you can:

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.