Lambda
Basics?
- Lambda scales out (not up) automatically.
- Lambda functions are independent, 1 event = 1 function
- Know what services are serverless:
1. Aurora Serverless
2. DynamoDB
3. Lambda
4. S3
4. API Gateway
- Lambda functions can trigger other lambda functions, 1 event can = x functions if functions trigger other functions.
- Architectures can get extremely complicated, AWS X-ray allows you to debug what is happening.
Lambda Triggers
Services that invoke Lambda functions synchronously
Elastic Load Balancing (Application Load Balancer)Amazon Cognito
Amazon Lex
Amazon Alexa
Amazon API Gateway
Amazon CloudFront (Lambda@Edge)
Amazon Kinesis Data Firehose
AWS Step Functions
Amazon Simple Storage Service Batch
Services that invoke Lambda functions asynchronously
For asynchronous invocation, Lambda queues the event before passing it to your function. The other service gets a success response as soon as the event is queued and isn't aware of what happens afterwards. If an error occurs, Lambda handles retries, and can send failed events to a dead-letter queue that you configure.Amazon Simple Storage Service
Amazon Simple Notification Service
Amazon Simple Email Service
AWS CloudFormation
Amazon CloudWatch Logs
Amazon CloudWatch Events
AWS CodeCommit
AWS Config
AWS IoT
AWS IoT Events
AWS CodePipeline
What Languages does Lambda support?
- Node.js
- Java
- Python
- C#
- Go
- PowerShell
How is Lambda priced?
1.
Number of Requests, First 1 million requests are free. $0.20 per 1 million requests thereafter.
2.
Duration. Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 100ms.
The price depends on the amount of memory you allocata to your function.
You are charged $0.00001667 for every GB-second used.
Lambda Security
When you create or update Lambda functions that use environment variables, AWS Lambda encrypts them using the AWS Key Management Service.
When your Lambda function is invoked, those values are decrypted and made available to the Lambda code.
The first time you create or update Lambda functions that use environment variables in a region, a default service key is created for you automatically within AWS KMS.
This key is used to encrypt environment variables.
However, if you wish to use encryption helpers and use KMS to encrypt environment variables after your Lambda function is created, you must create your own AWS KMS key and choose it instead of the default key.
The default key will give errors when chosen.
Creating your own key gives you more flexibility, including the ability to create, rotate, disable, and define access controls, and to audit the encryption keys used to protect your data.