2. • Serverless Lover
• Loves building all kinds of
multimedia services
• Software Engineer @ Vingle
• https://github.com/mooyoul
• https://mooyoul.github.io
Who am i?
3. Topics
• Lambdaless
• What’s Lambdaless? When to use? How?
• Real-world Examples
• AWS CDK
• What's AWS CDK, How to use that?
• Unlocking new possibilities
10. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
GET https://api-id.execute-api.amazonaws.com/stage/path
11. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
Call AWS Service API
12. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
Call AWS Service API
13. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
Call AWS Service API
14. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
Get file contents by calling GetObject
15. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
Get file contents by calling GetObject
16. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
Get file contents by calling GetObject
17. How Lambda invoked via
HTTP
AWS Lambda Amazon S3
Role
Internet
Amazon API Gateway
Role
Users
Let’s focus this part
24. If you need to build an URL
shortener service,
What will you do?
25. URL Shortener requirements
• Create Shorten ID and Store original URL
• Redirect to original URL if exists
• Collect visitor statistics
26. URL Shortener requirements
• Create Shorten ID and Store original URL
• Redirect to original URL if exists
• Collect visitor statistics
https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html
27. URL Shortener requirements
• Create Shorten ID and Store original URL
• Redirect to original URL if exists
• Collect visitor statistics
S3 built-in feature
28. URL Shortener requirements
• Create Shorten ID and Store original URL
• Redirect to original URL if exists
• Collect visitor statistics
Turn on Access Log & Run ETL through Athena
29. Users
Amazon API Gateway
Amazon Cloudfront
Amazon S3
AWS Lambda
Lookup shorten id
and redirect
Store original URL
with shorten id
Store access logs
33. Users
Amazon API Gateway
Amazon Cloudfront
Amazon S3
AWS Lambda
Lookup shorten id
and redirect
Store original URL
with shorten id
Store access logs
34. Users
Amazon API Gateway
Amazon Cloudfront
Amazon S3
Lookup shorten id
and redirect
Store access logs
Store original URL
with shorten id
78. Hidden parts
• Dependency management
• If axios is updated, We need to update axios dependency and deploy function
• Runtime management
• If Node.js runtime reaches EOL, We need to update lambda runtime and deploy
function
• Monitoring
• We need to monitor Lambda metrics
• Wasting Money
• Most of execution time: Just waiting for response
• Performance overhead & Size limitations
104. More use cases
• Expose Kinesis Firehose endpoint to collect data
• Collect external incoming webhook payload (e.g. SendGrid Events, Slack
Outgoing Webhook)
• Expose Amazon IoT Data endpoint to publish events
• Public Real-time messaging
• Public Event Pub/Sub Channel
• Expose Step Functions Execution endpoint
• Any else AWS API can be invoked via API Gateway
• e.g. SNS, SQS, AppSync
106. Anything else?
• Securing API Gateway
• API Key
• Cognito Integration
• Parameter Validation
• Supports OpenAPI Schema to validate payload
• Parameter Mapping
• Context Parameters
107. Bonus: Lambdaless
Scheduled Task
• Setup Cron Rule from CloudWatch Events
• Publish Cron Trigger Event to SNS topic
• Subscribe SNS topic and Notify Event to HTTP
Endpoint (Webhook)
• Use Webhook Endpoint as API Gateway
• It’s possible in theory, but not recommended!
109. When to use Lambdaless
• Super simple Task
• Proxy
• Mock API
• Call single AWS Service API
110. When NOT to use
Lambdaless
• Anything else of “When to use Lambdaless”
• Require complex business logic
• Require data join
• Require computation
• Require non-interactive event triggers (e.g.
DynamoDB Callback)
111. Recap: Lambdaless
• What’s Lambdaless?
• Serverless Architecture without Lambda
• Use API Gateway as first class
• When to use Lambdaless?
• Super simple task only
• Use-cases
• URL Shortener Service, Basic CRUD API (DynamoDB), Proxy
119. CDK Key Features
• Define AWS Resources in modern programming
language, not YAML
• TypeScript, Python
• Reusable Template, Abstract the details
• Easy to reference pre-existing AWS Resources
120. CDK Key Features
• Built-in CLI provides seamless development experience
• Easy Deploy & Packaging
• Build Docker Image & Publish to ECR
• Package lambda code
• Extended AWS Resource support
• Issue a ACM Certificate using DNS Validation