How-to serverless 📚
• run Serverless Framework with 𝘀𝗹𝘀
• pick a template
• deploy
Bazinga!
Not much else to know, right? 🔥
Sadly, it's just the tip of the iceberg.
A story-time mega-thread & all you need to know to build a well-architected serverless application ↓
• run Serverless Framework with 𝘀𝗹𝘀
• pick a template
• deploy
Bazinga!
Not much else to know, right? 🔥
Sadly, it's just the tip of the iceberg.
A story-time mega-thread & all you need to know to build a well-architected serverless application ↓
𝗧𝗵𝗿𝗲𝗮𝗱 𝗢𝘃𝗲𝗿𝘃𝗶𝗲𝘄 🧵
• Motivation & my personal Experiences
• Well-Architected Pillars
• Operational Excellence
• Security
• Reliability
• Performance Efficiency
• Cost Optimization
• Bonus: Free-Credits
{ 1/29 }
• Motivation & my personal Experiences
• Well-Architected Pillars
• Operational Excellence
• Security
• Reliability
• Performance Efficiency
• Cost Optimization
• Bonus: Free-Credits
{ 1/29 }
𝗠𝗼𝘁𝗶𝘃𝗮𝘁𝗶𝗼𝗻
As shown in the initial post, starting is quick and easy! Just a few minutes to get something up and running.
As there are no servers & no self-managed networking rules, there's nothing to worry about - Lambda just does all the job.
Sadly, no.
{ 2/29 }
As shown in the initial post, starting is quick and easy! Just a few minutes to get something up and running.
As there are no servers & no self-managed networking rules, there's nothing to worry about - Lambda just does all the job.
Sadly, no.
{ 2/29 }
Why did we struggle so much?
Mainly due to 𝘄𝗿𝗼𝗻𝗴 𝗮𝘀𝘀𝘂𝗺𝗽𝘁𝗶𝗼𝗻𝘀 ❌
Serverless does not automatically imply...
• high availability & elasticity
• zero maintenance
• everything's fast & slick
• everything's secure by default
• low costs
{ 5/29 }
Mainly due to 𝘄𝗿𝗼𝗻𝗴 𝗮𝘀𝘀𝘂𝗺𝗽𝘁𝗶𝗼𝗻𝘀 ❌
Serverless does not automatically imply...
• high availability & elasticity
• zero maintenance
• everything's fast & slick
• everything's secure by default
• low costs
{ 5/29 }
You have to explicitly design your architecture and system to achieve all those goals.
Let's look at what we need to think of to reach our well-architected pillars
• Operational Excellence
• Security
• Reliability
• Performance Efficiency
• Cost Optimization
{ 6/29 }
Let's look at what we need to think of to reach our well-architected pillars
• Operational Excellence
• Security
• Reliability
• Performance Efficiency
• Cost Optimization
{ 6/29 }
𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻𝗮𝗹 𝗘𝘅𝗰𝗲𝗹𝗹𝗲𝗻𝗰𝗲
Regardless of your cloud expertise & language fluency, you'll encounter a reasonable amount of issues.
That's why you need to be aware of the state of your application at all times, so you're not running on blindsight.
{ 7/29 }
Regardless of your cloud expertise & language fluency, you'll encounter a reasonable amount of issues.
That's why you need to be aware of the state of your application at all times, so you're not running on blindsight.
{ 7/29 }
Mastering the 𝗢𝗽𝘀 in DevOps is crucial
• Logging
• Monitoring
• Alerting
It's easy to get lost at the beginning with CloudWatch. There are many log groups & even log streams and searching for issues is difficult - not only to its poor console interface.
{ 8/29 }
• Logging
• Monitoring
• Alerting
It's easy to get lost at the beginning with CloudWatch. There are many log groups & even log streams and searching for issues is difficult - not only to its poor console interface.
{ 8/29 }
𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆
First things first: achieve good 𝗶𝘀𝗼𝗹𝗮𝘁𝗶𝗼𝗻 by using several AWS accounts for serious projects.
• must-have: dedicated accounts per environment (e.g. staging & production)
• recommendation: dedicated accounts per developer
{ 9/29 }
First things first: achieve good 𝗶𝘀𝗼𝗹𝗮𝘁𝗶𝗼𝗻 by using several AWS accounts for serious projects.
• must-have: dedicated accounts per environment (e.g. staging & production)
• recommendation: dedicated accounts per developer
{ 9/29 }
Do not fall back to easy defaults like having a shared IAM role for all of your functions.
Always aim for 𝗹𝗲𝗮𝘀𝘁 𝗽𝗿𝗶𝘃𝗶𝗹𝗲𝗴𝗲 and segregate as much as possible.
IAM is very powerful - make use of its capabilities and restrict actions and resources.
{ 10/29 }
Always aim for 𝗹𝗲𝗮𝘀𝘁 𝗽𝗿𝗶𝘃𝗶𝗹𝗲𝗴𝗲 and segregate as much as possible.
IAM is very powerful - make use of its capabilities and restrict actions and resources.
{ 10/29 }
𝗥𝗲𝗹𝗶𝗮𝗯𝗶𝗹𝗶𝘁𝘆
Your application needs to be designed to fulfill reliability expectations like
• tolerating users mistakes
• operating within acceptable performance thresholds
• continues to operate in the event of one or multiple failures
{ 11/29 }
Your application needs to be designed to fulfill reliability expectations like
• tolerating users mistakes
• operating within acceptable performance thresholds
• continues to operate in the event of one or multiple failures
{ 11/29 }
A major contributor to failures is 𝗵𝘂𝗺𝗮𝗻 𝗲𝗿𝗿𝗼𝗿.
Focus on reducing opportunities for them.
• sandbox & staging environments
• thorough testing: unit, integration, e2e & contract testing
• Continuous Integration & Deployment with quick & easy rollbacks
{ 12/29 }
Focus on reducing opportunities for them.
• sandbox & staging environments
• thorough testing: unit, integration, e2e & contract testing
• Continuous Integration & Deployment with quick & easy rollbacks
{ 12/29 }
There's more:
• automated managed & external backups as well as point-in-time recovery
• using a multi-region, multi-cluster setup by leveraging Route53's capabilities
• having 𝗘𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴 𝗮𝘀 𝗖𝗼𝗱𝗲
{ 13/29 }
• automated managed & external backups as well as point-in-time recovery
• using a multi-region, multi-cluster setup by leveraging Route53's capabilities
• having 𝗘𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴 𝗮𝘀 𝗖𝗼𝗱𝗲
{ 13/29 }
𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲 𝗘𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝗰𝘆
There are a lot of points to tackle. For Lambda's pay-as-you-go pricing, good performance and reduced execution times will be also reflected in your bills.
A good starting point is to reduce & speed up cold starts.
{ 14/29 }
There are a lot of points to tackle. For Lambda's pay-as-you-go pricing, good performance and reduced execution times will be also reflected in your bills.
A good starting point is to reduce & speed up cold starts.
{ 14/29 }
Chose a 𝗹𝗮𝗻𝗴𝘂𝗮𝗴𝗲 𝘁𝗵𝗮𝘁 𝘄𝗼𝗿𝗸𝘀 𝘄𝗲𝗹𝗹 𝘄𝗶𝘁𝗵 𝗟𝗮𝗺𝗯𝗱𝗮
• Python or Node.js do very well in comparison to C# or Java
• there are options to use Java efficiently, e.g. by making use of GraalVM compilation to get native code
{ 15/29 }
• Python or Node.js do very well in comparison to C# or Java
• there are options to use Java efficiently, e.g. by making use of GraalVM compilation to get native code
{ 15/29 }
Keep your deployment units 𝗮𝘀 𝘀𝗺𝗮𝗹𝗹 𝗮𝘀 𝗽𝗼𝘀𝘀𝗶𝗯𝗹𝗲 (<5MB)
• think twice about 3rd party dependencies: maybe you don't actually need them
• make use of packaging tools like 𝘄𝗲𝗯𝗽𝗮𝗰𝗸, which will remove code that's not actually used.
{ 16/29 }
• think twice about 3rd party dependencies: maybe you don't actually need them
• make use of packaging tools like 𝘄𝗲𝗯𝗽𝗮𝗰𝗸, which will remove code that's not actually used.
{ 16/29 }
Leverage the most out of 𝗔𝗪𝗦' 𝘁𝗼𝗼𝗹𝗯𝗼𝘅
There's a lot that comes for free & is very useful, like API Gateway Level Request Validation: a request that is rejected here doesn't invoke a function!
Another example: using Graviton2/ARM processors instead of x86.
{ 17/29 }
There's a lot that comes for free & is very useful, like API Gateway Level Request Validation: a request that is rejected here doesn't invoke a function!
Another example: using Graviton2/ARM processors instead of x86.
{ 17/29 }
Use 𝗯𝗮𝘀𝗶𝗰 & 𝗮𝗱𝘃𝗮𝗻𝗰𝗲𝗱 𝘄𝗮𝗿𝗺-𝘂𝗽 𝘀𝘁𝗿𝗮𝘁𝗲𝗴𝗶𝗲𝘀
Besides integrating regular health checks with CloudWatch Rules, you can do even better with advanced strategies like Time-Series Forecasting: evaluate how much concurrency is needed per time block!
{ 18/29 }
Besides integrating regular health checks with CloudWatch Rules, you can do even better with advanced strategies like Time-Series Forecasting: evaluate how much concurrency is needed per time block!
{ 18/29 }
𝗖𝗼𝘀𝘁 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻
Most important: do a regular 𝗖𝗼𝘀𝘁 𝗥𝗲𝘃𝗶𝗲𝘄 to get familiar with how costs are built up in your account - 𝗔𝗪𝗦 𝗖𝗼𝘀𝘁 𝗘𝘅𝗽𝗹𝗼𝗿𝗲𝗿 is really helpful here, especially if you're making good use of 𝘁𝗮𝗴𝘀.
{ 19/29 }
Most important: do a regular 𝗖𝗼𝘀𝘁 𝗥𝗲𝘃𝗶𝗲𝘄 to get familiar with how costs are built up in your account - 𝗔𝗪𝗦 𝗖𝗼𝘀𝘁 𝗘𝘅𝗽𝗹𝗼𝗿𝗲𝗿 is really helpful here, especially if you're making good use of 𝘁𝗮𝗴𝘀.
{ 19/29 }
Set up 𝗕𝗶𝗹𝗹𝗶𝗻𝗴 𝗔𝗹𝗲𝗿𝘁𝘀.
By that, you'll be notified if your forecasted costs exceed your defined threshold.
The forecast is updated on a daily basis, which means that quickly exploding costs can result in alerts that are already too late.
{ 20/29 }
By that, you'll be notified if your forecasted costs exceed your defined threshold.
The forecast is updated on a daily basis, which means that quickly exploding costs can result in alerts that are already too late.
{ 20/29 }
This leads to the fact that you should get a deep understanding of your 𝗖𝗼𝘀𝘁 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲.
• What are your most expensive services?
• What costs are fixed and which are fluctuating?
Maybe there are inefficient Architectural Patterns?
{ 21/29 }
• What are your most expensive services?
• What costs are fixed and which are fluctuating?
Maybe there are inefficient Architectural Patterns?
{ 21/29 }
Think about services that are introducing the most costs: maybe there are good alternatives that are meeting your requirements and also saving you a lot of money.
Maybe you don't have the extended query requirements that MongoDB offers and you can switch to DynamoDB?
{ 22/29 }
Maybe you don't have the extended query requirements that MongoDB offers and you can switch to DynamoDB?
{ 22/29 }
Be open to changes.
In the past, hardware was called 𝗵𝗮𝗿𝗱-ware, because replacing it was difficult and took a lot of time and effort.
With the rise of the cloud, hardware can be changed in seconds - mostly with zero upfront costs.
Leverage this benefit.
{ 23/29 }
In the past, hardware was called 𝗵𝗮𝗿𝗱-ware, because replacing it was difficult and took a lot of time and effort.
With the rise of the cloud, hardware can be changed in seconds - mostly with zero upfront costs.
Leverage this benefit.
{ 23/29 }
Reading through this might let you feel overwhelmed - but you don't have to master everything at once.
It's just important to be aware of all pillars and that you keep all of those in mind while extending and enhancing your architecture.
{ 24/29 }
It's just important to be aware of all pillars and that you keep all of those in mind while extending and enhancing your architecture.
{ 24/29 }
What I have wished for in the beginning: knowing more about 3rd party tools like Dashbird.io (@thedashbird) that easily integrate with my AWS account & help me at all stages of development with well-architected insights, alerting, log search & much more 🕵️♂️
{ 25/29 }
{ 25/29 }
𝗕𝗼𝗻𝘂𝘀: 𝗙𝗿𝗲𝗲 𝗖𝗿𝗲𝗱𝗶𝘁𝘀
Reaching out to all starters first: yes, it's ok to feel scared to add your credit card to your own account.
We all heard horror stories about burning significant amounts of money in short periods of time.
{ 26/29 }
Reaching out to all starters first: yes, it's ok to feel scared to add your credit card to your own account.
We all heard horror stories about burning significant amounts of money in short periods of time.
{ 26/29 }
Also, even with a good business idea, it's hard to build something from scratch.
It will also cost (a lot of) money in the beginning and have zero returns.
𝗧𝗵𝗲 𝗴𝗼𝗼𝗱 𝗻𝗲𝘄𝘀: AWS helps you a lot - especially in the beginning - to get you started.
{ 27/29 }
It will also cost (a lot of) money in the beginning and have zero returns.
𝗧𝗵𝗲 𝗴𝗼𝗼𝗱 𝗻𝗲𝘄𝘀: AWS helps you a lot - especially in the beginning - to get you started.
{ 27/29 }
AWS got a generous free tier & with even more extended offerings for the first year
Additionally, you can take part or apply for programs like
• AWS 𝗘𝗱𝘂𝗰𝗮𝘁𝗲 - free credits for students and teachers
• AWS 𝗔𝗰𝘁𝗶𝘃𝗮𝘁𝗲 - free credits for promising products
{ 28/29 }
Additionally, you can take part or apply for programs like
• AWS 𝗘𝗱𝘂𝗰𝗮𝘁𝗲 - free credits for students and teachers
• AWS 𝗔𝗰𝘁𝗶𝘃𝗮𝘁𝗲 - free credits for promising products
{ 28/29 }
There's a lot more to get your hands on for free, like 𝗽𝘂𝗯𝗹𝗶𝘀𝗵𝗶𝗻𝗴 𝗮𝗻 𝗔𝗹𝗲𝘅𝗮 𝗦𝗸𝗶𝗹𝗹 or 𝗮𝘁𝘁𝗲𝗻𝗱𝗶𝗻𝗴 𝗪𝗲𝗯𝗶𝗻𝗮𝗿𝘀 & 𝗘𝘃𝗲𝗻𝘁𝘀.
Building an Alexa Skill has a very low entry barrier and is a perfect way to get started with AWS.
{ 29/29 }
Building an Alexa Skill has a very low entry barrier and is a perfect way to get started with AWS.
{ 29/29 }
If you enjoyed this, follow me for more regular cloud content! 🌤
If you're a 𝘀𝗲𝗿𝘃𝗲𝗿𝗹𝗲𝘀𝘀 𝗲𝗻𝘁𝗵𝘂𝘀𝗶𝗮𝘀𝘁: also follow @thedashbird for high-quality threads & articles for all things Lambda that I'm regularly posting there! ⚡️
Also: DMs are open for everything 📨
If you're a 𝘀𝗲𝗿𝘃𝗲𝗿𝗹𝗲𝘀𝘀 𝗲𝗻𝘁𝗵𝘂𝘀𝗶𝗮𝘀𝘁: also follow @thedashbird for high-quality threads & articles for all things Lambda that I'm regularly posting there! ⚡️
Also: DMs are open for everything 📨
Loading suggestions...