SlideShare a Scribd company logo
Cloud Security Automation| |
Advanced ServerlessApplicationArchitectureand Design
Considerations
DILIPKUMARKOLA,Co-founderandCTO, Tensult | 24th April2019
What is Serverless?
• Serverless is, running the workloads on the Cloud without thinking
about servers.
• Examples:
• Hosting an angular frontend website on AWS S3 bucket.
• Implementing a backend API using AWS API Gateway, AWS Lambda and AWS
DynamoDB.
• Processing files when they get uploaded to AWS S3 bucket.
• Send notifications to users using AWS SES when you sign up on the website.
• And these are just a very few examples.
Why Serverless?
Scalability AutomationFaster DeploymentsReduces Cost Low Maintenance
Large Scale multi-lingual news
website
100% Serverless on AWS
<12 months from concept to
production
CaseStudy News Website
1
DevOps
Engg
>1 Bn Page
Views per
month
60 Mn
Monthly
Active
Users
7
languages
CMS Architecture
Authorization of backend users
Cognito
User Pool
CMS
Application
API
Gateway
CMS
API
CloudFront
Cognito
Identity Pool
S3
DynamoDB Lambda Elastic
Search
Populating to ES to enable search
Lambda S3
Sitemaps and RSS feeders
CMS User
For storing photos and videos
News Website Architecture
API
Gateway
Website
API
CloudFront
DynamoDB
Elastic
Search
S3
Web User
Sitemaps and RSS feeders
News Data Retrieval
NewsletterArchitecture
CloudWatch
Rule
Fetch Newsletter
Template
S3
Cache
Elastic
Search
Fetch List of
Users
Send Newsletter
SES
SNS
Send Token to
fetch next
User List
Newsletters Function
Lambda
How Does AWSLambdaWork?
• Function as a Service from AWS.
• Upload function code written in
• NodeJS, Java, Python, Go, Ruby, .Net etc.
• Lambda creates a docker image and executes them
• Automatically scales based on the requests.
• Supports Pull and Push models.
• In Pull model, the Lambda trigger reads the events from streams and processes them.
• In Push model, we need to call Lambda function directly using API (API Gateway)
• Billing is based on the memory allocated and duration of execution.
Key Aspects in Design
Lambda DesignConsiderations
• Avoid loops in Data flows
• Remember about Cold Starts
• Avoid duplication of code
• Add caching where possible
• Tune the function configuration
• Use versions and aliases
• Treat global variables as constants
• Know what you are logging
AWS Lambda scales very fast so if there is any loop in the data flow then it will keep on creating
new containers to handle the new requests leading the bill to shoot up very fast so before
deploying any serverless solution first fully understand the data flow and make sure there are
no loops.
• To detect loops keep monitoring
• Invocation count
• Billing
Avoidloops inthe Data flows
S3 Lambda
Store thumbnails images
Generate thumbnails
• AWS Lambda takes some time to start the first container and also the container will be
removed when it idle some time.
• Solution:
• We can keep calling the AWS Lambda function every one minute using AWS CloudWatch event
rules.
• Refactor the function code to start faster by lazily loading the components.
RememberaboutCold Starts
CloudWatch
Rule
Lambda
Pinger
Avoidduplication of code
• It is a common danger in FaaS or microservice implementations as there are many
decoupled components so developers tend to duplicate the same code at multiple places
and this can become really unmanageable.
• Define common code as libraries and reuse them in various functions and microservices.
• Incase of NodeJS environment, we can refer common libraries as dependencies using local
directory paths.
• AWS Lambda service provides a feature called Layers in order to share the common code
and libraries across multiple Lambda functions.
Addcaching where possible
• AWS Lambda scales but there are limits and our limit is 2500 concurrent executions and
we were hitting this limit and afterwards we added caching on top of the APIs.
• When we send a push notification to our mobile users, we get more than 50K requests
per second to our backend Lambda functions and AWS Lambda used to throttle us.
• Then we restricted access to our API end points via CDN for mobile users as the requests
are getting cached at CDN and only cache misses reaches to backend so considerably
load is reduced on the backend Lambda functions.
• So keep monitoring for throttles and errors.
Tune the function configuration
• Memory determines both CPU and RAM allocated to function
• Low memory doesn’t always means cost effective as it leads to low CPU, so
requests might take more time leading to you paying even more.
• Try different memory settings and analyze the request execution times
then choose appropriate memory setting.
• Don’t forget to tune this setting after every major update to the function.
Use versions andaliases
• When updating the function make sure to create a new version.
• This allows us to easily roll back the functions incase of failures.
• We can also use aliases for A/B testing by pointing our APIs to a different alias.
• Be aware of limits on storage and then decide the number of versions needed.
Source
Treatglobal variablesas constants
• AWS Lambda cache all the global variables and context across the
requests so we can't change the global variables while requests are
processing. If we do that then the data might get corrupted.
• Solution:
• Code review before deploying the functions to Lambda.
• Do thorough testing in dev/staging environments before pushing functions to
prod environment.
Know what you arelogging
• Lambda integrates with CloudWatch for logs and CloudWatch provides
good searching features but ingestion cost is high, so in the production only
log warnings and errors.
• Set retention for logs appropriately, by default logs in CloudWatch service
are retained forever but that may not be necessary for business case.
• In case you need to keep logs for a very long time for compliance reasons
then move them to S3/Glacier services.
AboutUs
• Founded in 2017, Tensult is a Technology Consulting Company for the cloud
• Started by passionate, ex-AWS people who brings in-depth cloud knowledge and
expertise
• Automation First approach
• 20+ Happy Customers
Thank You
Sample our work
Questions?
Drop us a note at sales@tensult.com
https://github.com/tensult
https://blogs.tensult.com
Follow us
https://linkedin.com/company/tensult
https://twitter.com/tensultdotcom

More Related Content

PDF
Serverless Computing
PDF
Serverless data processing with Data Pipeline
PDF
Serverless Architectures on AWS Lambda
PDF
Meetup #4: AWS ELB Deep dive & Best practices
PDF
What is AWS lambda?
PDF
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
PPTX
Cloudsolutionday 2016: Getting Started with Severless Architecture
PDF
Bridging the Gap: Connecting AWS and Kafka
Serverless Computing
Serverless data processing with Data Pipeline
Serverless Architectures on AWS Lambda
Meetup #4: AWS ELB Deep dive & Best practices
What is AWS lambda?
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
Cloudsolutionday 2016: Getting Started with Severless Architecture
Bridging the Gap: Connecting AWS and Kafka

What's hot (12)

PDF
Serverless Architecture on AWS
PDF
AWS Lambda and Serverless framework: lessons learned while building a serverl...
PPTX
Introduce AWS Lambda for newbie and Non-IT
PDF
Introduction to Serverless
PDF
Continuous Deployment in AWS Lambda
PPTX
AWS - Lambda Fundamentals
PPTX
High Performance Serverless Functions in Scala
PDF
Migrating Monolithic Applications with the Strangler Pattern
PDF
aws lambda & api gateway
PPTX
Aws landing zone. journey to the cloud
PPTX
Let's Talk About Serverless - Focusing on AWS Lambda
PPTX
從劍宗到氣宗 - 談AWS ECS與Serverless最佳實踐
Serverless Architecture on AWS
AWS Lambda and Serverless framework: lessons learned while building a serverl...
Introduce AWS Lambda for newbie and Non-IT
Introduction to Serverless
Continuous Deployment in AWS Lambda
AWS - Lambda Fundamentals
High Performance Serverless Functions in Scala
Migrating Monolithic Applications with the Strangler Pattern
aws lambda & api gateway
Aws landing zone. journey to the cloud
Let's Talk About Serverless - Focusing on AWS Lambda
從劍宗到氣宗 - 談AWS ECS與Serverless最佳實踐
Ad

Similar to Serverless design considerations for Cloud Native workloads (15)

PPTX
Serverlessusecase workshop feb3_v2
PPTX
Serverless at Lifestage
PDF
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
PDF
Building serverless backends - Tech talk 5 May 2017
PDF
AWS Lambda Functions A Comprehensive Guide
PDF
Getting Started with AWS Lambda & Serverless Cloud
PPTX
Developing serverless applications with .NET on AWS
PDF
Infinite Scaling using Lambda and Aws - Atlogys Tech Talk
PDF
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
PDF
How to Build a Big Data Application: Serverless Edition
PPTX
What is Serverless Computing?
PPTX
AWS Serverless patterns & best-practices in AWS
PDF
How to Build a Big Data Application: Serverless Edition
PDF
2022 Presentation | Serverless Innovation with AWS
PPTX
Running SQL Server on AWS | John McCormack | DataGrillen 2019
Serverlessusecase workshop feb3_v2
Serverless at Lifestage
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Building serverless backends - Tech talk 5 May 2017
AWS Lambda Functions A Comprehensive Guide
Getting Started with AWS Lambda & Serverless Cloud
Developing serverless applications with .NET on AWS
Infinite Scaling using Lambda and Aws - Atlogys Tech Talk
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
How to Build a Big Data Application: Serverless Edition
What is Serverless Computing?
AWS Serverless patterns & best-practices in AWS
How to Build a Big Data Application: Serverless Edition
2022 Presentation | Serverless Innovation with AWS
Running SQL Server on AWS | John McCormack | DataGrillen 2019
Ad

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Modernizing your data center with Dell and AMD
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Electronic commerce courselecture one. Pdf
Advanced Soft Computing BINUS July 2025.pdf
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
MYSQL Presentation for SQL database connectivity
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25 Week I
20250228 LYD VKU AI Blended-Learning.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Modernizing your data center with Dell and AMD
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
Spectral efficient network and resource selection model in 5G networks
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.
Reach Out and Touch Someone: Haptics and Empathic Computing

Serverless design considerations for Cloud Native workloads

  • 1. Cloud Security Automation| | Advanced ServerlessApplicationArchitectureand Design Considerations DILIPKUMARKOLA,Co-founderandCTO, Tensult | 24th April2019
  • 2. What is Serverless? • Serverless is, running the workloads on the Cloud without thinking about servers. • Examples: • Hosting an angular frontend website on AWS S3 bucket. • Implementing a backend API using AWS API Gateway, AWS Lambda and AWS DynamoDB. • Processing files when they get uploaded to AWS S3 bucket. • Send notifications to users using AWS SES when you sign up on the website. • And these are just a very few examples.
  • 3. Why Serverless? Scalability AutomationFaster DeploymentsReduces Cost Low Maintenance
  • 4. Large Scale multi-lingual news website 100% Serverless on AWS <12 months from concept to production CaseStudy News Website
  • 5. 1 DevOps Engg >1 Bn Page Views per month 60 Mn Monthly Active Users 7 languages
  • 6. CMS Architecture Authorization of backend users Cognito User Pool CMS Application API Gateway CMS API CloudFront Cognito Identity Pool S3 DynamoDB Lambda Elastic Search Populating to ES to enable search Lambda S3 Sitemaps and RSS feeders CMS User For storing photos and videos
  • 8. NewsletterArchitecture CloudWatch Rule Fetch Newsletter Template S3 Cache Elastic Search Fetch List of Users Send Newsletter SES SNS Send Token to fetch next User List Newsletters Function Lambda
  • 9. How Does AWSLambdaWork? • Function as a Service from AWS. • Upload function code written in • NodeJS, Java, Python, Go, Ruby, .Net etc. • Lambda creates a docker image and executes them • Automatically scales based on the requests. • Supports Pull and Push models. • In Pull model, the Lambda trigger reads the events from streams and processes them. • In Push model, we need to call Lambda function directly using API (API Gateway) • Billing is based on the memory allocated and duration of execution.
  • 10. Key Aspects in Design
  • 11. Lambda DesignConsiderations • Avoid loops in Data flows • Remember about Cold Starts • Avoid duplication of code • Add caching where possible • Tune the function configuration • Use versions and aliases • Treat global variables as constants • Know what you are logging
  • 12. AWS Lambda scales very fast so if there is any loop in the data flow then it will keep on creating new containers to handle the new requests leading the bill to shoot up very fast so before deploying any serverless solution first fully understand the data flow and make sure there are no loops. • To detect loops keep monitoring • Invocation count • Billing Avoidloops inthe Data flows S3 Lambda Store thumbnails images Generate thumbnails
  • 13. • AWS Lambda takes some time to start the first container and also the container will be removed when it idle some time. • Solution: • We can keep calling the AWS Lambda function every one minute using AWS CloudWatch event rules. • Refactor the function code to start faster by lazily loading the components. RememberaboutCold Starts CloudWatch Rule Lambda Pinger
  • 14. Avoidduplication of code • It is a common danger in FaaS or microservice implementations as there are many decoupled components so developers tend to duplicate the same code at multiple places and this can become really unmanageable. • Define common code as libraries and reuse them in various functions and microservices. • Incase of NodeJS environment, we can refer common libraries as dependencies using local directory paths. • AWS Lambda service provides a feature called Layers in order to share the common code and libraries across multiple Lambda functions.
  • 15. Addcaching where possible • AWS Lambda scales but there are limits and our limit is 2500 concurrent executions and we were hitting this limit and afterwards we added caching on top of the APIs. • When we send a push notification to our mobile users, we get more than 50K requests per second to our backend Lambda functions and AWS Lambda used to throttle us. • Then we restricted access to our API end points via CDN for mobile users as the requests are getting cached at CDN and only cache misses reaches to backend so considerably load is reduced on the backend Lambda functions. • So keep monitoring for throttles and errors.
  • 16. Tune the function configuration • Memory determines both CPU and RAM allocated to function • Low memory doesn’t always means cost effective as it leads to low CPU, so requests might take more time leading to you paying even more. • Try different memory settings and analyze the request execution times then choose appropriate memory setting. • Don’t forget to tune this setting after every major update to the function.
  • 17. Use versions andaliases • When updating the function make sure to create a new version. • This allows us to easily roll back the functions incase of failures. • We can also use aliases for A/B testing by pointing our APIs to a different alias. • Be aware of limits on storage and then decide the number of versions needed. Source
  • 18. Treatglobal variablesas constants • AWS Lambda cache all the global variables and context across the requests so we can't change the global variables while requests are processing. If we do that then the data might get corrupted. • Solution: • Code review before deploying the functions to Lambda. • Do thorough testing in dev/staging environments before pushing functions to prod environment.
  • 19. Know what you arelogging • Lambda integrates with CloudWatch for logs and CloudWatch provides good searching features but ingestion cost is high, so in the production only log warnings and errors. • Set retention for logs appropriately, by default logs in CloudWatch service are retained forever but that may not be necessary for business case. • In case you need to keep logs for a very long time for compliance reasons then move them to S3/Glacier services.
  • 20. AboutUs • Founded in 2017, Tensult is a Technology Consulting Company for the cloud • Started by passionate, ex-AWS people who brings in-depth cloud knowledge and expertise • Automation First approach • 20+ Happy Customers
  • 21. Thank You Sample our work Questions? Drop us a note at sales@tensult.com https://github.com/tensult https://blogs.tensult.com Follow us https://linkedin.com/company/tensult https://twitter.com/tensultdotcom