Lambda Flashcards

1
Q

Lambda

A

A serverless compute service that executes your code only when needed and scales automatically.

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

True/False. Lambda functions are stateful.

A

False. Lambda functions are stateless – no affinity to the underlying infrastructure.

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

How are resources assigned to Lambda?

A

You choose the amount of memory you want to allocate to your functions and AWS Lambda allocates proportional CPU power, network bandwidth, and disk I/O.

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

What compliance frameworks does Lambda support?

A

AWS Lambda is SOC, HIPAA, PCI, ISO compliant.

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

What languages are support by Lambda?

A

Node.js
Java
C#
Go
Python
Ruby
PowerShell

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

True/False. You can also provide your own custom runtime.

A

True.

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

What is a function?

A

a script or program that runs in Lambda. Lambda passes invocation events to your function. The function processes an event and returns a response.

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

What are Execution Environments?

A

a secure, isolated micro virtual machine where a Lambda function is executed.

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

What are Runtimes?

A

Lambda runtimes allow functions in different languages to run in the same base execution environment. The runtime sits in-between the Lambda service and your function code, relaying invocation events, context information, and responses between the two.

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

What are Environment Variables?

A

key-value pairs that you can use to store configuration settings for your function. They can be used to pass dynamic parameters to your function at runtime, such as database connection strings, API keys, and other sensitive information.

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

What are Layers?

A

Lambda layers are a distribution mechanism for libraries, custom runtimes, and other function dependencies. Layers let you manage your in-development function code independently from the unchanging code and resources that it uses.

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

What is Event Source?

A

an AWS service or a custom service that triggers your function and executes its logic.

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

What is Downstream resources?

A

an AWS service that your Lambda function calls once it is triggered.

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

What are Log Streams?

A

While Lambda automatically monitors your function invocations and reports metrics to CloudWatch, you can annotate your function code with custom logging statements that allow you to analyze the execution flow and performance of your Lambda function.
AWS Serverless Application Model

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

How can you upload your application code?

A

as a ZIP file or a container image hosted on Amazon Elastic Container Registry (Amazon ECR).

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

How do you create a Lambda?

A

To create a Lambda function, you first package your code and dependencies in a deployment package. Then, you upload the deployment package to create your Lambda function.

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

What happens with production Lambdas by default?

A

After your Lambda function is in production, Lambda automatically monitors functions on your behalf, reporting metrics through Amazon CloudWatch.

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

What are basic function settings?

A

A description, memory usage, storage (512MB-10GB), execution timeout (15 minutes max), and the role that the function will use to execute your code.

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

How are Environment variables secured?

A

are always encrypted at rest and can be encrypted in transit as well.

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

What are Versions?

A

a snapshot of your function’s state at a given time. When you publish a new version, a :version-number is appended to your function’s ARN:

arn:aws:lambda:us-east-2:123456789123:function:my-function:1

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

What are Aliases?

A

serves as a pointer to a Lambda function version. Aliases create a human-readable version of the function’s name, making it easier to remember and understand what the function does. An alias follows the following format:

arn:aws:lambda:us-east-2:123456789123:function:my-function:MyAlias

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

What is a Layer?

A

A layer is a ZIP archive that contains libraries, a custom runtime, or other dependencies. Use layers to manage your function’s dependencies independently and keep your deployment package small.

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

True/False. You can configure a function to mount an Amazon EFS file system to a local directory. With Amazon EFS, your function code can access and modify shared resources securely and at high concurrency.

A

True.

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

What innovations are supported by a Lambda Function?

A

Lambda supports synchronous and asynchronous invocation of a Lambda function.

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

What is Synchronous Invocation?

A

-when a function is invoked synchronously, AWS Lambda waits until the function is done processing, then returns the result.
-examples of AWS services that invoke Lambda functions synchronously:
–Amazon API Gateway Application Load Balancer
–Amazon Cognito
–Amazon Kinesis Data Firehose
–Amazon CloudFront (Lambda@Edge)

26
Q

What is Asynchronous Invocation?

A

when a function is invoked asynchronously, AWS Lambda stores the event in an internal queue and handles the invocation. The Lambda function returns a 202 status code (Accepted) immediately after being invoked, and the processing continues in the background. The 202 code just confirms that the event is queued; it does not indicate whether the function runs successfully or not.

27
Q

Typical use care for Asynchronous Invocation?

A

typically used for long-latency processes that run in the background, such as batch operations, video encoding, and order processing.

28
Q

Payload size for Asynchronous Invocation

A

can only accept a payload of up to 256 KB.

29
Q

AWS services that invoke Lambda Functions Asynchronously?

A

-Amazon API Gateway (by specifying Event in the X-Amz-Invocation-Type request header of a non-proxy integration)
-Amazon S3
-Amazon CloudWatch Logs
-Amazon EventBridge
-AWS CodeCommit
-AWS CloudFormation
-AWS Config

30
Q

Event Source Mapping

A

Event source mapping is a Lambda resource that reads from a queue or stream and synchronously invokes a Lambda function.

31
Q

How can you filter out patters that are only relevant to your application?

A

You can apply an event-filtering pattern to process events that are only relevant to your application. This allows you to save money by reducing the number of function invocations.

32
Q

What conditions are required for Event Source Mapping to invoke a function?

A

-The batch size is reached
-The maximum batching window is reached
-The total payload is 6 MB

33
Q

Lambda provides Event Source Mapping for what services?

A

-Amazon Kinesis
-Amazon DynamoDB
-Amazon Simple Queue Service
-Amazon MQ
-Amazon Managed Streaming for Apache Kafka (Amazon MSK)
-Self-managed Apache Kafka

34
Q

How can you run your code without including dependencies in your deployment package?

A

AWS Lambda includes a number of pre-built dependencies for specific runtimes. These dependencies can be used to run your code without having to include them in your deployment package.

35
Q

What should you do if you are using external library/SDK/module?

A

-Place all external dependencies locally in your application’s folder.
-Create a ZIP deployment package of your Lambda function.
-Upload the deployment package to AWS Lambda. You can send the file directly to the AWS Lambda Console or store it first in Amazon S3 and deploy it from there.

36
Q

Concurrency

A

is the number of instances that serve requests at a given time. When your function is invoked, Lambda allocates an instance of it to process the event. When the function finishes running, it can handle another request. If the function is invoked again while a request is still being processed, another instance is allocated, which increases the function’s concurrency.

37
Q

Reserved Concurrency

A

To ensure that a function can always reach a certain level of concurrency, you can configure the function with reserved concurrency. When a function has reserved concurrency, no other function can use that concurrency.

38
Q

True/False. Reserved concurrency also limits the maximum concurrency for the function.

A

True.

39
Q

Provisioned Concurrency

A

To enable your function to scale without fluctuations in latency, use provisioned concurrency. By allocating provisioned concurrency before an increase in invocations, you can ensure that all requests are served by initialized instances with very low latency.

40
Q

What can you do with a function URL?

A

With the function URL feature of the AWS Lambda service, you can launch a secure HTTPS endpoint dedicated to your custom Lambda function.

41
Q

True/False. You need an intermediary service such as Amazon API Gateway to directly invoke your function, which was required in the past. Just send an HTTP request to the unique URL of your Lambda function to get started.

A

False. You DON’T need an intermediary service such as Amazon API Gateway to directly invoke your function, which was required in the past. Just send an HTTP request to the unique URL of your Lambda function to get started.

42
Q

How are URL endpoints accessible by default and what is the format?

A

Function URL endpoints are publicly accessible by default and have the following format:

https://<url-id>.lambda-url.<region>.on.aws
43
Q

How can you create and configure a Function URL?

A

A Lambda Function URL can be created and configured via the AWS Lambda console or through the Lambda API.

44
Q

True/False. Upon creating a function URL, AWS Lambda automatically generates a unique URL endpoint for you that you can immediately use.

A

True.

45
Q

True/False. This URL endpoint is static and can be change after it has been created.

A

False. This URL endpoint is static and doesn’t change once created.

46
Q

True/False. Lambda URLS are not dual stack-enabled. They only support IPv4.

A

False. Lambda URLs are dual stack-enabled, which support both IPv4 and IPv6 protocols

47
Q

How can you invoke a Lambda URL?

A

The URL can be invoked via a web browser, CURL, Postman, or any HTTP client.

48
Q

What authentication types allow you to control access to a Function URL?

A

-AWS_IAM – uses IAM to authenticate and authorize users. Only IAM users or roles that have been granted permission to invoke the function through IAM policies will be able to do so.
-NONE – allows anyone who has the function URL to execute the Lambda function whether they have an AWS account or not.

49
Q

True/False. You can access your function URL through the VPC and via AWS PrivateLink (e.g., VPC Endpoints)

A

False. You can access your function URL through the public Internet only and not via AWS PrivateLink (e.g., VPC Endpoints)

50
Q

Function URLs use resource-based policies for security and access control. How can you future secure your Function URL?

A

You can further secure your function URL by enabling cross-origin resource sharing (CORS) to whitelist origins permitted to invoke it.

51
Q

True/False. A function URL can be applied to any Lambda function alias or to the LATEST unpublished function version but not to any other function version.

A

True.

52
Q

True/False. In AWS Lambda, you can set up your function to establish a connection to your virtual private cloud (VPC).

A

True

53
Q

What private resources can your function access when connected to your VPC?

A

Your function can access the private resources of your VPC during execution like EC2, RDS and many others.

54
Q

True/False. By default, AWS executes your Lambda function code securely within a VPC.

A

True.

55
Q

How can you enable your Function to access resources inside your private VPC?

A

By providing additional VPC-specific configuration information such as VPC Subnet IDs and Security Group IDs.

It uses this information to set up elastic network interfaces which enable your Lambda function to connect securely to other resources within your VPC.

56
Q

Lambda@Edge

A

Lets you run Lambda functions to customize content that CloudFront delivers, executing the functions in AWS locations closer to the viewer. The functions run in response to CloudFront events, without provisioning or managing servers.

57
Q

How can you use Lambda Functions to change CloudFront requests and responses?

A

-After CloudFront receives a request from a viewer (viewer request)
-Before CloudFront forwards the request to the origin (origin request)
-After CloudFront receives the response from the origin (origin response)
-Before CloudFront forwards the response to the viewer (viewer response)

58
Q

How can you automate your serverless application’s release process?

A

You can automate your serverless application’s release process using AWS CodePipeline and AWS CodeDeploy.

59
Q

True/False. Lambda will automatically track the behavior of your Lambda function invocations and provide feedback that you can monitor.

A

True. In addition, it provides metrics that allow you to analyze the full function invocation spectrum, including event source integration and whether downstream resources perform as expected.

60
Q

Lambda Snapstart

A

Lambda SnapStart speeds up your Java applications by reusing a single initialized snapshot to quickly resume multiple execution environments.

61
Q

How can you use SnapStart for Java feature to decrease the cold start time required without provisioning additional resources?

A

You can use the Lambda SnapStart for Java feature to decrease the cold start time required without provisioning additional resources. This also removes the burden of implementing complex performance optimizations for your Java application

62
Q

How is Lambda priced?

A

You are charged based on the total number of requests for your functions and the duration, the time it takes for your code to execute.