-
Notifications
You must be signed in to change notification settings - Fork 0
Serverless Lambda
abk edited this page Nov 13, 2019
·
1 revision
Serverless / Lambda
- Micro-services arch is inverse of monolithic architecture
- Operate as independent applications. They allow direct communications between components and end user.
- APIs are examples of these. Published by a service or application that will be consumed by others. They have data transfer formats.
- API end point is how user communicates to the API.
Event Drive Architecture
- The one that operates around events.
- An Action or change of state.
- File being uploaded
- Temperature falling below 30F
Serverless Architecture This has 2 components.
- BaaS - Backend as service Which means using third party services where possible rather than running on your own Utilize third party DB like dynamoDB. Prioritize consumption of third party services. Remove lot of long running infrastructure and remove management overhead.
- FaaS - Function as service
Short running or temporary compute are used.
You give a function / code and is executed as required
Execution can be based on cron / specific time or Event driven.
Truly on demand, no patching and no maintenance.
- LAMBA in AWS (FaaS provided by Lambda in AWS)
- Runs unto 15 minutes
- Can be invoked manually or event based.
- Events are generated by another service.
- Many services can invoke lambda functions in AWS.
- Needs unique name in the region.
- Minimum billed duration is 100ms
- If there are library dependencies, then you need to package a zip file and upload.
- LAMBA in AWS (FaaS provided by Lambda in AWS)
API Gateway
- Managed API endpoint service.
- Used to create, publish, monitor and secure APIs as service.
- API Gateway can access some AWS services directly using proxy mode.
- Can create 2 forms of API
- REST API
- Request and response style communication
- Stateless
- WebSocket API (High traffic based API)
- Connection is first open
- Higher frequency of transactions and better performance.
- REST API
Step Functions
-
They address limitations of Lambda.
-
Max runtime and statelessness of Lambda
-
They provide entity called state machine.
- They can be started based on other events.
- They have an IAM role.
- They contain step by step processes.
- They can be operating UP to 1 year.
- They have start, end and flow of action.
- Allow multiple lambda functions to co-ordinate and execute to accomplish a task.
- Gives visual workflows in server less way. Step Functions
-
Scales out
-
Doesn’t lose state
-
Deals with errors / timeouts
-
Easy to build and operate
-
Auditable
-
Uses json / ASDL - Amazon State Definition Language.
-
Seven State types
- Task : Single unit of work
- Coice : Adds branching logic
- Parallel : Fork and join the data across tasks.
- Wait: Delay for specified time
- Fail : Stops an execution and marks it as a failure
- Succeed: Stops an execution successfully.
- Pass: Passes it’s input to it’s output.
Step functions can interface with different services like: AWS Lambda, SQS, ECS, SNS, Glue, Fargate, SageMaker, DyanmoDB, Batch etc.
- Pricing:
-
- Pay per transition.