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

  1. Cheap cost
  2. Auto scalable
  3. You can make simple things easily

Cons

  1. You should track what happens
  2. Сomplex architecture
  3. It's hard to make tests 
  4. Steep learning curve 

Links

AWS Intro

By Dzmitry Tsebruk

AWS Intro

  • 240