Serverless Flashcards
Which services can API gateway interface to?
LAMBDA - easy way to expose REST API
HTTP - Expose HTTP end points including LB.
AWS Services - Expose any AWS API eg. Start a step function post msg to SQS, Kinesis etc.
Wbat are the 3 endpoints types for API Gateway
Edge Optimized (default) -> Request routed through CloudFront to improve latency
Regional-> For clients in same region.
Private -> only accessed from your VPC
AWS Serverless Application Repo (SAR)
The AWS Serverless Application Repository is a managed repository for serverless applications. It enables teams, organizations, and individual developers to store and share reusable applications, and easily assemble and deploy serverless architectures in powerful new ways.
Each application is packaged with an AWS Serverless Application Model (SAM) template that defines the AWS resources used. Publicly shared applications also include a link to the application’s source code. There is no additional charge to use the Serverless Application Repository - you only pay for the AWS resources used in the applications you deploy.
AWS Marketplace
AWS Marketplace - The AWS Marketplace enables qualified partners to market and sell their software to AWS Customers
AWS Service Catalog
AWS Service Catalog - AWS Service Catalog allows organizations to create and manage catalogs of IT services that are approved for use on AWS. These IT services can include everything from virtual machine images, servers, software, and databases to complete multi-tier application architectures.
you create a new version of a Lamda function but want to specify only a certain % of traffic goes to this and rest of traffic goes to old one. how would you do this?
Create a LAMBDA Alias pointing to LATEST. Setup your app to point to this Alias. WHen you ddploy a new version, you’d set the weighting to 90% to old version and 10% to newest version.
You can create one or more aliases for your AWS Lambda function. A Lambda alias is like a pointer to a specific Lambda function version. You can use routing configuration on an alias to send a portion of traffic to a Lambda function version. For example, you can reduce the risk of deploying a new version by configuring the alias to send most of the traffic to the existing version, and only a small percentage of traffic to the new version.
How to imrpove performance for API Gateway
Enable API caching in API Gateway
API Gateway provides a few strategies for optimizing your API to improve responsiveness, like response caching and payload compression. You can enable API caching in Amazon API Gateway to cache your endpoint’s responses. With caching, you can reduce the number of calls made to your endpoint and also improve the latency of requests to your API.
API Gateway does NOT support ElasticCache or MemCache.
How would you expose an API in AWS and only make it available to select users?
API GATEWAY USAGE PLAN
A usage plan specifies who can access one or more deployed API stages and methods—and also how much and how fast they can access them. The plan uses API keys to identify API clients and meters access to the associated API stages for each key.
Max environment variable size for Lambda
4K. No limit to the number.
Step function Characteristics
Standard Workflows on AWS Step Functions are suitable for long-running, durable, and auditable workflows that can also support any human approval steps
You should use Express Workflows for workloads with high event rates and short duration
Express Workflows have a maximum duration of five minutes and Standard workflows have a maximum duration of one year
How to promote a Test Stage to a Prod stage for API Gateway.
THere are 2 ways. Optimal way is just to update a stage variable value from the stage name of test to that of prod.
The other way is to re-deploy the app to Prod Stage.
Adress Lambda Performance lags on compute heavy workloads
increase memory. memory can be increased in 64MB chunks from 128MB to 3008MB.
Lambda Provisioned v Reserved currency.
Reserved Concurrency is about guaranteeing availability, while Provisioned Concurrency, with its “pre-warm” mode, is about ensuring immediate, predictable performance, eliminating cold start latency.
Reserved concurrency is useful for ensuring that your most critical functions always have enough concurrency to handle incoming requests. Configuring reserved concurrency for a function incurs no additional charges.
Provisioned concurrency is useful for reducing cold start latencies for functions. Configuring provisioned concurrency incurs additional charges to your AWS account.
Which Lambda concurreny mode helps with cold starts?
Provisioned concurrency
Use AWS Step Functions state machines v. Step Functions activities
Step function activities are used to orchestrate the task running in a different machine called worker, which will take the input from the step function state machine.