Lambda

AWS Lambda: ¿Son Funciones o Microservicios?

 

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:

  1. Una Lambda por bounded context/dominio, no por endpoint
  2. API Gateway como router inteligente: transforma y estandariza el payload
  3. 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 httpMethod y resource)
  • 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

 

 

0 0 votes
Article Rating
Subscribe
Notify of
guest

453 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
opaltogel login
opaltogel login
10 months ago

What I really liked is how easy this was to follow. Even for someone who’s not super tech-savvy, it made perfect sense.

mulantogel login
mulantogel login
10 months ago

I never thought about it that way before. Great insight!

jonitogel login
jonitogel login
10 months ago

This was very well laid out and easy to follow.

toto togel
toto togel
10 months ago

It’s refreshing to find something that feels honest and genuinely useful. Thanks for sharing your knowledge in such a clear way.

toto togel
toto togel
10 months ago

This post cleared up so many questions for me.

togel online
togel online
10 months ago

I like how you presented both sides of the argument fairly.

ziatogel login
ziatogel login
10 months ago

Very useful tips! I’m excited to implement them soon.

jalalive
jalalive
10 months ago

I appreciate how genuine your writing feels. Thanks for sharing.

lunatogel alternatif
lunatogel alternatif
10 months ago

I appreciate the depth and clarity of this post.

spotbet
spotbet
10 months ago

I really needed this today. Thank you for writing it.

jonitogel login
jonitogel login
10 months ago

This gave me a whole new perspective on something I thought I already understood. Great explanation and flow!

hometogel alternatif
hometogel alternatif
10 months ago

Great post! I’m going to share this with a friend.

jalalive
jalalive
10 months ago

Your breakdown of the topic is so well thought out.

jalalive gratis
jalalive gratis
10 months ago

You’re doing a fantastic job with this blog.

jalalive
jalalive
10 months ago

I appreciate the depth and clarity of this post.

jalalive gratis
jalalive gratis
10 months ago

Your writing style makes complex ideas so easy to digest.

jalalive gratis
jalalive gratis
10 months ago

You’ve sparked my interest in this topic.

jalalive
jalalive
10 months ago

Thanks for sharing your knowledge. This added a lot of value to my day.

jalalive
jalalive
10 months ago

I really needed this today. Thank you for writing it.

jalalive
jalalive
10 months ago

Great job simplifying something so complex.

jalalive apk
jalalive apk
10 months ago

Thanks for addressing this topic—it’s so important.

opaltogel login
opaltogel login
10 months ago

This post gave me a new perspective I hadn’t considered.

spotbet alternatif
spotbet alternatif
10 months ago

I appreciate the real-life examples you added. They made it relatable.

nobartv
nobartv
10 months ago

Your tips are practical and easy to apply. Thanks a lot!

nobartv live
nobartv live
10 months ago

You bring a fresh voice to a well-covered topic.

jalalive
jalalive
10 months ago

You really know how to connect with your readers.

jalalive bola
jalalive bola
10 months ago

This is exactly the kind of content I’ve been searching for.

jalalive apk
jalalive apk
10 months ago

Thank you for covering this so thoroughly. It helped me a lot.

jalalive
jalalive
10 months ago

I wasn’t expecting to learn so much from this post!

jalalive bola
jalalive bola
10 months ago

You’ve clearly done your research, and it shows.

yoktogel login
yoktogel login
10 months ago

Great article! I’ll definitely come back for more posts like this.

yoktogel alternatif
yoktogel alternatif
10 months ago

This was very well laid out and easy to follow.

jonitogel alternatif
jonitogel alternatif
10 months ago

Thank you for offering such practical guidance.

jogjatoto alternatif
jogjatoto alternatif
10 months ago

Your passion for the topic really shines through.

jogjatoto
jogjatoto
10 months ago

You explained it in such a relatable way. Well done!

jalalive
jalalive
10 months ago

I’ll definitely come back and read more of your content.

jalalive
jalalive
10 months ago

Your content always adds value to my day.

jalalive
jalalive
10 months ago

I learned something new today. Appreciate your work!

jalalive apk
jalalive apk
10 months ago

Thanks for addressing this topic—it’s so important.

spotbet
spotbet
10 months ago

This topic really needed to be talked about. Thank you.

spotbet
spotbet
10 months ago

I appreciate the depth and clarity of this post.

jonitogel
jonitogel
10 months ago

Very relevant and timely content. Appreciate you sharing this.

jonitogel login
jonitogel login
10 months ago

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.

jp188
jp188
10 months ago

I feel more confident tackling this now, thanks to you.

jp188
jp188
10 months ago

I’ve read similar posts, but yours stood out for its clarity.

lunatogel alternatif
lunatogel alternatif
9 months ago

I appreciate the real-life examples you added. They made it relatable.

lunatogel login
lunatogel login
9 months ago

Thanks for addressing this topic—it’s so important.

spotbet
spotbet
9 months ago

I appreciate your unique perspective on this.

spotbet
spotbet
9 months ago

Your writing always inspires me to learn more.

slot online
slot online
9 months ago

You really know how to connect with your readers.

453
0
Would love your thoughts, please comment.x
()
x