intro
What is FaaS?
AWS Overview
Lambda
Cold and Warm start
How to write Lambda Function?
exports.handler = (event, context, callback) => {
https.get(url, (res) => {
callback(null, res.statusCode)
}).on('error', (e) => {
callback(Error(e))
})
}
exports.handler = async (event) => {
return new Promise((resolve, reject) => {
if (Math.random() * 2 ^ 0) {
resolve();
} else {
reject();
}
});
}
or
exports.handler = async (event) => {
return https.get(url).promise();
}
or
Livecoding
IAM
Livecoding
API Gateway
Livecoding
Ways to manage AWS
AWS CLI usage example
# aws lambda invoke \
--function-name <value> \
<outfile>
Livecoding
Terminal
AWS SDK usage example
var lambda = new AWS.Lambda();
lambda.addLayerVersionPermission(params, function (err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var lambda = new AWS.Lambda();
lambda.addLayerVersionPermission(params).promise();
or
Database Services
Livecoding
AWS Free Tier
Free Tier Details
Billing Dashboard
Billing Dashboard
Pros & Cons
Pros
- Cheap cost
- Auto scalable
- You can make simple things easily
Cons
- You should track what happens
- Сomplex architecture
- It's hard to make tests
- Steep learning curve
Links
- https://github.com/mikhama
- https://aws.amazon.com/free/
- https://console.aws.amazon.com/billing/home
- https://docs.aws.amazon.com/cli/latest/reference/
- https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/
- https://serverless.com/framework/docs/providers/aws/guide/quick-start/
- https://serverless.com/framework/docs/providers/aws/guide/credentials/
AWS Intro
By Dzmitry Tsebruk
AWS Intro
- 251