AWS Lambda Flashcards

1
Q

FaaS stands for

A

Function as a Service

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

FaaS is also known as

A

Serverless computing

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

Serverless computing is an option for deploying applications on __________

A

cloud

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

With serverless compute you install a piece of ___________ on cloud platform

A

Function

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

How does AWS executes a function

A

he cloud platform makes the function available on-demand and manages resource allocation for you.

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

Design constraints/ design issues with Lambda. When to not use AWS Lambda

A
  1. Functions will timeout after 15 minutes.
  2. The amount of RAM available ranges from 128MB to 3008MB with a 64MB increment between each option.
  3. The Lambda code should not exceed 250mb in size, and the zipped version should be no larger than 50mb
  4. For few applications, with huge data size, AWS EC2 may be cheaper
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does AWS charge you for Lambda

A

AWS charges you for the number of requests your Lambda functions recieve and the time it takes to execute those requests per 100ms.

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

ETL with Lambda

A

Extract, Transform, Load (ETL) processes - retrieving data, processing it, and storing the results in a database works well as a function that can be triggered remotely or set up on a schedule.

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

What are the components of serverless applications?

A
  1. Event sources
  2. Functions
  3. In some cases services
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are event sources in AWS lambda

A

An event source is an AWS service or developer-created application that produces events that trigger an AWS Lambda function to run.

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

Event sources can be _______ and _________ sources

A

push and pull

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

What are push event sources

A

Services publish/push events to Lambda by invoking the cloud function directly.

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

What are pull event sources ?

A

For resources that do not publish directly to Lambda, Lambda pulls/polls resources

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

________________ enables automatic invocation of the Lambda function when events occur.

A

Event source mapping

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

What is the function of event source mapping?

A

Event source mapping identifies the type of events to publish and the Lambda function to invoke when events occur

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

Push event sources are also referred to as ?

A

Regular AWS Services.

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

Push event sources includes

A

SE, SNS, SES

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

For push event sources, the event source mapping is maintained on ________

A

the invoker/S3/SNS

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

Pull event sources are also referred to as ?

A

Stream-based event services.

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

Pull event sources includes

A

Kinesis, DynamoDB

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

Event source mapping is maintained on __________side

A

Lambda’s side.

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

Can Lambda be used as an event source

A

Yes. For S3, Lambda,

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

What happens when a designated event occurs on Lambda’s end ?

A

When the designated event occurs, the Lambda function runs it own container.

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

How are resources allocated when a Lambda function launches it’s container?

A

The resources allocated to the container and the number of containers launched is based on the size of the data and computational requirements of the function, all handled by AWS.

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

What are the types of Lambda invocation?

A
  1. Synchronous invocation

1. Asynchronous invocation

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

What is synchronous invocation?

A

When you invoke a function synchronously, Lambda runs the function and waits for a response. When the function completes, Lambda returns the response from the function’s code with additional data, such as the version of the function that was invoked.

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

What is asynchronous invocation?

A

When you invoke a function asynchronously, you don’t wait for a response from the function code. You hand off the event to Lambda and Lambda handles the rest.

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

S3, cloudwatch and SNS invokes functions _______ Sync/Aync)

A

Asynchronously

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

What are the parts of Lambda function.

A
  1. Handler function
  2. Event Object
  3. Context Object
  4. Callback function (Synchronous invocations)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What is a handler function in Lambda function

A

When your function is invoked, Lambda runs the handler method and it processes the events

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

Handler function python syntax

A
def handler_name(event, context): 
    ...
    return some_value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is Event object in Lambda function

A

An event is a JSON-formatted document that contains data for a Lambda function to process. The Lambda runtime converts the event to an object and passes it to your function code.

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

What is the default type of Event object ?

A

Event object is usually of the Python dict type. It can also be list, str, int, float, or the NoneType type.

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

What is context object in Lambda ?

A

A context object is passed to your function by Lambda at runtime. This object provides methods and properties that provide information about the invocation, function, and runtime environment.

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

What is callback function in AWS Lambda function ?

A

The callback function takes two arguments: an Error and a response. When you call it, Lambda waits for the event loop to be empty and then returns the response or error to the invoke

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

List Lambda functions in AWS CLI

A

aws lambda list-functions

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

What is AWS SAM

A

AWS Serverless Application Model

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

Each user can create upto _____ test events per function

A

10

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

What is a trigger

A

A trigger is a resource or configuration that invokes a function

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

What is an event

A

Event is a JSON formatted document that contains the data for the Lambda function to process.

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

How is an event passed to function?

A

The runtime converts the event to an objects and passes to a function.

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

What is execution environment ?

A

Execution environment is an secure and isolated environment for you Lambda function.

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

What are the responsibilities of execution environment?

A

Execution environment manages the processes and resources that are required to run a function. Also the execution environment provides any life-cycle support for the function and for any extensions associated with the function.

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

How do you deploy a function?

A

You deploy a function using Deployment package.

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

What are the types of deployment packages?

A
  1. .zip file archive

2. Container image

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

What is the .zip file archive deployment package ?

A

.zip file archive contains the code and dependencies. Lambda provides the OS and runtime environment to execute the code.

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

What is the container image deployment package ?

A

With the container image deployment package, you add the function code, dependencies, OS and Lambda runtime to the image.

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

The container image of AWS Lambda is compatible with ______________

A

Open Container Initiative (OCI)

49
Q

What is runtime?

A

Runtime provides the language specific environment that runs in a execution environment.

50
Q

What is the functionality of runtime in AWS Lambda ?

A

Runtime relays the invocation events, context information, and responses between Lambda and the function.

51
Q

What is a Lambda Layer ?

A

A Lambda Layer is a .zip file archive that contains additional code or other content. A Layer can contain libraries, custom runtime, data or configuration files.

52
Q

How to reduce the size of uploaded deployment archives?

A

Using Lambda Layers.

53
Q

What are the advantages of Lambda Layers?

A

Lambda Layers promote code sharing and separation of responsibilities so that you can iterate faster on writing the business logic.

54
Q

What is the max number of layers per function

A

5

55
Q

Where are the contents of the layers extracted?

A

The contents of the included layer are extracted to the /opt directory in the execution environment.

56
Q

What is the default visibility of the Layers

A

By default the layers you create are private to the AWS account you create.

57
Q

Can you share the Layers with other AWS accounts?

A

You can share the layers with other AWS accounts or make it public.

58
Q

What happens when a shared layer is deleted or when access is revoked?

A

When a shared layer is deleted or if your access is revoked you can continue to use the layer version but you cannot create a new function or update functions using the deleted version of the layer.

59
Q

Does functions deployed as containers use Layers ? Why?

A

No. Container images don’t use layers since all the dependencies are packaged into the container.

60
Q

What are Lambda extensions?

A

Lambda extensions enable you to augment your functions. You use extensions to integrate your function with preferred monitoring, observability, security and governance tools.

61
Q

Types of Lambda extensions.

A
  1. Internal extensions.

2. External extensions

62
Q

Where does internal extension run?

A

Internal extension within runtime.

63
Q

What is lifecycle of internal extensions?

A

Internal extensions shares the same lifecycle as runtime.

64
Q

Where does external extension run?

A

External extension runs in the execution environment.

65
Q

Lifecycle of external extension

A

External extension is initialized before the function is invoked, runs in parallel with the runtime and continues to run after the function invocation is complete.

66
Q

What does concurrency denote?

A

Concurrency is the number of requests your function is serving at a given time.

67
Q

What is the default quota of the concurrency and what is the max configurable limit ?

A

1000 and hundreds of thousands

68
Q

What is qualifier?

A

Qualifier is used to specify a version or alias.

69
Q

What is a version

A

A version is a immutable snapshot of a function’s code and configuration that has numerical qualifier. Example - my-function:1

70
Q

What is an alias?

A

Alias is a pointer to a version that you can update to map to a different version or split traffic between two versions

71
Q

Can alias and version be used together ?

A

Yes

72
Q

How Lambda runtime handles multiple events in a row?

A

When a handler finishes processing the first event, the run time send the handler a second event while the function’s class stays in-memory, so the clients and variables declared outside of the handler method in initialization can be reused.

73
Q

Once initialized, how many requests can a instance process.

A

Thousands of requests.

74
Q

How long does the instances of a Lambda function stay active.

A

The instances of a function remain active for a few hours before the being recycled.

75
Q

What communicates the logs to Cloudwatch Logs?

A

The runtime captures the logging output from the function and sends it to Amazon Cloudwatch logs.

76
Q

What logs the start and end invocation times

A

Runtime

77
Q

What returns the error to invoker if a function throws an error?

A

Runtime

78
Q

What tracks or logs the requestID, billed duration and other details

A

Runtime

79
Q

When can the log data be lost

A
  1. Throttling

2. When instance of the function is stopped.

80
Q

What is reserved concurrency?

A

To prevent a function from using too much concurrency, and to preserve a portion of your account’s available concurrency for your function.

81
Q

What is provisioned concurrency?

A

For functions that take long time to initialize or that require extremely low latency for all invocations, provisioned concurrency enables you to pre-initialize the instances of your function and keeps them running at all times.

82
Q

How are retries handled in asynchronous invocation.

A

If a function returns an error or throttled, Lambda handles the retries.

83
Q

What are destinations in AWS Lambda

A

You can add a destination to your functions to send invocation details to another service.

84
Q

In which invocation can you add destinations?

A

You can add destinations when your function is invoked asynchronously or by an event source mapping that reads from a stream.

85
Q

If deployment package is greater than ____, then upload it from S3

A

50MB

86
Q

What are environment variables?

A

Key-value pairs that Lambda sets in execution environment.

87
Q

What is the purpose of environment variables?

A

Extend function’s configuration outside of code. For example setting test variables and production variables.

88
Q

What are tags used for?

A

Tags are used for organizing Lambda functions for cost reporting and filtering.

89
Q

What is execution role?

A

The IAM role that Lambda assumes when running your function.

90
Q

What is memory?

A

The amount of memory available at run time.

91
Q

Min and Max memory values

A

128 MB - 10,240 MB, 1MB increments.

92
Q

Timeout

A

Amount of time Lambda allows a function to run before stopping it.

93
Q

Default timeout value ? and configurable upto ?

A

3 seconds and configurable upto 900 secs

94
Q

What happens when you publish a version?

A

When you publish a version, the code and most of the configuration settings are locked for that version.

95
Q

The unpublished version is named _______

A

$LATEST

96
Q

The environment variables set in execution environment are made available to the function by ______

A

Runtime

97
Q

What creates its own environment variables and what information does it contain?

A

Runtime creates its own environment variables that are passed to function and they contain information about function and invocation request.

98
Q

When are environment variables evaluated?

A

Environment variables are evaluated prior to function invocation.

99
Q

When you publish a function, the environment variables are ______

A

locked

100
Q

You can define the environment variables only in _______ version of the function

A

Unpublished/$LATEST

101
Q

Are environment variables encrypted?

A

Yes

102
Q

How are environment variables encrypted ?

A

Lambda encrypts the environment variables at rest with a key it creates in your account for free.

103
Q

What is key that Lambda creates in your account called?

A

Amazon Managed Customer Master Key (CMK)

104
Q

What are the restrictions when you give your own key to encrypt environment variables?

A

When you provide the key, only users in your account with access to the key can view or manage the environment variables.

105
Q

What KMS permissions are required for the user or function’s execution role to use the default encryption key?

A

No AWS KMS permissions are required.

106
Q

How to allocation more provisioned concurrency than the reserved concurrency?

A

You can’t allocate more provisioned concurrency than reserved concurrency for a function.

107
Q

How much concurrency can you reserve?

A

You can reserve up to the Unreserved account concurrency value that is shown, minus 100 for functions that don’t have reserved concurrency.

108
Q

When does throttling occur in Lambda functions?

A

Throttling errors occur when all of the concurrency in a pool is in use.

109
Q

Advantages of reserved concurrency

A
  1. Other functions can’t prevent your function from scaling

2. Your function can’t scale out of control

110
Q

You can manage provisioned concurrency for ________ and ______ only

A

Aliases and versions.

111
Q

How provisioned concurrency works

A

Provisioned concurrency does not come online immediately after you configure it. Lambda starts allocating provisioned concurrency after a minute or two of preparation. Similar to how functions scale under load, up to 3000 instances of the function can be initialized at once, depending on the Region. After the initial burst, instances are allocated at a steady rate of 500 per minute until the request is fulfilled. When you request provisioned concurrency for multiple functions or versions of a function in the same Region, scaling quotas apply across all requests.

To optimize latency, you can customize the initialization behavior for functions that use provisioned concurrency . You can run initialization code for provisioned concurrency instances without impacting latency, because the initialization code runs at allocation time. However, the initialization code for an on-demand instance directly impacts the latency of the first invocation. For an on-demand instance, you may choose to defer initialization for a specific capability until the function needs that capability.

To determine the type of initialization, check the value of AWS_LAMBDA_INITIALIZATION_TYPE. Lambda sets this environment variable to provisioned-concurrency or on-demand. The value of AWS_LAMBDA_INITIALIZATION_TYPE is immutable and does not change over the lifetime of the execution environment.

For provisioned concurrency instances, your function’s initialization code runs during allocation and every few hours, as running instances of your function are recycled. You can see the initialization time in logs and traces after an instance processes a request. However, initialization is billed even if the instance never processes a request. Provisioned concurrency runs continually and is billed separately from initialization and invocation costs. For details, see AWS Lambda pricing.

Each version of a function can only have one provisioned concurrency configuration. This can be directly on the version itself, or on an alias that points to the version. Two aliases can’t allocate provisioned concurrency for the same version. Also, you can’t allocate provisioned concurrency on an alias that points to the unpublished version ($LATEST).

When you change the version that an alias points to, provisioned concurrency is deallocated from the old version and then allocated to the new version. You can add a routing configuration to an alias that has provisioned concurrency. However, you can’t manage provisioned concurrency settings on the alias while the routing configuration is in place.

112
Q

What is qualified ARN

A

With version suffix

113
Q

Unqualified ARN

A

Without version suffix

114
Q

When you invoke a function using an unqualified ARN, Lambda implicitly invokes ______.

A

$LATEST

115
Q

An alias can point only to a function _____

A

version

116
Q

You can use a __________ to give a service, resource, or account access to your function.

A

resource-based policy

117
Q

The scope of permission depends on whether you apply it to _____________

A

an alias, a version, or the entire function.

118
Q

What is Alias routing configuration

A

Use routing configuration on an alias to send a portion of traffic to a second function version.