Serverless 101 (ACG) Flashcards

1
Q

What are three benefits of choosing Serverless?

A

Speed - Serverless enables you to build scalable applications quickly without managing any servers.

Low Cost - Serverless applications are event-driven and you are only charged when your code is executed.

AWS Handles the Heavy Lifting - You can focus on writing code and building your application instead of configuring servers.

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

What is Lambda?

A

Lambda takes care of everything required to run your code, including the runtime environment.

Serverless compute - Run your code in AWS without provisioning any servers.

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

Lambda is event-driven. True or False?

A

TRUE

Event-Driven
Lambda functions can be automatically triggered by other AWS services or called directly from any web/mobile app.

Triggered by Events
Events could be changes made to data in an S3 bucket/DynamoDB table.

Triggered by User Requests
You can use API Gateway to configure an HTTP endpoint allowing you to trigger your function at any time using an HTTP request.

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

What are six benefits of using Lambda?

A

Low Cost - Pay only when your code executes.

Continuous Scaling - Lambda scales automatically

Event-Driven - Lambda functions are triggered by an event or action.

Independent - Lambda functions are independent. Each event will trigger a single function.

Serverless Technology - Lambda, API Gateway, Dynamo DB, S3, SNS, SQS

Lambda Triggers - Be aware of the services that can trigger a lambda function.

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

What is an API?

A

Application Programming Interface

We use APIs to interact with web applications, and applications use APIs to communicate with each other.

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

What is API Gateway?

A

Publish, Maintain, and Monitor
API Gateway is a service which allows you to publish, maintain, monitor, and secure APIs at any scale

A Front Door
An API is like a front door for applications to access data, business logic, or functionality from your backend services, e.g., applications running on EC2, Lambda.

Supported API Types
RESTful APIs - are optimized for stateless, serverless workloads.
Websocket APIs - are for real-time, stateful communication, e.g., chat apps.

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

What are RESTful APIs?

A
  • REpresentational State Transfer (REST)
  • Optimized for serverless and web apps
  • Stateless
  • Supports JSON (key-value pairs)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

You can throttle API Gateway. True or false?

A

TRUE

You can throttle API Gateway to prevent your application from being overloaded by too many requests.

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

Everything in API Gateway is logged to CloudWatch.

A

TRUE

Everything is logged to CloudWatch. For example, API calls, latencies, and errors.

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

Lambda Versions

A

When you create/upload a new version of your Lambda function, there is only one version: $LATEST.

You can create multiple versions of your function code and use aliases to reference the version you want to use as part of the ARN.

For example:
arn:aws:lambda:eu-west-2:738450006354:function:mylambda:$LATEST

arn: aws:lambda:eu-west-2:738450006354:function:mylambda:Test (version 1)
arn: aws:lambda:eu-west-2:738450006354:function:mylambda:Prod (version 2)

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

What is a concurrent execution limit for Lambda?

A

AWS built-in Lambda safety feature to limit the number of concurrent executions across all functions in a given region per account.

Default is 1,000 exceptions per second per region (TooManyRequestsException, HTTP Status Code: 429).

Able to request limit increase.

Reserved concurrency guarantees a set number of concurrent executions are always available for a critical lambda function.

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

By default, your lambda functions will not be able to access any resources within a VPC without some addtl. configuration. True or false?

A

TRUE

You need to allow the function to access your VPC using the following:

  1. Private subnet ID
  2. Security group ID (with required access)
  3. Lambda uses this info to setup ENIs (Elastic Network Interfaces) using an available IP from your private subnet.

CLI example:
aws lambda update-function-configuration –function-name MYFUNCTION –vpc-config SubnetIds=subnet-1122aabb,SecurityGroupIds=sg-51530134

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

What are Step Functions?

A

Step Functions provide a visual interface for serverless apps, which enables you to build and run serverless apps as a series of steps.

Each step in your app executes in order, as defined by your business logic.

The output of one step can be used by the next.

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

Step Functions do not automatically trigger and track each step. True or False?

A

FALSE

Step Functions automatically trigger and trace each step. The output of one step often the input to the next.

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

Step Functions logging is disabled by default. True or False?

A

FALSE

Step Functions log the state of each step, so if something goes wrong you can track the issue down.

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

Standard Workflows

A

Long-running (up to 1 year)
At-most-once (runs once).
Non-idempotent (they always cause a change in state).

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

Express Workflows

A

Short-lived (up to 5 min)
At-least-once.
Idempotent (can run more than once and not have addtl side effects).

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

Synchronous Express Workflows

A

The workflow must complete before the next step begins, e.g., confirm successful payment before sending an order.

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

Asynchronous Express Workflows

A

Other tasks are not dependent on the completion of the workflow, e.g., messaging system.

20
Q

What is X-Ray?

A

X-Ray is a tool which helps developers analyze and debug distributed applications.

Allowing you to troubleshoot the root cause of performance issues and errors.

Provides a visualization (Service Map) of your application’s underlying components.

21
Q

What is Service Map?

A

X-Ray’s visual end-to-end view of your requests as they travel through your application, including Latency, HTTP status codes and errors. This information can be used to troubleshoot connectivity and performance issues.

22
Q

An X-Ray agent must be installed on your EC2 instance to use X-Ray. True or False?

A

TRUE

The X-Ray agent must be installed on your EC2 instance. Use the SDK to instrument your application to send traces to X-Ray.

23
Q

Elastic Beanstalk is a really quick way to install a web application without having to install an EC2 instance and configuring a Node.js runtime environment. True or False?

A

TRUE

24
Q

For ECS, where should you run the X-Ray daemon?

A

For Elastic Container Service (ECS), run the X-Ray daemon in it’s own Docker image, running alongside your app.

25
Q

Name AWS services X-Ray integrates with.

A

DynamoDB
Lambda
API Gateway
etc

26
Q

You can also instrument your own applications to send data to X-Ray. True or False?

A

TRUE

Applications can be running on EC2, Elastic Beanstalk environments, on-premises systems and ECS (Elastic Container Service).

27
Q

To get started with X-Ray, what are three things you need?

A
  1. X-Ray SDK
  2. X-Ray daemon
  3. Instrument your app using the SDK to send required data to X-Ray, e.g. data about incoming HTTP requests

*If you want to also record app specific info in the form of key-value pairs, use annotations to add user defined key-value pairs to your X-Ray data - allows you to filter, index and search within X-Ray, e.g. game_name=TicTacToe,game_id=123456

28
Q

What are X-Ray annotations?

A

If you want to also record app specific info in the form of key-value pairs, use annotations to add user defined key-value pairs to your X-Ray data - allows you to filter, index and search within X-Ray, e.g. game_name=TicTacToe,game_id=123456

29
Q

What can you use to import APIs?

A

You can import APIs using external definition files, e.g., OpenAPI, formerly known as Swagger.

30
Q

How can you deal with legacy apps using SOAP?

A

Simple Object Access Protocol (SOAP) is a legacy protocol that returns XML and modern apps use REST (REpresentational State Transfer).

When dealing with legacy apps using SOAP, you can configure API Gateway as a SOAP web service passthrough, or you can use API Gateway to convert the XML response to JSON.

31
Q

What is API Gateway Caching?

A
  1. Caches your endpoints response - reduces number of calls made to your endpoint and can improve the latency for requests to your API
  2. TTL - default is 300 seconds (5 min) of caching responses from your endpoint
  3. API Gateway returns the cached response instead of making new requests to your app
32
Q

What are the limits for API Gateway Account Level Throttling?

A

API Gateway limits the steady-state request rate to 10,000 requests per second, per Region.

The max concurrent requests is 5,000 requests across all APIs, per Region.

You can request to increase these limits.

33
Q

What error do you receive when you exceed your API Gateway limits?

A

429 Error

If you exceed 10,000 requests per second, or 5,000 requests, you will receive a 429 Too Many Requests error message.

34
Q

API Gateway uses throttling to prevent your app from being overwhelmed. True or False?

A

TRUE

API Gateway uses throttling to prevent your app from being overwhelmed by too many requests as long as you are within the default limits of 10,000 rps and 5,000 concurrent requests.

35
Q

You have created an application using serverless architecture using Lambda, Api Gateway, S3 and DynamoDB. Your boss asks you to do a major upgrade to API Gateway and you do this and deploy it to production. Unfortunately something has gone wrong and now your application is offline. What should you do to bring your application up as quickly as possible?

A

Rollback your API Gateway to the previous stage.

36
Q

Your application relies on a number of Lambda functions. During testing, you would like to make sure you are always using the latest version of the function. How can you ensure that your application always launches the very latest version of your code?

A

Reference the function using the $LATEST suffix.

37
Q

You work for a gaming company that has built a serverless application on AWS using Lambda, API Gateway and DynamoDB. They release a new version of the Lambda function and the application stops working. You need to get the application up and back online as fast as possible. What should you do?

A

Roll your Lambda function back to the previous version.

38
Q

Your web application is running on Lambda, API Gateway, DynamoDB and S3 and you have recently seen a significant increase in traffic to your website. The application support team are now reporting that Lambda invocations are being rejected with a 429 HTTP status code. What is the most likely cause of this issue that you would check first?

A

You have reached the default concurrent executions limit for Lambda.

AWS Lambda limits the amount of compute and storage resources that you can use to run and store functions, including a Concurrent Executions limit, which is set to 1000 per region, by default. To request an increase, use the Support Center console.

39
Q

Name four AWS services that X-Ray integrates with.

A

API Gateway
S3
ELB
Lambda

40
Q

You are a developer for a busy real estate company, and you want to enable other real estate agents to have the ability to show properties on your books, but skinned so that it looks like their own website. You decide the most efficient way to do this is to expose your API to the public using API Gateway. The project works well, but one of your competitors starts abusing this, sending your API tens of thousands of requests per second. This generates an HTTP 429 error. Each agent connects to your API using individual API keys. What actions can you take to stop this behavior?

A

Throttle the agent’s API access using the individual API Keys

41
Q

Which of the following Step Functions workflows should be used when you need to orchestrate a short process that normally takes 2 minutes to complete, and you require the result of the workflow to be returned after it has completed?

A

Synchronous Express Workflow

42
Q

You have created a simple serverless website using S3, Lambda, API Gateway and DynamoDB. Your website will process the contact details of your customers, predict an expected delivery date of their order and store their order in DynamoDB. You test the website before deploying it in to production and you notice that although the page executes, and the lambda function is triggered, it is unable to write to DynamoDB. What could be the cause of this issue?

A

Your lambda function does not have the sufficient Identity Access Management (IAM) permissions to write to DynamoDB.

43
Q

You are developing a new application using serverless infrastructure and are using services such as S3, DynamoDB, Lambda, API Gateway, CloudFront, CloudFormation and Polly. You deploy your application to production and your end users begin complaining about receiving a HTTP 429 error. What could be the cause of the error?

A

You enabled API throttling for a rate limit of 1000 requests per second while in development and now that you have deployed to production your API Gateway is being throttled.

44
Q

How does API Gateway help to deal with legacy SOAP applications?

A
  1. Provides web service passthrough for SOAP applications

2. Converts the response from the application to JSON

45
Q

You would like to use X-Ray to monitor your application which runs on a number of Docker containers. Where should you deploy and run the X-Ray daemon?

A

Use a dedicated Docker container build from an image which includes the X-Ray daemon.

46
Q

You have designed a serverless learning management system and you are ready to deploy your code into a test/dev environment. The system uses a combination of Lambda, API Gateway, S3 and CloudFront and is designed to be highly available, fault-tolerant and scalable. What are the three different ways you can deploy your code to Lambda?

A

Write a CloudFormation template that will deploy your environment including your code.

Copy and paste your code in to the integrated development environment (IDE) inside Lambda.

Zip your code into a zip file and upload it via the Lambda console.