๐—Ÿ๐—ฒ๐˜'๐˜€ ๐—ฏ๐—ฒ ๐—ต๐—ผ๐—ป๐—ฒ๐˜€๐˜: generally, debugging is not a fun task ๐Ÿคข

Especially for serverless, event-driven & distributed systems.

From Lambda's logging basics to ๐˜€๐—ฎ๐˜ƒ๐—ถ๐—ป๐—ด ๐˜๐—ถ๐—บ๐—ฒ & ๐—ป๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐˜€ โ†“
Lambda's a serverless technology provided by AWS.
But that ๐—ฑ๐—ผ๐—ฒ๐˜€๐—ป'๐˜ ๐—บ๐—ฒ๐—ฎ๐—ป that there are no servers.

In the background, there are countless micro-containers running on top of the traditional servers.

Where do all the logs of those containers go to?
By default, they will end up in CloudWatch.
Every Lambda will receive its own ๐—น๐—ผ๐—ด ๐—ด๐—ฟ๐—ผ๐˜‚๐—ฝ.
Like a repository for logs.

Not only that, every micro-container will create a new so-called ๐—น๐—ผ๐—ด ๐˜€๐˜๐—ฟ๐—ฒ๐—ฎ๐—บ.
Think of it as a text file where logs are written to.
As a micro-container can live several minutes and also serve dozens of requests in that live-time, there can be countless logs in a single stream.

If there are parallel requests, we're even having multiple log streams written in parallel!
๐—ง๐—ต๐—ฒ ๐—–๐—ต๐—ฎ๐—น๐—น๐—ฒ๐—ป๐—ด๐—ฒ ๐˜„๐—ถ๐˜๐—ต ๐——๐—ฒ๐—ฏ๐˜‚๐—ด๐—ด๐—ถ๐—ป๐—ด

You already see the problem: finding corresponding logs to your request in CloudWatch is cumbersome.

Even if you know the time window for your failed request, you need to browse all log streams.
Maybe the target log stream was created way before the failed request and contains endless other unrelated logs.
In addition, CloudWatch Console Interface is not very user-friendly. You can just load a short period of logs - scrolling up or down will load another small batch.
Before even starting to address the issue, you've maybe already spent 30 minutes.

So what's the solution?

We can make use of the ๐—ฆ๐—ง๐—”๐—ฅ๐—ง/๐—˜๐—ก๐—— logs containing a dedicated request identifier (per invocation) and set up ๐—Ÿ๐—ผ๐—ด ๐—š๐—ฟ๐—ผ๐˜‚๐—ฝ ๐—ฆ๐˜‚๐—ฏ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฝ๐˜๐—ถ๐—ผ๐—ป๐˜€.
By subscribing ๐—ž๐—ถ๐—ป๐—ฒ๐˜€๐—ถ๐˜€ to our log groups and configuring a Log Parser we'll get the logs and break them up into invocations

Finally, each piece of log related to one invocation can be saved individually in a database (such as CloudSearch) for later search and debugging.
You can build this yourself & try out other options like @thedashbird, where you get it out of the box ๐ŸŽ

Biased, as I'm dashbird's dev-๐Ÿฅ‘ & I'm using it for my own SaaS ๐Ÿ‘€

Also in the box:
โ€ข well-architected hints
โ€ข alerting (e.g. slack)
โ€ข security warnings
... & more ๐Ÿ‘‹

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Tobias Schmidt

Tobias Schmidt Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @tpschmidt_

15 Oct
๐Ÿ“š AWS 1x1 - ๐—Ÿ๐—ฎ๐—บ๐—ฏ๐—ฑ๐—ฎ ฦ›

The Heart of your Serverless Love Story ๐Ÿงก

All my learnings & (almost) everything you need to know โ†“
๐—ง๐—ต๐—ฟ๐—ฒ๐—ฎ๐—ฑ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„

โ€ข Introduction
โ€ข Cold Starts
โ€ข Handler Method
โ€ข Runtimes
โ€ข Layers
โ€ข Security
โ€ข Versioning & Aliases
โ€ข Provisioned & Reserved Concurrency
โ€ข Lambda@Edge
โ€ข Pros & Cons
โ€ข Observability
โ€ข Considerations to make

{ 1/31 }
๐—œ๐—ป๐˜๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜๐—ถ๐—ผ๐—ป

AWS released Lambda in late 2014, spreading the buzzword serverless.

With EC2 you didn't have to think about physical servers anymore, but only virtual machines.

With Lambda, there's not even that anymore to maintain.
Just bring your code.

{ 2/31 }
Read 33 tweets
13 Oct
๐Ÿ“š AWS 1x1 - ๐——๐˜†๐—ป๐—ฎ๐—บ๐—ผ๐——๐—• ๐Ÿ’พ

My personal holy grail of database solutions & one of AWS' flagship services

An all-embracing mega-thread ๐Ÿงตโ†“
๐—ง๐—ต๐—ฟ๐—ฒ๐—ฎ๐—ฑ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„

โ€ข Introduction
โ€ข Provisioned vs On-Demand Capacity
โ€ข Basic Concepts
โ€ข Keys & Attributes
โ€ข Retrieving Items
โ€ข Race Conditions
โ€ข Expressions
โ€ข Indexes
โ€ข Streams
โ€ข Security
โ€ข Backups
โ€ข Global Tables
โ€ข Observability

{ 1/38 }
๐—œ๐—ป๐˜๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜๐—ถ๐—ผ๐—ป

Why should you care about DynamoDB?

It's managed, highly available & scales on-demand with low latencies.

For getting you hooked, at Prime Days 2021 DynamoDB served ๐Ÿด๐Ÿต.๐Ÿฎ ๐—บ๐—ถ๐—น๐—น๐—ถ๐—ผ๐—ป ๐—ฟ๐—ฒ๐—พ๐˜‚๐—ฒ๐˜€๐˜๐˜€/๐˜€๐—ฒ๐—ฐ๐—ผ๐—ป๐—ฑ at its peak.

{ 2/38 }
Read 40 tweets
12 Oct
Unpopular opinion: building a successful SaaS product is ๐—ต๐—ฎ๐—ฟ๐—ฑ

Yes, Twitter feels like everybody launches something & immediately goes to $10k MRR

๐—ฅ๐—ฒ๐—ฎ๐—น๐—ถ๐˜๐˜† ๐—ถ๐˜€ ๐—ฑ๐—ถ๐—ณ๐—ณ๐—ฒ๐—ฟ๐—ฒ๐—ป๐˜

I'm still in the early stages & already got a lot of lessons learned โ†“
๐—Ÿ๐—ฎ๐˜‚๐—ป๐—ฐ๐—ต ๐—ฒ๐—ฎ๐—ฟ๐—น๐˜†

Maybe you've got another dozen ideas for features you think are needed for your MVP.
But until you've launched and you've got actual (paying) users, you've got no guarantee that your business case is even valid.

Keep your scope as small as possible.
๐—ฃ๐—ฒ๐—ฟ๐—ณ๐—ฒ๐—ฐ๐˜๐—ถ๐—ผ๐—ป๐—ถ๐˜€๐—บ ๐—ถ๐˜€ ๐—ฏ๐—ฎ๐—ฑ

Intersects with the previous point: don't make the shinest code, with 100% code coverage and the perfect architecture, as it requires way too much effort.

Don't over or underdo it.
Make it work & manageable.
Read 9 tweets
11 Oct
๐—œ๐˜'๐˜€ ๐—ฒ๐—ฎ๐˜€๐˜† & ๐—ฐ๐—ผ๐—บ๐—ณ๐—ผ๐—ฟ๐˜๐—ฎ๐—ฏ๐—น๐—ฒ ๐˜๐—ผ ๐˜€๐˜๐—ฎ๐˜† ๐˜„๐—ต๐—ฒ๐—ฟ๐—ฒ ๐˜†๐—ผ๐˜‚ ๐—ฎ๐—ฟ๐—ฒ

Working at the same company for years.
In the same project.
In the same team.
At the same product.

No need to prove yourself anymore.

Maybe that's exactly why you should think about leaving โ†“
๐—˜๐˜ƒ๐—ฎ๐—น๐˜‚๐—ฎ๐˜๐—ถ๐—ป๐—ด ๐˜†๐—ผ๐˜‚๐—ฟ ๐˜€๐—ถ๐˜๐˜‚๐—ฎ๐˜๐—ถ๐—ผ๐—ป

You've gained respect & trust in your current position.
Maybe you've got promoted.
You know your craft.

Life's good.

Why should you leave into some uncertainty?
Why taking risks?

Because there's a lot to ๐—ด๐—ฎ๐—ถ๐—ป!

{ 1/8 }
๐€๐๐š๐ฉ๐ญ๐ข๐ง๐  & ๐ฌ๐ญ๐ซ๐ž๐ง๐ ๐ญ๐ก๐ž๐ง๐ข๐ง๐  ๐ฒ๐จ๐ฎ๐ซ ๐š๐ญ๐ญ๐ข๐ญ๐ฎ๐๐ž

Everything is under constant change โšก๏ธ

The new technology you've read about will probably be the standard next year.
What you're working on is probably obsolete tomorrow.

{ 2/8 }
Read 10 tweets
10 Oct
Have a look at AWS' growth of services...

Counting namespaces, the past decade is just mind-boggling ๐Ÿ™€

โ€ข 2013: 25
โ€ข 2015: 46
โ€ข 2017: 78
โ€ข 2019: 182

๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐—ธ๐—ฒ๐—ฒ๐—ฝ ๐˜‚๐—ฝ ๐˜„๐—ถ๐˜๐—ต ๐˜„๐—ต๐—ฎ๐˜'๐˜€ ๐—ป๐—ฒ๐˜„? โ†“
๐—”๐—ช๐—ฆ ๐—ก๐—ฒ๐˜„๐˜€ ๐—•๐—น๐—ผ๐—ด

Guarantees to not miss out on new features or services, but also contains interesting statistics and other insights from AWS itself.
Gets updated very regularly, sometimes several times a day.

aws.amazon.com/blogs/aws/

{ 1/4 }
๐—ช๐—ต๐—ฎ๐˜'๐˜€ ๐—ก๐—ฒ๐˜„ ๐˜„๐—ถ๐˜๐—ต ๐—”๐—ช๐—ฆ?

If you're focusing on keeping up with the new capabilities AWS provides, that's your major source.
You'll learn about improvements to existing services, introductions of new ones as well as region expansions.

aws.amazon.com/new/

{ 2/4 }
Read 5 tweets
5 Oct
๐Ÿ“š ๐—–๐—น๐—ผ๐˜‚๐—ฑ ๐—–๐—ผ๐—ป๐—ฐ๐—ฒ๐—ฝ๐˜๐˜€ ๐Ÿญ๐˜…๐Ÿญ

How do dedicated servers, virtual machines, containers & functions differ? ๐Ÿค–

An overview of the different compute models โ†“
๐——๐—ฒ๐—ฑ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐—ฑ ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ๐˜€ (1/2) ๐Ÿ› 

A physical server, only utilized by you
โ€ข you have to know or guess the CPU & memory capacities you need
โ€ข high risk of overpaying (underutilized server) or under-provisioning (too much load)
๐——๐—ฒ๐—ฑ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐—ฑ ๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ๐˜€ (2/2) ๐Ÿ› 

โ€ข you're able to run multiple apps, but need to make sure that you're not causing conflicts by resource sharing
โ€ข you're solely responsible for the security
โ€ข up- or downscaling is tedious & not quickly possible
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(