Using EKS with Lambda on AWS

AWS Community Builder / Cloud Architect / IT Lead / MLOps
Search for a command to run...

AWS Community Builder / Cloud Architect / IT Lead / MLOps
No comments yet. Be the first to comment.
Or: what happens when an engineer gets tired of explaining himself to his own tools.

A small confession, before anything else The thing that pushed me to build vibestack was not a strategy meeting. It was a Tuesday evening, and I was tired. I had spent maybe forty minutes in a Claude

If you manage AWS infrastructure with code, the European Sovereign Cloud adds a new partition to think about. Different endpoints, separate IAM, its own console. This guide covers what works out of th

Introduction You know what? I see teams spinning up Kubernetes clusters for three microservices all the time. Then they spend two months figuring out pods, ingress controllers, and all that magic. And then they pay $70 per month just for three cluste...

The container orchestration landscape on AWS recently received significant enhancements with two major updates to Amazon Elastic Container Service (ECS): the introduction of ECS Managed Instances and built-in support for Linear and Canary deployment ...

Timur Galeev Blog
26 posts
Hi, I'm Timur ๐
Forward Deployed Engineer ยท AI ร Cloud. I build with LLMs, agents, and MCP servers on top of cloud infrastructure โ sitting close to the problem, prototyping fast, hardening for production.
15+ years architecting cloud platforms across AWS, GCP, and Azure. Now putting most hands-on hours into AI tooling on top of cloud, with open source as the public surface area.
Background arc: DevOps Architect โ Full Stack Developer โ Cloud Architect โ Head of IT / CTO โ AI ร Cloud / Forwa
AWS EKS (Elastic Kubernetes Service) allows you to easily run Kubernetes clusters in the AWS cloud. Lambda is AWS' serverless compute service that allows you to run code without provisioning or managing servers. This article discusses how you can integrate EKS with Lambda to build serverless applications on Kubernetes.
The main way to integrate EKS and Lambda is by deploying Lambda functions as Kubernetes deployments and services. This allows Kubernetes to manage and orchestrate the execution of Lambda code.
The steps to deploy a Lambda function to EKS are:
Create a Lambda function using the AWS CLI or SDK. This deploys the code and configuration to Lambda.
Create a Kubernetes Deployment and Service that points to the Lambda function ARN (Amazon Resource Name). The service exposes the function through a ClusterIP.
Kubernetes will trigger invocations of the Lambda function through the service endpoint. It handles load balancing, auto-scaling and orchestration of the function.
Leverage Kubernetes APIs and tools to deploy, manage and scale Lambda functions
Build serverless applications as Kubernetes workloads for portability across environments
Take advantage of Kubernetes features like auto-scaling, rolling updates, blue-green deployments etc. for Lambda code
Integrate Lambda functions into existing container-based applications on EKS
This allows building fully serverless applications that leverage the power of Kubernetes for orchestration along with AWS Lambda's ease of use.
Here is a sample Python code for deploying a Lambda function as a Kubernetes workload:
# Create Lambda function
lambda_client.create_function(
FunctionName='myfunction',
Runtime='python3.8',
Handler='index.handler',
Code={
'ZipFile': bytecode
}
)
# Create Kubernetes Deployment
api.create_namespaced_deployment(
namespace='default',
body={
'apiVersion': 'apps/v1',
'kind': 'Deployment',
'metadata': {
'name': 'lambda-deploy'
},
'spec': {
'replicas': 1,
'selector': {
'matchLabels': {
'app': 'lambda'
}
},
'template': {
'metadata': {
'labels': {
'app': 'lambda'
}
},
'spec': {
'containers': [
{
'name': 'lambda-container',
'image': 'public.ecr.aws/lambda/python:3.8',
'env': [
{
'name': 'AWS_LAMBDA_FUNCTION_NAME',
'value': 'myfunction'
},
{
'name': 'AWS_REGION',
'value': 'us-east-1'
}
]
}
]
}
}
}
}
)
# Expose Deployment as Kubernetes Service
api.create_namespaced_service(
namespace='default',
body={
'apiVersion': 'v1',
'kind': 'Service',
'metadata': {
'name': 'lambda-service'
},
'spec': {
'ports': [
{
'port': 8080,
'targetPort': 8080
}
],
'selector': {
'app': 'lambda'
}
}
}
)
This demonstrates how to deploy a Lambda function as a Kubernetes workload and expose it through a service for invocation. EKS and Lambda provide a powerful way to build serverless applications on Kubernetes.