Serverless and App Services Flashcards
Event Driven Architecture
Producers generate event when something happens
Events are delivered to consumers
Actions are taken & the system returns to waiting
they only consume resources while handling events
AWS Lambda
Function-as-a-service(Faas) - short running & focussed
Lambda functions are loaded and run in a runtime environment
you are billed for the duration that a function runs
How long can AWS Lambda function run ?
900s(15min) function time out
Lambda user cases
serveles Application (s3, API gateway, lambda)
File processing (s3, s3 events, lambda)
Database Triggers(DynamoDb, streams, Lambda)
serverless CRON(EventBridge/CW Events + Lambda)
Realtime stream Data processing(Kinesis + lambda)
Public Lambda
by default lambda functions are given public networking. They can access public AWS services and the public internet.
But Lambda functions have no access to VPC based services public IPS unless public IPs are provided & security controls allow external access
Private Lambda
a single connection between the Lambda service VPC and your VPC is created for every unique combination of security group and subnets used by you Lambda function
an ENI gets created in the VPC
Lambda Logging CloudWatch logs
Logs from Lambda execution
CloudWatch Logs requires permissions via execution role
What metrics can Cloud Watch logging capture with Lambda ?
metrics :
invocation success/failure
Retries
Latency
How does security work with Lambda ?
Lambda resources policy controls WHAT services and accounts can INVOKE lambda functions
Lambda execution roles are IAM roles attached to lambda Functions which control the PERMISSIONS the lambda function RECEIVES
How many ways can Lambda functions be Invoked ?
Synchronous invocation
Asynchronous invocation
Event source Mapping
Lambda Synchronous Invocation
Lambda Asynchronous Invocation
Lambda Event sources Mapping
When running Asynchronous operations what key features does an Lambda function have to have ?
The Lambda function needs to be idempotent reprocessing a result should have the same end state
X-Ray and Lambda
Lambda can be integrated with X-Ray for distributed tracing
X-Ray helps developers analyze and debug production, distributed applications, such as those built using a microservices architecture.
Lambda Function Versions
A version is the code + the configuration of the Lambda Function
it’s immutable - It never changes once published & has it’s own amazon Resources Name
Lambda version Pointer
$Latest points at the latest version
AWS Lambda Aliases
Aliases (DEV, STAGE, PROD) point at a version - can be changed
Explain the Invocation of a Lambda Function ? Is there always an immediate start for Lambda Functions?
Event Bridge
if x happens , or at y times(s) … do z
Event Bridge is CloudWatch Event V2(*)
Limitation of CloudWatch Events ?
only one bus for the account (implicit )
Explain how Event Bridge works ?
Event Bridge can have additional event buses
rules match incoming events (or schedules )
Routes the events to 1+ Targets .. e.g. Lambda
Explain Serverless Architecture
you manage few if any servers -low overhead
Application are a collection of small & specialized functions
stateless and Ephemeral environments - duration billing
event-driven consumption only when being used
Faas is used where possible for computer functionality
Simple Notification Services(SNS)
Public Aws a pub/sub messaging service networking connectivity with Public endpoints
coordinates the sending and delivery of messages