Serverless Flashcards

1
Q

What Is Lambda?

A

AWS Lambda is a serverless computing service that lets you run code without provisioning or managing the underlying servers. It’s like you’re running code without computers.

  • You can allocate up to 10 GB of RAM(direct memory, but indirect CPU) and 15 minutes of runtime.
  • Has a temp storage available /temp default is 512MB and can be up to 10 GB.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Building a Function.

A
  1. You’ll need to pick from an available runtime or bring your own. This is the environment your code will run.
  2. If your Lambda function needs to make an AWS API call, you’ll need to attach a role.
  3. You can (optionally) define the VPC, subnet, and security groups your
    functions are a part of.
  4. Defining the amount of available memory will allocate how much CPU and RAM your code gets.
  5. What’s going to alert your Lambda function to start? Defining a trigger will kick Lambda off if that event occurs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What Is the AWS Serverless Application Repository?

A

Allows users to easily find, deploy, or even publish their own serverless
applications.

  • Define whole applications via AWS SAM templates. Private by default.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What Is a Container?

A

A container is a standard unit of software that packages up code and all its
dependencies, so the application runs quickly and reliably from one computing environment to another.

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

What is ECS?

A
  • ECS can manage 1, 10, hundreds, or thousands of containers. It will
    appropriately place the containers and keep them online.
  • Containers can have individual roles attached to them, making security a
    breeze.
  • Containers are appropriately registered with the load balancers as they come online and go offline.
  • Extremely easy to set up and scale to handle any workload.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is EKS?

A

The AWS-managed version of Kubernetes is called Elastic Kubernetes Service (EKS).

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

How do we decide when to pick ECS or EKS?

A

ECS:
Proprietary AWS container management solution. Best used when you’re all in on AWS and looking for something simple.

EKS:
AWS-managed version of open-source Kubernetes container management solution. Best used when you’re not all in on AWS. More work to configure and integrate with AWS

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

What Is Fargate?

A

AWS Fargate is a serverless compute engine for containers that work with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS).

  • Linux-only workloads.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

EC2 vs. Fargate

A

EC2:
- You are responsible for the underlying operating system
- EC2 pricing model
- Long-running containers
- Multiple containers share the same host

Fargate:
- No operating system access
- Pay based on resources allocated and time ran
- Short-running tasks
- Isolated environments

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

What Is EventBridge?

A

Amazon EventBridge (formerly known as CloudWatch Events) is a serverless event bus. It allows you to pass events from a
source to an endpoint. Essentially, it’s the glue that holds your serverless application together.

  • Define patterns on when the rules will be invoked.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Amazon ECR?

A
  • AWS-managed container image registry that offers secure, scalable, and
    reliable infrastructure.
  • Private container image repositories with resource-based permissions via IAM.
  • Supports Open Container Initiative (OCI images, Docker images, and OCI
    artifacts.
  • Authentication token required for pushing and pulling images to and from registries.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Amazon EKS Distro?

A
  • Amazon EKS Distro (EKS D) is a Kubernetes distribution based on
    and used by Amazon EKS.
  • It has the same versions and dependencies deployed by Amazon EKS.
  • EKS-D is fully managed by you unlike Amazon EKS, which is managed by AWS.
  • Run EKS D anywhere — on-premises, in the cloud, or somewhere else!
  • You are fully responsible for upgrading and managing your platforms.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is EKS Anywhere and EKS Anywhere?

A
  • An on-premises way to manage Kubernetes (K8s) clusters with the
    same practices used for Amazon EKS.
  • Feature of Amazon ECS allowing
    the management of containerbased apps on-premises
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Amazon Aurora Serverless?

A
  • On-demand and Auto Scaling configuration for the Amazon Aurora database service.
  • Automation of monitoring workloads and adjusting capacity for databases
  • Capacity adjusted based on application demands
  • Charged only for resources consumed by DB clusters; per-second billing
  • Helps customers stay well within budgets via the AutoScaling and per-second billing features
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is AWS XRAY?

A
  • App Insights: Collects application data for viewing, filtering, and gaining insights about requests and responses.
  • Downstream: View calls to downstream AWS resources and other
    microservices/APIs or databases.
  • Traces: Receives traces from your applications for allowing insights.
  • Multiple Options: Integrated services can add tracing headers, send trace data, or run the XRay daemon.
  • Tracing header: Extra HTTP header containing sampling decisions and trace ID. The tracing header containing added information is named X-Amzn-Trace-Id
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What Is AWS AppSync?

A
  • Robust, scalable GraphQL interface for application developers
  • Combines data from multiple sources (e.g., Amazon DynamoDB and AWS Lambda)
  • Enables data interaction for developers via GraphQL
  • GraphQL Data language that enables apps to fetch data from servers
  • Seamless integration with React, React Native, iOS, and Android
17
Q

What are some common use cases for Lambda?

A
  • Serverless Applications: S3, API Gateway, Lambda.
  • File Processing: S3, S3 events, Lambda.
  • Database Triggers: DynamoDB, Streams, Lambda.
  • Serverless CRON: EventBridge/CW Events + Lambda.
  • Realtime Stream Data Processing: Kinesis + Lambda.
18
Q

What are the two networking modes in AWS Lambda?

A
  • Public networking: Lambda functions can access the public internet and other public space AWS services. It offers the best performance for lambda.
  • VPC networking: Lambda functions can access resources in a virtual private cloud (VPC). An ENI is created inside the VPC(from the public AWS space where the service lives) for any unique combination of security groups and subnets used by your Lambda functions. It takes approx 90s the setup.
19
Q

What are the two security features in Lambda?

A
  1. Resource policies: These are IAM policies that are attached to Lambda functions, layers, and aliases. They control who can access Lambda resources and what actions they can perform. You can only view the resource policy for a Lambda function from the console. To change the resource policy for a Lambda function, you must use the AWS CLI or the AWS SDK.
  2. Lambda roles: These are IAM roles that Lambda functions assume when they are invoked. They define the permissions that Lambda functions need to access other AWS services and resources.
20
Q

What are the three Lambda invocation modes?

A
  • Synchronous: The caller waits for the Lambda function to return a response before continuing.
  • Asynchronous: The caller does not wait for the Lambda function to return a response before continuing. On event fail will retry 0-2 times(configurable). The finally failed events can be sent to a dead letter queue or to another destination.
  • Event-source mapping: Typically used on streams or queues that do not support event generation to invoke lambda(Kinesis, DunamoDB streams, SQS). DLQ for failed events.
21
Q

What is the difference between a cold start and a warm start in Lambda?

A
  • Cold start: A cold start occurs when a Lambda function is invoked for the first time or after a period of inactivity. In this case, AWS needs to initialize a new execution environment for the function, which can take up to a few seconds.
  • Warm start: A warm start occurs when a Lambda function is invoked within a short period of time after a previous invocation. In this case, AWS can reuse the existing execution environment, which results in a much faster startup time.
22
Q

How to reduce the impact of Lambda cold starts?

A
  • Use asynchronous invocation mode: This will allow AWS to reuse the existing execution environment for subsequent invocations.
  • Use Lambda provisioned concurrency: This will ensure that AWS always has a certain number of execution environments available for your functions, even if they are not being used.
  • Design your functions to be stateless: This will make it easier for AWS to reuse execution environments.
  • Use smaller function packages: Smaller packages will take less time to initialize, which can reduce cold start times.
  • Use a basic HTTP client: Avoid using complex HTTP clients, as these can add to the cold start time.
  • Preload dependencies: You can use a Lambda function handler to preload your function’s dependencies (/tmp) before the function is invoked.
  • Use layers: Layers can be used to package common dependencies outside of your function package. This can reduce the size of your function package and improve cold start times.