AWS Lambda | AWS Lambda functions Flashcards

1
Q

What AWS regions are available for AWS Lambda?

AWS Lambda functions

AWS Lambda | Compute

A

Please refer to the AWS Global Infrastructure Region Table.

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

What is an AWS Lambda function?

AWS Lambda functions

AWS Lambda | Compute

A

The code you run on AWS Lambda is uploaded as a “Lambda function”. Each function has associated configuration information, such as its name, description, entry point, and resource requirements. The code must be written in a “stateless” style i.e. it should assume there is no affinity to the underlying compute infrastructure. Local file system access, child processes, and similar artifacts may not extend beyond the lifetime of the request, and any persistent state should be stored in Amazon S3, Amazon DynamoDB, or another Internet-available storage service. Lambda functions can include libraries, even native ones.

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

Will AWS Lambda reuse function instances?

AWS Lambda functions

AWS Lambda | Compute

A

To improve performance, AWS Lambda may choose to retain an instance of your function and reuse it to serve a subsequent request, rather than creating a new copy. To learn more about how Lambda reuses function instances, visit our documentation. Your code should not assume that this will always happen.

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

What if I need scratch space on disk for my AWS Lambda function?

AWS Lambda functions

AWS Lambda | Compute

A

Each Lambda function receives 500MB of non-persistent disk space in its own /tmp directory.

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

Why must AWS Lambda functions be stateless?

AWS Lambda functions

AWS Lambda | Compute

A

Keeping functions stateless enables AWS Lambda to rapidly launch as many copies of the function as needed to scale to the rate of incoming events. While AWS Lambda’s programming model is stateless, your code can access stateful data by calling other web services, such as Amazon S3 or Amazon DynamoDB.

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

Can I use threads and processes in my AWS Lambda function code?

AWS Lambda functions

AWS Lambda | Compute

A

Yes. AWS Lambda allows you to use normal language and operating system features, such as creating additional threads and processes. Resources allocated to the Lambda function, including memory, execution time, disk, and network use, must be shared among all the threads/processes it uses. You can launch processes using any language supported by Amazon Linux.

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

What restrictions apply to AWS Lambda function code?

AWS Lambda functions

AWS Lambda | Compute

A

Lambda attempts to impose as few restrictions as possible on normal language and operating system activities, but there are a few activities that are disabled: Inbound network connections are blocked by AWS Lambda, and for outbound connections only TCP/IP sockets are supported, and ptrace (debugging) system calls are blocked. TCP port 25 traffic is also blocked as an anti-spam measure.

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

How do I create an AWS Lambda function using the Lambda console?

AWS Lambda functions

AWS Lambda | Compute

A

If you are using Node.js or Python, you can author the code for your function using code editor in the AWS Lambda console which lets you author and test your functions, and view the results of function executions in a robust, IDE-like environment. Go to the console to get started.

You can also package the code (and any dependent libraries) as a ZIP and upload it using the AWS Lambda console from your local environment or specify an Amazon S3 location where the ZIP file is located. Uploads must be no larger than 50MB (compressed). You can use the AWS Eclipse plugin to author and deploy Lambda functions in Java. You can use the Visual Studio plugin to author and deploy Lambda functions in C#, and Node.js.

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

How do I create an AWS Lambda function using the Lambda CLI?

AWS Lambda functions

AWS Lambda | Compute

A

You can package the code (and any dependent libraries) as a ZIP and upload it using the AWS CLI from your local environment, or specify an Amazon S3 location where the ZIP file is located. Uploads must be no larger than 50MB (compressed). Visit the Lambda Getting Started guide to get started.

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

Does AWS Lambda support environment variables?

AWS Lambda functions

AWS Lambda | Compute

A

Yes. You can easily create and modify environment variables from the AWS Lambda Console, CLI or SDKs. To learn more about environment variables, see the documentation.

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

Can I store sensitive information in environment variables?

AWS Lambda functions

AWS Lambda | Compute

A

For sensitive information, such as database passwords, we recommend you use client-side encryption using AWS Key Management Service and store the resulting values as ciphertext in your environment variable. You will need to include logic in your AWS Lambda function code to decrypt these values.

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

How can I manage my AWS Lambda functions?

AWS Lambda functions

AWS Lambda | Compute

A

You can easily list, delete, update, and monitor your Lambda functions using the dashboard in the AWS Lambda console. You can also use the AWS CLI and AWS SDK to manage your Lambda functions. Visit the Lambda Developers Guide to learn more.

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

How do I monitor an AWS Lambda function?

AWS Lambda functions

AWS Lambda | Compute

A

AWS Lambda automatically monitors Lambda functions on your behalf, reporting real-time metrics through Amazon CloudWatch, including total requests, account-level and function-level concurrency usage, latency, error rates, and throttled requests. You can view statistics for each of your Lambda functions via the Amazon CloudWatch console or through the AWS Lambda console. You can also call third-party monitoring APIs in your Lambda function.

Visit Troubleshooting CloudWatch metrics to learn more. Standard charges for AWS Lambda apply to use Lambda’s built-in metrics.

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

How do I troubleshoot failures in an AWS Lambda function?

AWS Lambda functions

AWS Lambda | Compute

A

AWS Lambda automatically integrates with Amazon CloudWatch logs, creating a log group for each Lambda function and providing basic application lifecycle event log entries, including logging the resources consumed for each use of that function. You can easily insert additional logging statements into your code. You can also call third-party logging APIs in your Lambda function. Visit Troubleshooting Lambda functions to learn more. Amazon CloudWatch Logs rates will apply.

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

How do I scale an AWS Lambda function?

AWS Lambda functions

AWS Lambda | Compute

A

You do not have to scale your Lambda functions – AWS Lambda scales them automatically on your behalf. Every time an event notification is received for your function, AWS Lambda quickly locates free capacity within its compute fleet and runs your code. Since your code is stateless, AWS Lambda can start as many copies of your function as needed without lengthy deployment and configuration delays. There are no fundamental limits to scaling a function. AWS Lambda will dynamically allocate capacity to match the rate of incoming events.

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

How are compute resources assigned to an AWS Lambda function?

AWS Lambda functions

AWS Lambda | Compute

A

In the AWS Lambda resource model, you choose the amount of memory you want for your function, and are allocated proportional CPU power and other resources. For example, choosing 256MB of memory allocates approximately twice as much CPU power to your Lambda function as requesting 128MB of memory and half as much CPU power as choosing 512MB of memory. You can set your memory in 64MB increments from 128MB to 3GB.

17
Q

How long can an AWS Lambda function execute?

AWS Lambda functions

AWS Lambda | Compute

A

All calls made to AWS Lambda must complete execution within 300 seconds. The default timeout is 3 seconds, but you can set the timeout to any value between 1 and 300 seconds.

18
Q

How will I be charged for using AWS Lambda functions?

AWS Lambda functions

AWS Lambda | Compute

A

AWS Lambda is priced on a pay per use basis. Please see the AWS Lambda pricing page for details.

19
Q

Does AWS Lambda support versioning?

AWS Lambda functions

AWS Lambda | Compute

A

Yes. By default, each AWS Lambda function has a single, current version of the code. Clients of your Lambda function can call a specific version or get the latest implementation. Please read out documentation on versioning Lambda functions.

20
Q

How long after uploading my code will my AWS Lambda function be ready to call?

AWS Lambda functions

AWS Lambda | Compute

A

Deployment times may vary with the size of your code, but AWS Lambda functions are typically ready to call within seconds of upload.