Introducción
El dilema que muchos equipos enfrentan al diseñar arquitecturas serverless: ¿cuánta granularidad es suficiente? En este post exploramos por qué las funciones Lambda no deberían confundirse con «funciones» en el sentido de programación, sino tratarse como microservicios.
El Problema: Sobre-Fragmentación
Escenario típico: necesitas crear un sistema para gestionar pedidos/ventas con una arquitectura serverless (API Gateway + Lambda). La pregunta crítica es:
¿cuántas funciones Lambda necesitas?
Si este mismo sistema se implementara en Kubernetes, ¿cuántos microservicios crearías? La respuesta debería ser la misma independientemente de la plataforma.
Antipatrón: Una Lambda por Endpoint
Problema de este enfoque:

- Acoplamiento fuerte con API Gateway: cada Lambda debe conocer la estructura exacta del payload
- Proliferación descontrolada: decenas de funciones para un solo dominio
- Complejidad operacional: pipelines de CI/CD más complejos, más difícil de mantener
- Código duplicado: lógica compartida repetida entre múltiples Lambdas
Ventajas (que no compensan)
- Cold start potencialmente menor por función específica
- Escalado independiente por operación
- Cambios muy localizados
Enfoque Recomendado: Lambda por Dominio

Principios clave:
- Una Lambda por bounded context/dominio, no por endpoint
- API Gateway como router inteligente: transforma y estandariza el payload
- La Lambda maneja el routing interno: determina qué operación ejecutar según el request
Beneficios:
- Alineación con principios de microservicios
- Menos complejidad operacional
- Código compartido más fácil de mantener
- Mejor cohesión del dominio de negocio
Consideraciones técnicas:
- Usa VTL (Velocity Template Language) o transformaciones en API Gateway
- Implementa un router interno en la Lambda (ej: basado en
httpMethodyresource) - Mantén las Lambdas enfocadas en un dominio específico
¿Cuándo dividir en múltiples Lambdas?
Divide cuando:
- Dominios diferentes: Ventas vs. Inventario vs. Usuarios
- Requisitos de escalado muy distintos: operaciones de lectura masiva vs. escrituras poco frecuentes
- Límites de Lambda: tiempo de ejecución o memoria insuficientes
- Equipos diferentes: cada equipo gestiona su dominio
Conclusión
Las funciones Lambda son un modelo de despliegue para microservicios, no una razón para sobre-fragmentar tu arquitectura. Aplica los mismos principios de diseño que usarías en cualquier arquitectura de microservicios.
En el próximo post: Implementación práctica con código real, patrones de routing, y configuración de API Gateway.
Referencias
https://docs.aws.amazon.com/apigateway/latest/developerguide/models-mappings.html

What I really liked is how easy this was to follow. Even for someone who’s not super tech-savvy, it made perfect sense.
I never thought about it that way before. Great insight!
This was very well laid out and easy to follow.
It’s refreshing to find something that feels honest and genuinely useful. Thanks for sharing your knowledge in such a clear way.
This post cleared up so many questions for me.
I like how you presented both sides of the argument fairly.
Very useful tips! I’m excited to implement them soon.
I appreciate how genuine your writing feels. Thanks for sharing.
I appreciate the depth and clarity of this post.
I really needed this today. Thank you for writing it.
This gave me a whole new perspective on something I thought I already understood. Great explanation and flow!
Great post! I’m going to share this with a friend.
Your breakdown of the topic is so well thought out.
You’re doing a fantastic job with this blog.
I appreciate the depth and clarity of this post.
Your writing style makes complex ideas so easy to digest.
You’ve sparked my interest in this topic.
Thanks for sharing your knowledge. This added a lot of value to my day.
I really needed this today. Thank you for writing it.
Great job simplifying something so complex.
Thanks for addressing this topic—it’s so important.
This post gave me a new perspective I hadn’t considered.
I appreciate the real-life examples you added. They made it relatable.
Your tips are practical and easy to apply. Thanks a lot!
You bring a fresh voice to a well-covered topic.
You really know how to connect with your readers.
This is exactly the kind of content I’ve been searching for.
Thank you for covering this so thoroughly. It helped me a lot.
I wasn’t expecting to learn so much from this post!
You’ve clearly done your research, and it shows.
Great article! I’ll definitely come back for more posts like this.
This was very well laid out and easy to follow.
Thank you for offering such practical guidance.
Your passion for the topic really shines through.
You explained it in such a relatable way. Well done!
I’ll definitely come back and read more of your content.
Your content always adds value to my day.
I learned something new today. Appreciate your work!
Thanks for addressing this topic—it’s so important.
This topic really needed to be talked about. Thank you.
I appreciate the depth and clarity of this post.
Very relevant and timely content. Appreciate you sharing this.
I wasn’t sure what to expect at first, but this turned out to be surprisingly useful. Thanks for taking the time to put this together.
I feel more confident tackling this now, thanks to you.
I’ve read similar posts, but yours stood out for its clarity.
I appreciate the real-life examples you added. They made it relatable.
Thanks for addressing this topic—it’s so important.
I appreciate your unique perspective on this.
Your writing always inspires me to learn more.
You really know how to connect with your readers.