Serverless architecture
with AWS Lambda
What is serverless ???



What is serverless?
Run code without thinking of servers
- Event based
- Stateless
- Containerized
- Pay by usage
- Scalable
- Real time

Where?
- Google cloud functions
- Azure functions
- AWS Lambda



AWS Lambda
- Compute service
- Responds to events
- Handles:
- Provisioning
- Infrastructure
- Scaling
- Performance
- Pay for what you use

pricing
- # requests
- 1,000,000 free requests per moth
- $0.20 per 1m requests thereafter ($0.0000002 per request)
-
Compute time
- Units of 100ms
- Depends on memory allocationĀ
pricing

code
- Run in C# / Node / Java / Python
- Use any library
- Uses docker in the background
integrations
- S3
- DynamoDB
- SES
- SNS
- Cognito
- CodeCommit
- ApiGateway
- ...
API
exports.handler = (event, context, callback) => {
console.log('Received event:', JSON.stringify(event, null, 2));
callback(null, event.key1);
};Demo
Use cases
- REST API
- Generate a thumbnail when an image is uploaded to S3
- Monitor service
- Automated backups
- Create a custom Alexa skillĀ
- Slack plugin
- Handle SES bounces
- Create redirects
- Alarm actions
- ...
Downsides
- Cannot trigger different lambda with same event
- Not suitable for long pooling
- Weak control over environment
- Timeboxed
- Tricky to test
How WE use lambda
- Calculate PEinfo for S3 files
- Remove IP from security group when terminating EC2
- Add notification to statuspage.io when SQS size > 100

q&a?
you
are
awesome !!!
Serverless
By Petru Isfan
Serverless
- 33