aws lambda using serverless framework - jug.mkjug.mk/presentations/javaskop17/kope.pdf · aws...

19
AWS Lambda using Serverless Framework - Goran Kopevski -

Upload: others

Post on 15-Jun-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

AWS Lambda using Serverless Framework

- Goran Kopevski -

Page 2: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

Agenda

● What is Serverless, Lambda, Serverless framework?● Development tools● Demo● Pros/Cons

Page 3: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

Extensive use of third party services to accomplish tasks that are traditionally taken care of by servers

What is Serverless concept?

LESS PEOPLE means LOWER DEVELOPMENT COST

Page 4: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

Input: (Amazon, AWS), (Microsoft, Azure), (IBM, OpenWhisk)

● Run code without provisioning or managing servers

What is λ?

(Product, Provider) => `Event-driven, serverless computing platform provided by

${Product} as a part of the ${Provider}`

Page 5: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

What is λ?

… and lose your shit while

searching for the bug in the

big cloud

As a ninja I only need to care about one thing:

Write functions. They can be NodeJS, Java or

Python...

Page 6: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

● Allows you to deploy auto-scaling, pay-per-execution, event-driven functions to any cloud.

● Currently supports AWS, Apache OpenWhisk, Microsoft Azure

What is

It helps you even more to cut down

the boilerplate and ugly

configuration that the cloud systems

are forcing you to learn or click!

And yes, easy deployment!

Page 7: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

(Serverless code) => cloudformation code;

● Reusable infrastructure definitions for other platforms ● Write less to achieve more

What is happening under the hood?

Page 8: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

What is happening under the hood?

Page 9: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

● Services● Functions● IAM● Events

○ SNS, SQS

● Working with resources● Working with other AWS services

What is Serverless framework offering?

Page 10: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

It is easy:

● We need env variables for:○ AWS_SECRET_ACCESS_KEY○ AWS_ACCESS_KEY_ID

● Node and node package for serverless (sls)

We are ready for development

> sls create --template aws-nodejs --path myService> sls deploy

Development tools

Page 11: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

DEMO

Page 12: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

● Extending or overwriting the core behaviour of the Serverless framework● There is already big community which is contributing● You can find the plugins at https://github.com/serverless/plugins

● Plugin which you must have in order to work more efficiently: serverless-offline

https://github.com/dherault/serverless-offline

Plugins

Page 13: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

● Easy understandable concept● FasS - scaling costs

○ We don’t need to care about parallelism

● Reduced operational cost● BaaS - reduced development cost● Reduced packaging and deployment complexity● Time to market / experimentation● Operational management

● Abstractions over Vendor implementations

PROS

Page 14: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

● Multitenancy Problems● Vendor control● Startup latency

○ This is debatable

● Execution Duration● Really harder local development● Testing● Deployment● Monitoring / Debugging

CONS

Page 15: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

● Multitenancy Problems● Vendor control● Startup latency

○ This is debatable

● Execution Duration● Really harder local development ● Testing ● Deployment ● Monitoring / Debugging

CONS

Page 16: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

● New approach of development● Still needs to mature● Serverless is not efficient for long-running applications● We need to learn the Amazon “tips and tricks” in order to pay less● There are no “local” operations

Should we use λ functions?

Page 17: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

But definitely useful for:● Message driven

applications● Sync processes● Scheduling● Automation of things● Experiments and POCs● CI/CD code builders

Should we use λ functions?

Page 18: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

QUESTIONS

Page 19: AWS Lambda using Serverless Framework - jug.mkjug.mk/presentations/javaskop17/Kope.pdf · AWS Lambda using Serverless Framework - Goran Kopevski - Agenda What is Serverless, Lambda,

Thank you!

Goran Kopevski@ [email protected]