Severless - Lambda, DynamoDB, API Gateway, Cognito Flashcards

1
Q

10 Serverless products in AWS?

A
  • AWS Lambda
  • DynamoDB
  • AWS Cognito
  • AWS API Gateway
  • Amazon S3
  • AWS SNS & SQS
  • AWS Kinesis Data Firehose
  • Aurora Serverless
  • Step Functions
  • Fargate
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  • Virtual functions – no servers to manage!
  • Limited by time - short executions
  • Run on-demand
  • Scaling is automated!
A

Amazon Lambda

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

With Lambda, Increasing ___________ will also improve ________ and network!

A

RAM
CPU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

With Lambda, is it Easy to get more resources per functions?

A

YES (up to 10GB of RAM)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  • The container image must implement the Lambda Runtime API
  • ECS / Fargate is preferred for running arbitrary Docker images
A

Lambda Container Image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

AWS Lambda Limits are _______?

A

per region

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

AWS Lambda Execution - Memory allocation

A

128 MB – 10GB (1 MB increments)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

AWS Lambda Execution - Maximum execution time

A

900 seconds (15 minutes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

AWS Lambda Execution - Environment variables

A

(4 KB)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

AWS Lambda Execution - Disk capacity in the “function container” (in /tmp)

A

512 MB to 10GB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

AWS Lambda Execution - Concurrency executions

A

1000 (can be increased)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

AWS Lambda Deployment - Lambda function deployment size (compressed .zip)

A

50 MB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

AWS Lambda Deployment - Size of uncompressed deployment (code + dependencies)

A

250 MB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

AWS Lambda Deployment - Can use the ___________ directory to load other files at startup

A

/tmp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

AWS Lambda Deployment - Size of environment variables

A

4 KB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the 2 types of Edge Functions that CloudFront provides for Lambda??

A

CloudFront Functions
Lambda@Edge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Lambda Customization At The Edge … do you need to manage any servers?

A

NO, They are deployed globally

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are 10 use cases for CloudFront Functions & Lambda@Edge

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
  • 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
  • Native feature of CloudFront (manage code entirely within CloudFront)
A

CloudFront Functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
  • 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
  • Author your functions in one AWS Region (us-east-1), then CloudFront replicates to its locations
A

Lambda@Edge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Look at Slide 458

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

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

A

CloudFront Functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

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

A

Lambda@Edge

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

By default .. where is your Lambda Function launched?

A

outside your own VPC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
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
26
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...)
27
What must you do to connect a Lambda function to RDS Proxy?
The Lambda function must be deployed in your VPC, because RDS Proxy is never publicly accessible
27
* Improve scalability by pooling and sharing DB connections * Improve availability by reducing by 66% the failover time and preserving connections * Improve security by enforcing IAM authentication and storing credentials in Secrets Manager
RDS Proxy
28
Which RDS support Invoking Lambda?
RDS for PostgreSQL and Aurora MySQL
29
* Must allow outbound traffic to your Lambda function from within your DB instance (Public, NAT GW,VPC Endpoints) * DB instance must have the required permissions to invoke the Lambda function (Lambda Resource-based Policy & IAM Policy)
Invoking Lambda from RDS & Aurora
30
* Notifications that tells information about the DB instance itself (created, stopped, start, ...) * You don’t have any information about the data itself * Subscribe to the following event categories: DB instance, DB snapshot, DB Parameter Group, DB Security Group, RDS Proxy, Custom Engine Version * Near real-time events (up to 5 minutes) * Send notifications to SNS or subscribe to events using EventBridge
RDS Event Notifications
31
DynamoDB - Fully managed, highly available with replication __________?
across multiple AZs
32
* Scales to massive workloads, distributed database * Millions of requests per seconds, trillions of row, 100s of TB of storage * Fast and consistent in performance * Integrated with IAM for security, authorization and administration
DynamoDB
33
How fast and consistent in performance is DynamoDB?
(single-digit millisecond)
34
Does Dynamo DB have auto-scaling capabilities?
YES
35
Is DynamoDB always available?
YES
36
What are the 2 types of Table Classes in DynamoDB
Standard Infrequent Access (IA)
37
DynamoDB is made of _______?
Tables
38
Each DyanmoDB table has a __________ (must be decided at creation time)
Primary Key
39
Each DyanmoDB table can have __________ number of items
an infinite
40
Each DynamoDB item has ____________
attributes
41
Can item attributes be added over time? Can item attributes be null?
Yes Yes
42
What is the maximum size of a DynamoDB item?
400KB
43
Which data types are supported in DynamoDB?
* Scalar Types – String, Number, Binary, Boolean, Null * Document Types – List, Map * Set Types – String Set, Number Set, Binary Set
44
Therefore, in DynamoDB you can _______?
rapidly evolve schemas
45
DynamoDB – Read/Write Capacity Modes (2)
Provisioned Mode (default)
46
* You specify the number of reads/writes per second * You need to plan capacity beforehand * Pay for provisioned Read Capacity Units (RCU) & Write Capacity Units (WCU) * Possibility to add auto-scaling mode for RCU & WCU
Provisioned Mode (default)
47
* Read/writes automatically scale up/down with your workloads * No capacity planning needed * Pay for what you use, more expensive ($$$) * Great for unpredictable workloads, steep sudden spikes
On-Demand Mode
48
* Fully-managed, highly available, seamless in- memory cache for DynamoDB * Help solve read congestion by caching * Doesn’t require application logic modification (compatible with existing DynamoDB APIs)
DynamoDB Accelerator (DAX)
49
What is DynamoDB Accelerator (DAX) latency for cached data?
Microseconds
50
What is DynamoDB Accelerator (DAX) TTL for cache (default)
5 minutes
51
Ordered stream of item-level modifications (create/update/delete) in a table
DynamoDB – Stream Processing
52
What are 5 uses cases for DynamoDB – Stream Processing
* React to changes in real-time (welcome email to users) * Real-time usage analytics * Insert into derivative tables * Implement cross-region replication * Invoke AWS Lambda on changes to your DynamoDB table
53
What are 2 types of DynamoDB – Stream Processing
DynamoDB Streams Kinesis Data Streams (newer)
54
* 24 hours retention * Limited # of consumers * Process using AWS Lambda Triggers, or DynamoDB Stream Kinesis adapter
DynamoDB Streams
55
* 1 year retention * High # of consumers * Process using AWS Lambda, Kinesis Data Analytics, Kineis Data Firehose, AWS Glue Streaming ETL...
Kinesis Data Streams (newer)
56
* Make a DynamoDB table accessible with low latency in multiple-regions * Active-Active replication * Applications can READ and WRITE to the table in any region * Must enable DynamoDB Streams as a pre-requisite
DynamoDB Global Tables
57
* Automatically delete items after an expiry timestamp
DynamoDB –TimeTo Live (TTL)
58
DynamoDB –TimeTo Live (TTL) use cases
- reduce stored data by keeping only current items - adhere to regulatory obligations - web session handling
59
What are 2 types of DynamoDB – Backups for disaster recovery
Continuous backups using point-in-time recovery (PITR) On-demand backups
60
DynamoDB – Backups for disaster recovery * Full backups for long-term retention, until explicitely deleted * Doesn’t affect performance or latency * Can be configured and managed in AWS Backup (enables cross-region copy) * The recovery process creates a new table
On-demand backups
60
DynamoDB – Backups for disaster recovery * Optionally enabled for the last 35 days * Point-in-time recovery to any time within the backup window * The recovery process creates a new table
Continuous backups using point-in-time recovery (PITR)
61
* Works for any point of time int he last 35 days * Doesn’t affect the read capacity of your table * Perform data analysis on top of DynamoDB * Retain snapshots for auditing * ETL on top of S3 data before importing back into DynamoDB * Export in DynamoDB JSON or ION format
Export to S3 (must enable PITR)
62
* Import CSV, DynamoDB JSON or ION format * Doesn’t consume any write capacity * Creates a new table * Import errors are logged in CloudWatch Logs
Import from S3
63