Serverless Flashcards
Benefits of Serverless
- ease of use
- event based (doesn’t come online until someone makes a call)
- pay as you go - only pay the amount of time your code is running
When to choose serverless on exam
favor serverless and managed services over traditional EC2
Lambda Settings - Runtime
your environment
Lambda Settings - Permissions
if your function makes an AWS API call, you need to attach a role
Lambda Settings - Networking
- optional
- you can define the VPC, subnet and security groups the function is a part of
Lambda Settings - Resources
you can define the amount of available RAM and CPU
Lambda Settings - Trigger
what event will cause your function to start?
Lambda Settings - Timeout*
max 15 minutes that a function can run
Lambda Settings - Limits
max 10 GB of RAM
Exam tips:
- Lambda is the answer if the question is “How do we add features to AWS to enforce things in AWS?”
Ex: How do we check new EC2 instances to see if they are configured with all the necessary tags or shut it down
Lambda
Ex: How do you automatically remove entries from a security group?
Lambda
Ex: How do you build a microservice that only runs occasionally?
Lambda
What can trigger Lambda:*
- S3
- CloudWatch Events
- API Gateway
- ALBs
Do you need a VPC for Lambda
no, it’s optional, but if you want to access a private database or API, you can put your function inside a VPC
What is a container?
a standard unit of software that packages up code and dependencies, so that the application runs quickly and reliably from one computing environment to another
Dockerfile
text document that contains all the commands or instructions that will be used to build an image
Image
an immutable file that contains the core libraries, dependencies and config files needed to run an application
Registry
stores docker images for distribution
- can be public and private
ECR
Elastic Container Registry
Container
a running copy of an image that has been created
Benefits of Containers
- create an immutable environment
- easily migrate from on-prem to AWS
- all environments are the same (i.e. Dev, and Prod are identical)
ECS
- Elastic Container Service
- manages containers at scale
- role integration to talk to other parts of AWS
- easy to use
- built inside AWS, only works with AWS
EKS
- Elastic Kubernetes Service
- opensource
- built by google
- can be use on-prem and in AWS
- heavy lift to manage, still has work to do to configure and integrate with AWS
- multi-cloud
What exceptions would cause you to choose EKS over ECS?
- need something open source
- need to run it on-prem
otherwise choose ECS
What exceptions would cause you to choose EKS over ECS?
- need something open source
- need to run it on-prem
otherwise choose ECS
Fargate
serverless compute engine for containers that works with both ECS and EKS
When to choose EC2 over Fargate?
- to use Reserved Instances
- for long-running containers
- multiple containers can share the same host
When to choose Fargate over EC2?
- when you don’t need operating system access
- you pay based on the resources allocated and the time ran
- excels at short-running tasks
- isolated environments
- containers that don’t need to run all the time
When to use Fargate over Lambda?
- when you have more consistent workloads
- allows docker use across the organization and a greater level of control by developers
When to use Lambda over Fargate?
- great for unpredictable or inconsistent workloads
- perfect for applications that can be expressed as a single function
- light-weight
- easily integrated into
Fargate exam tip
Walk thru the use case for when to use Lambda vs EC2 vs Fargate before you go into the exam.
Event Bridge
- formerly known as Cloud Watch Events
- an event bus
- allows you to pass events from a source to an endpoint
- it’s the glue that holds your serverless application together
- when something happens or kicks off, it alerts the next step of the process
- any API call that happens can kick off Event Bridge and Lambda
What is the fastest way to respond to things in your environment?
Cloud Watch Events / Event Bridge
Any AWS API call can trigger an Event Bridge Rule
use this to build in your own features
Which is faster, Event Bridge, or scraping thru CloudWatch logs?
Event Bridge