Serverless And Lambda Flashcards
when you use serverless services
it’s not that you don’t have servers anymore, it’s just that you don’t manage them.
You just deploy code and originally, you just deploy it functions.
So initially serverless meant Function as a Service,
or FaaS.
But now serverless means a lot more. So in the beginning, serverless was pioneered by AWS Lambda
but now also includes anything that is remotely managed.
So databases, messaging, storage, as long as you don’t provision servers.
serverless in AWS
- we have our users and they would get for example,
static content for from our S3 buckets delivered as a website’s or CloudFront plus S3. - Then we would login with Cognito, this is where our users would have their identity stored.
- they would invoke your REST API through the API gateway
- the API gateway would invoke Lambda functions
- Lambda functions would store and retrieve data from DynamoDB.
reference architecture for serverless applications.
Lambda DynamoDB, Cognito, API Gateway, Amazon S3, but also SNS and SQS, Kinesis Data Firehose, because again it scales based on the throughput you have you just pay for what you use and you don’t provision servers, Aurora Serverless, when your Aurora database scales on demand without you managing servers,
Step functions, Fargate
Lambda
virtual functions, no servers to manage.
we just provision the code and the functions run.
Lambda execution period
This is limited by time,
short executions of up to 15 minutes,
Lambda on-demand
they run on-demand. When you don’t use Lambda, your Lambda function is not running, and you only are going to be billed when your function is running
and it will run on-demand when it gets invoked,
Lambda scaling
scaling is automated.
If you need more Lambda functions, occurrences,
then automatically, AWS will provision for you
more Lambda functions.
Lambda payment
You’re going to pay for the number of requests
Lambda receives, so the number of invocations,
and your compute time, so how long Lambda was running for.
free tier on Lambda is 1 million Lambda requests,
and 400,000 gigabyte-seconds of compute time.
Lambda resources per function
if you want to provision more resources per function,
you can provision up to three gigabytes of RAM per function
if you increase the RAM of your function, then it will also improve the quality and performance of your CPU and network.
Lambda language support
Node.js, so JavaScript, Python, Java, and this is Java 8 compatible, C# or .NET Core, Golang, C# and Powershell, Ruby, and there is a new API called the Custom Runtime API, where you can run pretty much any language on Lambda, but it has to be community supported, and one of these example is, for example,
the Rust language.
The one thing that does not run on Lambda is
Docker
if in the exam you are asked, I want to run a Docker container on AWS, you have to think ECS or Fargate.
Lambda - API Gateway integration
to create a REST API, and they will invoke our Lambda functions.
Lambda - Kinesis integration
Kinesis will be using Lambda to do some data transformations on the fly.
Lambda - DynamoDB integration
DynamoDB will be used to create some triggers,
so whenever something happens in our database,
a Lambda function will be triggered.
Lambda - S3 integration
a Lambda function will be triggered anytime, for example,
a file is created in S3.