Don’t Let FaaS Do a BaaS Job · BaaS BaaS - Backend as a Service Examples: Amazon’s DynamoDB...
Transcript of Don’t Let FaaS Do a BaaS Job · BaaS BaaS - Backend as a Service Examples: Amazon’s DynamoDB...
Don’t Let FaaS Do a BaaS Job ...a workshop on serverless functions using BaaS, by Tessa Mero May 30th, 2019 - DeveloperWeek Seattle
The content of this presentation is proprietary information of Cloudinary. It is not intended to be distributed to any third party without the written consent of Cloudinary. © 2019 Cloudinary inc.
@tessamero
Oh hai
● Community Leader
○ Past: Joomla, PHP
○ Current: API, Vue.js, JAMStack
● Developer, Teacher,
Advocate
● Gamer + Mom
● Korean Food Enthusiast
● Steak Hobbyist
@tessamero
Topics
● What is Serverless?
● Different Services
● Serverless Frameworks
● Using Serverless
Functions and BaaS
● Resources Let’s make your flower of knowledge bloom!
@tessamero
What is Serverless?
History
Physical Servers Virtual Machines Containers Serverless
What is Serverless?
● No Servers!
No More Managing Servers!
Serverless doesn’t mean there are no servers being used, it is
the concept of not having to manage/provision or worry about
servers for your applications
What is Serverless?
● No Servers!
● Cost
Cost Efficiency
Pay for your resources used rather than the time (provisioned
capacity)
What is Serverless?
● No Servers!
● Cost
● Scale
Erm. So uhh, Does it Scale?
Auto scaling is built in Serverless!
What is Serverless?
● No Servers!
● Cost
● Scale
● Time
What will you do with your extra TIME?
Taking a Look at Different Services
Taking a Look at Different Services
● IaaS
IaaS - Infrastructure as a Service
Examples:
● Amazon Elastic Cloud Computing (AWS
EC2)
Taking a Look at Different Services
● IaaS
● SaaS
SaaS - Software as a Service
Examples:
● Stripe
● PayPal
● Slack
*Responsible for integrating services
Taking a Look at Different Services
● IaaS
● SaaS
● PaaS
PaaS - Platform as a Service
Example:
● Heroku
Provides an entire platform
Taking a Look at Different Services
● IaaS
● SaaS
● PaaS
● BaaS
BaaS - Backend as a Service
Examples:
● Amazon’s DynamoDB
● Google’s Firebase
Service with complex backend usually with
dedicated SDKs and APIs
Taking a Look at Different Services
● IaaS
● SaaS
● PaaS
● BaaS
● FaaS
FaaS - Functions as a Service
Examples:
● Azure Functions
● Amazon’s Lambda
Allows a service to be executed when
triggered
Serverless Frameworks
Serverless Frameworks
● Amplify Framework
Amplify Framework - JS library for front-end devs, works
with all Frameworks
https://aws-amplify.github.io/
Serverless Frameworks
● Amplify Framework
● Architect
● Serverless
Architect - An open-source framework. Create, deploy,
and maintain next-generation AWS cloud function-based
serverless infrastructure with full local, offline workflows,
and more
https://arc.codes
Serverless Frameworks
● Amplify Framework
● Architect
● Serverless
Serverless Framework -First original serverless
framework. The most popular on Github with 30k stars
https://serverless.com
Using Serverless Functions (FaaS) and BaaS Using Lambda, UnSplash API, and Cloudinary API
End Result: Deploy a function and a random image will be selected from Unsplash and then uploaded to your Cloudinary media library!
Let’s Get Started!
What You Will Need: ● Serverless login serverless.com ● AWS IAM Access Token aws.amazon.com ● Unsplash API Key unsplash.com ● Cloudinary API Key cloudinary.com
Install Serverless Framework and Login
npm i -g serverless
serverless login
@tessamero
Start with node.js template
serverless create -t aws-nodejs
handler.js
serverless.yml
@tessamero
Create an AWS Access Key
Search for IAM in Amazon’s AWS and Set up a User
https://serverless.com/framework/docs/providers/aws/guide/credentials/
Quick Instructions:
IAM -> Users -> Add User -> Enable Programmatic Access -> Next ->
Create User
@tessamero
open serverless.yml
service: aws-nodejs
app: XXX
tenant: XXX
serverless deploy
@tessamero
Test by Invoking Function
serverless invoke -f hello -l
@tessamero
update the handler.js file
https://gist.github.com/tessamero/ and click on
“handler.js” and copy the js code
You can also find this tutorial and code snippets at
the FullStackTraining here: https://blog.fullstacktraining.com/introduction-to-serverless-faas/
@tessamero
Create a package.json file
https://gist.github.com/tessamero/ and click on
“package.json” and copy the js code
@tessamero
deploy!
https://gist.github.com/tessamero/ and click on
“serverless.yml” and copy the code
@tessamero
Update the serverless.yml file
serverless deploy
@tessamero
Endpoint reached! @tessamero
Resources: The Serverless Revolution: Why and How The Movement Will Allow Teams to Deploy with More Velocity and Confidence, by Ravi Lachhman What is Serverless? by ServerlessOps Know your history - It’s a serverless world by JAX Editorial Team Origin of Serverless by Joshua Harding Introduction to Serverless FaaS by Tamas Piros 15 Frameworks for Creating Serverless Apps by Alex Ivanovs
Challenge: Transform a Unicorn Before it’s Gone! ● Step 1: Find the Cloudinary Unicorn (hint:.....) ● Step 2: Take a Picture of the Unicorn ● Step 3: Upload and Transform the photo. Sign up for a free account at
https://cloudinary.com. ○ Go to Media Manager ○ Upload Image. Click “Edit” ○ Click “Transform” and change some presets ○ Copy the “https” URL!
● Step 4: DM me to claim your unicorn (send the URL) https://twitter.com/tessamero ○ (hurry, the unicorns won’t last long!)
<< end
● Twitter: https://twitter.com/tessamero
● Email.: [email protected]
● Slides: https://slideshare.net/tessa99
THANK YOU!
@tessamero