Severless - Lambda, DynamoDB, API Gateway, Cognito Flashcards
10 Serverless products in AWS?
- AWS Lambda
- DynamoDB
- AWS Cognito
- AWS API Gateway
- Amazon S3
- AWS SNS & SQS
- AWS Kinesis Data Firehose
- Aurora Serverless
- Step Functions
- Fargate
- Virtual functions – no servers to manage!
- Limited by time - short executions
- Run on-demand
- Scaling is automated!
Amazon Lambda
With Lambda, Increasing ___________ will also improve ________ and network!
RAM
CPU
With Lambda, is it Easy to get more resources per functions?
YES (up to 10GB of RAM)
- The container image must implement the Lambda Runtime API
- ECS / Fargate is preferred for running arbitrary Docker images
Lambda Container Image
AWS Lambda Limits are _______?
per region
AWS Lambda Execution - Memory allocation
128 MB – 10GB (1 MB increments)
AWS Lambda Execution - Maximum execution time
900 seconds (15 minutes)
AWS Lambda Execution - Environment variables
(4 KB)
AWS Lambda Execution - Disk capacity in the “function container” (in /tmp)
512 MB to 10GB
AWS Lambda Execution - Concurrency executions
1000 (can be increased)
AWS Lambda Deployment - Lambda function deployment size (compressed .zip)
50 MB
AWS Lambda Deployment - Size of uncompressed deployment (code + dependencies)
250 MB
AWS Lambda Deployment - Can use the ___________ directory to load other files at startup
/tmp
AWS Lambda Deployment - Size of environment variables
4 KB
What are the 2 types of Edge Functions that CloudFront provides for Lambda??
CloudFront Functions
Lambda@Edge
Lambda Customization At The Edge … do you need to manage any servers?
NO, They are deployed globally
What are 10 use cases for CloudFront Functions & Lambda@Edge
- Website Security and Privacy
- Dynamic Web Application at the Edge
- Search Engine Optimization (SEO)
- Intelligently Route Across Origins and Data Centers
- Bot Mitigation at the Edge
- Real-time Image Transformation
- A/BTesting
- User Authentication and Authorization
- User Prioritization
- User Tracking and Analytics
- Lightweight functions written in JavaScript
- For high-scale, latency-sensitive CDN customizations
- Sub-ms startup times, millions of requests/second
- Used to change Viewer requests and responses:
- Viewer Request: after CloudFront receives a request from a
viewer - Viewer Response: before CloudFront forwards the response to
the viewer
- Viewer Request: after CloudFront receives a request from a
- Native feature of CloudFront (manage code entirely within CloudFront)
CloudFront Functions
- Lambda functions written in NodeJS or Python
- Scales to 1000s of requests/second
- Used to change CloudFront requests and responses:
- Viewer Request – after CloudFront receives a request from a
viewer - Origin Request – before CloudFront forwards the request to the
origin - Origin Response – after CloudFront receives the response from
the origin - Viewer Response – before CloudFront forwards the response to
the viewer
- Viewer Request – after CloudFront receives a request from a
- Author your functions in one AWS Region (us-east-1), then CloudFront replicates to its locations
Lambda@Edge
Look at Slide 458
Use Cases:
* Cache key normalization
* Transform request attributes (headers, cookies, query strings,
URL) to create an optimal Cache Key
* Header manipulation
* Insert/modify/delete HTTP headers in the
request or response
* URL rewrites or redirects
* Request authentication & authorization
* Create and validate user-generated tokens (e.g., JWT) to
allow/deny requests
CloudFront Functions
Use Cases:
* Longer execution time (several ms)
* Adjustable CPU or memor y
* Your code depends on a 3rd libraries (e.g., AWS SDK to access other AWS services)
* Network access to use external ser vices for processing
* File system access or access to the body of HTTP requests
Lambda@Edge
By default .. where is your Lambda Function launched?
outside your own VPC
Lambda in VPC
- You must define the VPC ID, the Subnets and the Security Groups
- Lambda will create an ENI (Elastic Network Interface) in your subnets
Lambda by default
- By default, your Lambda function is launched outside your own VPC (in an AWS-owned VPC)
- Therefore, it cannot access resources in your VPC (RDS, ElastiCache, internal ELB…)