Serverless and Application Services Flashcards

1
Q

What does a “Monolithic Architecture” mean?

What are some caveats?

A

It’s basically an app built from one single combined block of services.

  • if any component of app fails, then entire app fails
  • if one component needs to scale, you must scale the whole app
  • components are always running and billed together
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

REVIEW:

What does a “Tiered Architecture” mean?

A

○ The monolithic architecture is broken apart into a collection of Tiers - these can be on the same server or on different servers

○ Each Tier connects to a single endpoint of another tier so they can trade data; separate but still tightly coupled (direct line of comms i.e SYNCHRONOUS Communications must be maintained)

○ Each tier can be vertically scaled independent of the other tiers

○ Allows you to use Internal LB’s between the different Tiers; one tier no longer communicates with a specific instance, but rather, with a LB –> this allows for Horizontal Scaling very easily

○ You can’t scale a tier all the way down to ZERO, and there always has to be at minimum ONE connection between the Tiers – remember the tiers are communicating SYNCHRONOUSLY

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

What are “Queues” within a Tiered ARCH?

A

Queues allow for Asynchronous Communications and is how we get around the Synchronous Comms requirement of a Tiered ARCH.

EX) When a user makes a request, the Upload Tier will send a message to the Queue where the Processing Tier will then get the job and execute the job once it gets to the front of the line in the Queue.

As projects get completed, they get deleted from the queue.

Queues are FIFO designed.

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

Can internal LB’s be used within a Tiered ARCH that’s taking advantage of Queues?

A

No - no communications happen directly where components are completely decoupled.

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

What is a Microservices ARCH?

A

An architecture that is comprised of Microservices.

Microservices are tiny, self-service app instances that perform individual tasks very fast and very well.

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

What 3 high-level components are Event-Driven ARCH comprised of?

A

Producers - components of the app that might interact with customers, or parts of the infra (like EC2’s)

Consumers - SW waiting for events to occur; if they see an event they care about, they will take an action (like displaying something for a customer)

Both - this could be an API

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

Are Producers and Consumers in an Event-Driven ARCH always running?

A

No - they don’t sit around running idly waiting for stuff to happen; they are not constantly consuming resources.

They only consume resources during EVENTS aka when they are required; default status is basically “Off” or an idle/dormant state.

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

What triggers Producers?

Consumers?

A

Producers get triggered when something happens (a button is clicked).

Consumers trigger when something is sent to them where they then take an action.

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

What facilitates the conversations between a Producer and a Consumer?

A

Event Router

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

Event-Driven ARCH Summary

A

→ No constant running or waiting for things to happen

→ Producers generate events when something happens (like a click, or when an error occurs); actions get taken on that event

→ Events are delivered to Consumers, usually by an Event Router

→ Consumers can then execute a corresponding action

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

What is AWS Lambda?

A

“Function-as-a-Service” product/service that is driven by Events, which is called “Invocation” ; this service accepts Functions.

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

What is a Function?

What is a Lambda Function?

A

A small piece of code.

A small piece of code in ONE particular language running in AWS.

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

Where do Lambda functions run? How are you billed for Lambda functions running in this environment?

A

Runtime Environment - This is a “virtual environment” that’s always ready to go.

You’re only billed for the duration that the function runs for i.e if the function requires a compute activity to be triggered for 5 seconds, you’re only billed for those 5 seconds.

This is unlike EC2, where you provision the resource and then pay for that instance whether it’s running or not.

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

LAMBDA Key Points

A

– Lambda is the key component/service of AWS Serverless ARCH

– you would use Lambda as an alternative to running compute jobs on EC2 for compute needs

– Best practice is to make a Lambda function super specialized - very small but very good at doing one single task

– When a Lambda function is invoked, it runs inside of a Runtime Environment where the Runtime Environment matches the language that the function was written in.

– Always assume that that each time a function is invoked, the runtime environment is clean i.e nothing is stored in it from a previous function; STATELESS

– Runtime environments will get CPU and Memory allocated to them.. they’re like a container. The more Memory that gets added, the more CPU gets added along with it, which means it costs more for every second of duration a function is running for if there’s a lot of memory and compute added to the environment

– Any permanent data that results from a Lambda function should be sent to a persistent data store, like S3

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

What is the Lambda execution limit (how long it takes to execute a given function)?

A

15 min.

Any compute needed for 15 min or less, Lambda is a great alternative.

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

LAMBDA SUMMARY

A

· 15-minute execution limit

· Assume you get a new runtime environment for every execution; don’t rely on any data persistence

· Execution Roles (IAM Role) is assumed anytime a function is executed
○ any code inside the runtime environment can use the permissions given by the execution role
○ this is how Lambda interacts with other AWS services

  • Always load data from other services
  • Always store data to other services
  • Always assume the Runtime Environment is never persistent

· Lambda comes under the free tier:
○ Up to 1M requests per month
○ 400,000 GB seconds of compute per month

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

What are Cloudwatch Events?

A

Delivers a near real-time stream of system events, where an event describes a change in AWS products or services.

EX) when an EC2 instance is terminated/started/stopped

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

What is Event Bridge?

A

A service that’s replacing CW Events; does the same function as CW events but also adds additional capability - events from 3rd parties and/or custom applications running in AWS.

(CW Events - delivers a near real-time stream of system events, where an event describes a change in AWS products or services)

Same basic underlying ARCH as CW events

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

CW Events and Event Bridge Summary

A

→ CloudWatch Events and EventBridge have visibility over events generated by supported AWS services within an account.

→ They can monitor the default account event bus - and pattern match events flowing through and deliver these events to multiple targets.

→ They are also the source of scheduled events which can perform certain actions at certain times of day, days of the week, or multiple combinations of both… at “x” time of day trigger “y” event

→ Both services are one way how event driven architectures can be implemented within AWS.

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

What is an API?

A

A way that you can take an app you develop, and provide it’s functionality directly to users or other system utilities or other applications to include that functionality inside their code – basically allows 2 apps to talk to each other

Computing interface that defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc.

An API is basically a piece of code that sits on a server and give Apps & services a formal way to communicate with each other

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

How do API’s influence AWS?

A

API’s are how different services interact.. they are what cause AWS services to do things.

EX) when you request that AWS stop an EC2, a message gets sent to the AWS service via the AWS API in that region

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

REVIEW:

API Gateway + Main Use Cases

A

→ API GW is heavily involved in Serverless ARCH deployments

→ Billed by # of API calls, amount of data transferred, and then additional performance features if needed, such as caching

→ Moving on-premise apps/API’s to AWS where the API GW sits in the middle and helps with that process, and eventually to a serverless ARCH if that’s the end goal

○ This allows you can evolve the application while keeping the API endpoints the same

○ You can move pieces of the app (like the DB services into Aurora DB for example) using the API GW

○ It can also connect to legacy monolithic applications and act as a stable API endpoint during an evolution from a monolith to microservices and potentially through to serverless.

23
Q

What is a “Serverless Architecture”

A

It isn’t one single thing or product, it’s actually a combination of architectures (like Microservices and Event Driven ARCH like Lambda) where the aim is to use 3rd party services where possible and FaaS products for any on-demand computing needs.

Main idea is to not manage any servers, or only have to manage very few.

24
Q

When looking at a Serverless ARCH, do you want large/monolithic apps, or do you want them broken up?

A

You want to break an app down into as many tiny pieces as possible that work together; collections of small/specialized functions that are very fast and efficient.

25
Q

In a Serverless Environment, what is the environment like that the apps run in?

A

These functions run in STATELESS and EPHEMERAL environments.

When an app runs, it will always assume it’s going to run in a clean and empty environment.

When they run, they:

  • get the data they need
  • they do something
  • then they store the result persistently (if needed) and/or deliver the output to something else or another service.
26
Q

REVIEW: Main Ideas with Serverless ARCH

A

With Serverless ARCH - you should consume “…as-a-Service” whenever you can, code as little as possible, and utilize Function as a Service for any general purpose compute needs.

Building applications with more focus on Biz Logic & rapid testing/developing rather than on the HW needed to serve the SW

27
Q

Lambda Process:

A
  1. A request is made by an end user or service
  2. A trigger is invoked which then tries to locate the code that’s responsible for the request
  3. When the code is found, the answer is loaded into a container
  4. Once in the container the code is then executed
  5. Once executed the answer gets constructed and then sent to the client
  6. Response received
28
Q

What is SNS?

A

It is a HA/durable/secure messaging service that’s a key component of many AWS architectures. It provides a low-cost infrastructure for the mass delivery of messages, predominantly to mobile users.

SNS coordinates the sending and delivery of messages

29
Q

What is an SNS Topic?

A

The base entity of SNS.

This is where permissions are controlled and where most of the config for SNS is defined.

30
Q

What is an SNS Publisher and Subscriber? Can something be both.

A

Pub - sends messages to a TOPIC

Sub - receive all the messages that are sent to the TOPIC. Examples of subs can be HTTP/HTTPs endpoints, email, SMS, Lambda, etc.

Yes - something like an API can be both.

31
Q

Will Subs get ALL the notifications sent by Pubs to a TOPIC they are subscribed to?

A

Yes – but – you can create and apply a filter on the Sub so it only receives messages that are relevant to it’s functionality.

32
Q

What is a Step Function?

A

A step function is serverlessfunctionorchestrator that makes it easy to sequenceAWSLambdafunctionsand multipleAWSservices into business-critical applications.

33
Q

What is a State Machine?

What is a State?

A

A Serverless Workflow within a Step Function .. START > STATES > END. The state machine is what manages the FLOW of the application.

A State Machine has different states that control the flow of things inside the state machine, and then it has a Task state which coordinates with other external services to perform that actual work.

States are things that occur within the State Machine

34
Q

What is the major difference between a Step Function and a Lambda Function?

A

Lambda functions can only run an execution for a maximum of 15-minutes, whereas a Step Function can run an execution for up to a year.

35
Q

What are the 2 workflow choices when running a State Machine?

A

Standard - this is default and has a 1-year duration execution limit.

Express - designed for high-volume workloads (like streaming/IOT/mobile apps/etc) and has a maximum duration of 5-minutes; i.e HIGHLY transactional.

36
Q

There are (6) States that exist within a State Machine:

A

○ Succeed and Fail - if a process ever reaches one of these states it will either have succeeded or failed

○ Wait - waits for a certain period of time or waits until a specific time & date to execute; pauses the processing of the state machine workflow until the duration past or the specific point in time

○ Choice - allows the state machine to take a different path based on an input it received; gives a choice inside the state machine

○ Parallel - allows you to create parallel branches; perform multiple sets of things at the same time

○ Map - accepts a list of things; like a list of orders.. For every item in the list the state machine will perform an action

○ Task - single of unit of work performed by a state machine; allows the state machine to actually do things

37
Q

SUMMARY: Step Functions

A

SUMMARY:
→ Step functions let you create state machines

→ State machines are long running serverless workloads (remember Lambda functions can only run for a max of 15 min) that have a start and stop. These can run up to 1-year by default

→ In between the start and stop are various States

→ States can be directional decision points or they can be TASKS which actually perform things

→ By using States you can build complex workflows that integrate with lots of different AWS workflows

38
Q

What is Simple Queue Service (SQS)?

A

Amazon SQS is a message queue service used by distributed applications to exchange messages through a polling model, and can be used to decouple sending and receiving components.

SQS is fully managed and delivered by AWS i.e it’s an aaS product.

Used for reliable comms between distributed SW components/microservices at scale.

39
Q

What are the 2 types of SQS queues?

A

Standard – there is no guarantee on order and messages could be received out of order.

FIFO - guarantee an order for messages.

40
Q

What is the main application use case provided by SQS?

A

Queues can be used to DECOUPLE app components – one component can add things to a queue and another can read from the queue; neither is aware of, or relies, on the other.

    • One part produces a workload
    • One part scales automatically to perform processing on the workload that’s created
41
Q

What is SNS SQS Fanout Architecture?

A

SNS-SQS Fan-out replicates a message to all subscribing queues.

Instead of the message going directly to an SQS queue, it’s added onto a SNS Topic, which can multiple Subscribers to that Topic, thus allows you to “Fan out” or send a multitude of messages.

A combination of those services offers the possibility to fan-out messages.

EX) if an object is uploaded to an S3 bucket, and there is a requirement for spawning multiple jobs to process the object, then you need to use SNS and SQS Fanout.

– Takes ONE event (from S3) and creates MULTIPLE events that can be used independently you would use FANOUT

42
Q

SUMMARY: SQS

A

SUMMARY:
· Standard queue - guarantees message delivery at least ONCE; no guarantee on the order however

· FIFO - guarantees the order and exactly ONE delivery

· Billed based on requests – 1 request can receive between 1-10 messages and up to 64KB in total
○ The more frequently a SQS queue is polled, the less cost-effective the service is

· Supports Encryption at rest (KMS) and In Transit

43
Q

What is Kinesis?

A

Highly scalable streaming service that is designed to ingest data from lots of devices or lots of apps.

44
Q

How long is a set of data accessible for in Kinesis?

A

24-hours.

As soon as the 24 hours passes, new data will start to enter the stream.

45
Q

What type of ARCH does Kinesis use?

A

Kinesis uses a SHARD architecture

There can be 1 or many shards in a single stream; The more shards there are the more performance the stream provides.

46
Q

What is Kinesis Firehose? Why would you use it?

A

Allows you to connect to a Stream and move data in MASS quantities into another AWS service - like S3 for example.

This allows you to extend the data access period for much longer than 24 hours, which is the default with Kinesis.

47
Q

** Differences between SQS and Kinesis **

A

→ Main question to ask between the 2: if it’s about INGESTION of data/at scale, then it’s likely Kinesis
○ If it’s about worker pools, decoupling, or Asynchronous communication - it’s likely SQS

→ SQS generally has ONE thing sending messages to the queue; like a web-tier inside an auto scaling group
○ You wont have hundreds or thousands of sensors going to an SQS queue
○ You’ll usually also have only ONE consumption group
○ Sender and receiver don’t know about each other - completely decoupled

→ Kinesis is designed for large scale ingestion and large scale consumption
Consumers can go back and forth through time within the rolling 24-hour window i.e there is NO QUEUE

48
Q

Which configuration value controls how long something has to process and delete a queue message before it reappears?

A

Visibility Timeout

49
Q

if you have a large number of devices sending data into AWS to be consumed by a large number of devices you should use a …

A

Kinesis Stream

50
Q

Is there a Load Balancer present in a Tiered ARCH or a Queue ARCH?

A

Tiered.

In a Queue ARCH there is no LB, but there is an Auto-Scaling-Group.

51
Q

REVIEW

SNS versus SQS

A
  • SNS = Publisher/Subscriber system
  • SQS = queuing service for message processing
  • SNS = publish message to a Topic and deliver to 1 or many subscribers (like SQS)
  • SQS = an alternate system (like EC2 or Lambda) must poll SQS to see if a new event has taken place
  • SNS = Do OTHER systems care about an event?
  • SQS = Does YOUR system care about an event?
52
Q

What is a Shard in the Kinesis Shard ARCH?

What is the Input/Output metric for 1 shard?

How many inputs can be in 1 shard per second?

A

Shard is the base throughput unit of an Amazon Kinesis data stream.

One shard provides a capacity of 1MB/sec data input and 2MB/sec data output.

One shard can support up to 1000 PUT records per second. You will specify the number of shards needed when you create a data stream.

53
Q

How long can the queue be in SQS i.e how long can messages be stored in the queue?

What is the default retention period?

A

From 1 minute up to 14 days. Anything longer the messages are auto-deleted and will not be processed.

Default = 4 days