SlideShare a Scribd company logo
Build a RESTfull API with the
Serverless framework
Plone Conference WebDay 2018 Nov 7th 1
Introduction
1. Introduce myself
2. perpose of this presentation
Plone Conference WebDay 2018 Nov 7th 2
Introduce myself
• Masato Nakamura
• twitter: masahito
• github: masahitojp
• work at Nulab inc. Typetalk team
• use Scala and JavaScript and Python
• Python ❤ and
☕
❤
Plone Conference WebDay 2018 Nov 7th 3
Perpose of this presentation
• You can understand buid a REST API with the
Serverless Framework
• I will talk especially for the AWS services
Plone Conference WebDay 2018 Nov 7th 4
Not covering today
• Technical Details
• AWS knowledge(IAM etc)
Plone Conference WebDay 2018 Nov 7th 5
Today I will talk about following
things
• How to create an RESTful API with the Amazon API
Gateway
• How to use the Serverless Framework
• How to make deployment easier
Plone Conference WebDay 2018 Nov 7th 6
How to create RESTful API
Plone Conference WebDay 2018 Nov 7th 7
How to create RESTful API
1. Where to use RESTful API?
2. What is the Amazon API Gateway
3. What is AWS Lambda
Plone Conference WebDay 2018 Nov 7th 8
Where to use RESTful API?
• Upload File to the Amazon S3
• Send Message to a service
Plone Conference WebDay 2018 Nov 7th 9
Target
• You use CMS
• You want to make API more easily
• I want you to introduce the Amazon API Gateway
Plone Conference WebDay 2018 Nov 7th 10
What is the Amazon API Gateway
API creation, application communication gateway.
Create an endpoint.
It is created from the management console of AWS.
We do not write actual code.
It also has an authentication function, it separates
the environment, deploys and scales.
Plone Conference WebDay 2018 Nov 7th 11
What is the AWS Lambda
A service that executes code.
Create a function called Lambda function and write
code.
You can write it directly in the AWS management
console, but basically upload the code.
You can write even code, AWS Lamvs provide
manage servers, scaling, logging.
Plone Conference WebDay 2018 Nov 7th 12
What you can do with combining
We can create RESTful API ❤
Plone Conference WebDay 2018 Nov 7th 13
Flow of API creation
1. create the Amazon API Gateway
2. create AWS Lambda funtion
3. connect AWS GateWay & AWS Lambda funtion
Plone Conference WebDay 2018 Nov 7th 14
1). create the Amazon API Gateway
Plone Conference WebDay 2018 Nov 7th 15
2). create AWS Lambda funtion
Plone Conference WebDay 2018 Nov 7th 16
3). connect the Amazon API Gateway & AWS Lambda
funtion
Plone Conference WebDay 2018 Nov 7th 17
Next
I want to talk about the AWS Lambda
Plone Conference WebDay 2018 Nov 7th 18
How to use the Serverless
framework
Plone Conference WebDay 2018 Nov 7th 19
How to use the Serverless
framework
1. How to deploy AWS Lambda function.
2. Introduce the Serverless Framework
Plone Conference WebDay 2018 Nov 7th 20
Target
• Python newbie
• use or used the AWS Lambda
Plone Conference WebDay 2018 Nov 7th 21
Goal
•
!
Easy to use AWS Lambda for Python
• When you write Code, You can update easily
Plone Conference WebDay 2018 Nov 7th 22
can register at AWS console
• Write Code
• Run Test
Plone Conference WebDay 2018 Nov 7th 23
When used only once This is enough
Plone Conference WebDay 2018 Nov 7th 24
• example: POST JSON -> send message to Chat
Plone Conference WebDay 2018 Nov 7th 25
• example: POST JSON -> send message to Chat
•
!
We want to use a 3rd Party lib
• requests
• add requirements.txt
requests
• run
$ pip install -r requirements.txt -t vendor/
$ edit python-file
$ zip /path/to/service-dir
$ aws lambda ~~
Plone Conference WebDay 2018 Nov 7th 26
  It's troublesome to do with the
AWS console
!
use 3rd party libraries
!
Especially when using C-API
!
Code version control (git etc)
Plone Conference WebDay 2018 Nov 7th 27
Deploy to the AWSLambda
• Deployment using ZipFile is possible
!
Code version control (git etc)
Plone Conference WebDay 2018 Nov 7th 28
• Deployment using ZipFile is possible
$ aws lambda create-function 
--function-name AccessMemCache 
--region us-east-1 
--zip-file fileb://path-to/app.zip 
--role execution-role-arn 
--handler app.handler 
--runtime python3.6 
--timeout 30 
--vpc-config SubnetIds=comma-separated-vpc-subnet-ids,SecurityGroupIds=default-security-group-id 
--memory-size 1024
https://docs.aws.amazon.com/ja_jp/lambda/latest/
dg/vpc-ec-upload-deployment-pkg.html
Plone Conference WebDay 2018 Nov 7th 29
I want to make it easier
!
Create a zipfile each time you change -> deploy
!
Run test locally
• What we need now
$ edit python-file
$ (pip install ~~)
$ zip /path/to/service-dir
$ aws lambda ~~
Plone Conference WebDay 2018 Nov 7th 30
Introduce the Serverless Framework
Plone Conference WebDay 2018 Nov 7th 31
What is the Serverless Framework?
• http://www.serverless.com
Serverless Framework – Build web, mobile and IoT
applications with serverless architectures using AWS
Lambda, Azure Functions, Google CloudFunctions &
more!
• AWS Lambda, Azure Functions, Google
CloudFunctions を使ってサーバレスアーキテク
チャで web, Mobile IoT アプリケーションを作ろう
Plone Conference WebDay 2018 Nov 7th 32
Description of the Serverless Framework
• pros
!!
Code version control(git / svn / Hg)
!
zip -> deploy is possible by executing Only 1
command
!
manage CloudWatch/ AWS IAM
Plone Conference WebDay 2018 Nov 7th 33
Use the Serverless Framework
How to create environments
$ npm instal -g serverless
$ sls -v
1.32.0
Plone Conference WebDay 2018 Nov 7th 34
create AWS Lambda with the Serverless Framework
$ sls create -t aws-python3 -p py3-hello
Serverless: Generating boilerplate...
Serverless: Generating boilerplate in "/Users/masahito-nulab/src/jobs/typetalk-serverless-internal/py3-hello"
_______ __
| _ .-----.----.--.--.-----.----| .-----.-----.-----.
| |___| -__| _| | | -__| _| | -__|__ --|__ --|
|____ |_____|__| ___/|_____|__| |__|_____|_____|_____|
| | | The Serverless Application Framework
| | serverless.com, v1.27.3
-------'
Serverless: Successfully generated boilerplate for template: "aws-python3"
$ tree py3-hello/
py3-hello/
!"" handler.py
#"" serverless.yml
Plone Conference WebDay 2018 Nov 7th 35
• handler.py
import json
def hello(event, context):
body = {
"message": "Go Serverless v1.0! Your function executed successfully!",
"input": event
}
response = {
"statusCode": 200,
"body": json.dumps(body)
}
return response
• serverless.yml
service: py3-hello
provider:
name: aws
runtime: python3.6
functions:
hello:
handler: handler.hello
Plone Conference WebDay 2018 Nov 7th 36
Run Test locally
$ cd py3-hello
$ sls invoke local -f hello
{
"statusCode": 200,
"body": "{"message": "Go Serverless v1.0! Your function executed successfully!", "input": {}}"
}
Plone Conference WebDay 2018 Nov 7th 37
Deploy to AWS Lambda
!
Deployment will be simplified after setting the
IAM/Role
$ sls deploy
Plone Conference WebDay 2018 Nov 7th 38
How to make deployment
easier
Plone Conference WebDay 2018 Nov 7th 39
How to make deployment easier
1. reduce troublesome for library installation
2. Non-Pure Python module
Plone Conference WebDay 2018 Nov 7th 40
Goal
• Easy to use AWS Lambda for Python
•
!
When you write Code, You can update easily
Plone Conference WebDay 2018 Nov 7th 41
Plone Conference WebDay 2018 Nov 7th 42
reduce troublesome for library installation
!
required 3rd-party library installation
#
!
I often forget this
$ pip install -r requirement.txt -t vendor/
$ sls deploy
Plone Conference WebDay 2018 Nov 7th 43
reduce troublesome for library installation
Use serverless-framework plugin
• UnitedIncome/serverless-python-requirements
• serverless >= v1.12
Plone Conference WebDay 2018 Nov 7th 44
How to install this plugin
$ sls plugin install -n serverless-python-requirements
service: py3-hello
provider:
name: aws
runtime: python3.6
cfLogs: true
plugins:
- serverless-python-requirements
functions:
hello:
handler: handler.hello
Plone Conference WebDay 2018 Nov 7th 45
Deploy
($ sls requirements install)
$ sls deploy
Plone Conference WebDay 2018 Nov 7th 46
It is now possible to execute with a only 1 command !
Plone Conference WebDay 2018 Nov 7th 47
Non-Pure Python module
• Developers often use Windows / OSX for
development environment
• Python has lots of libraries written with C-API
• numpy , TensorFlow , Image Libraries: pillow etc
• Creating a zipfile locally does not work at AWS
Lambda
!
• The environment of AWS Lambda is Linux
Plone Conference WebDay 2018 Nov 7th 48
dockerize pip
Cross-compile in docker environment
• It uses docker image ”lambci / docker-lambda"
service: py3-hello
provider:
name: aws
runtime: python3.6
cfLogs: true
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: true
functions:
hello:
handler: handler.hello
Plone Conference WebDay 2018 Nov 7th 49
Today I talked about following things
• How to create an RESTful API with the Amazon API
Gateway
• How to use the Serverless Framework
• How to make deployment easier
Plone Conference WebDay 2018 Nov 7th 50
I hope you can write and
deploy RESTfull API ❤
Plone Conference WebDay 2018 Nov 7th 51
Thank you
@masahito
Plone Conference WebDay 2018 Nov 7th 52
Question?
Plone Conference WebDay 2018 Nov 7th 53

More Related Content

What's hot

What you see is what you get for AWS infrastructure
What you see is what you get for AWS infrastructureWhat you see is what you get for AWS infrastructure
What you see is what you get for AWS infrastructure
Anton Babenko
 
PyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applicationsPyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applications
Cesar Cardenas Desales
 
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
Claus Ibsen
 
Building a Serverless Pipeline
Building a Serverless PipelineBuilding a Serverless Pipeline
Building a Serverless Pipeline
Julien SIMON
 
2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud
Peter Salnikov
 
OpenFaaS - zero serverless in 60 seconds anywhere with case-studies
OpenFaaS - zero serverless in 60 seconds anywhere with case-studiesOpenFaaS - zero serverless in 60 seconds anywhere with case-studies
OpenFaaS - zero serverless in 60 seconds anywhere with case-studies
Alex Ellis
 
CI/CD with AWS Code Services
CI/CD with AWS Code ServicesCI/CD with AWS Code Services
CI/CD with AWS Code Services
Pulkit Gupta
 
Building Cloud Virtual Topologies with Ravello and Ansible
Building Cloud Virtual Topologies with Ravello and AnsibleBuilding Cloud Virtual Topologies with Ravello and Ansible
Building Cloud Virtual Topologies with Ravello and Ansible
Damien Garros
 
Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...
Claus Ibsen
 
Flink sql for continuous sql etl apps & Apache NiFi devops
Flink sql for continuous sql etl apps & Apache NiFi devopsFlink sql for continuous sql etl apps & Apache NiFi devops
Flink sql for continuous sql etl apps & Apache NiFi devops
Timothy Spann
 
API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020
Eran Stiller
 
Origins of Serverless
Origins of ServerlessOrigins of Serverless
Origins of Serverless
Andrii Soldatenko
 
Cloud native - CI/CD
Cloud native - CI/CDCloud native - CI/CD
Cloud native - CI/CD
Elad Hirsch
 
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps_Fest
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservices
Rachel Reese
 
ApacheCon NA - Apache Camel K: a cloud-native integration platform
ApacheCon NA - Apache Camel K: a cloud-native integration platformApacheCon NA - Apache Camel K: a cloud-native integration platform
ApacheCon NA - Apache Camel K: a cloud-native integration platform
Nicola Ferraro
 
JavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless ArchtiecturesJavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless Archtiectures
Antons Kranga
 
Supercharging CI/CD with GitLab and Rancher - June 2017 Online Meetup
Supercharging CI/CD with GitLab and Rancher - June 2017 Online MeetupSupercharging CI/CD with GitLab and Rancher - June 2017 Online Meetup
Supercharging CI/CD with GitLab and Rancher - June 2017 Online Meetup
Shannon Williams
 
It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)
It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)
It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)
Jarek Potiuk
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as code
daisuke awaji
 

What's hot (20)

What you see is what you get for AWS infrastructure
What you see is what you get for AWS infrastructureWhat you see is what you get for AWS infrastructure
What you see is what you get for AWS infrastructure
 
PyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applicationsPyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applications
 
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
Meetup Melbourne August 2017 - Agile Integration with Apache Camel microservi...
 
Building a Serverless Pipeline
Building a Serverless PipelineBuilding a Serverless Pipeline
Building a Serverless Pipeline
 
2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud2020.02.15 DelEx - CI/CD in AWS Cloud
2020.02.15 DelEx - CI/CD in AWS Cloud
 
OpenFaaS - zero serverless in 60 seconds anywhere with case-studies
OpenFaaS - zero serverless in 60 seconds anywhere with case-studiesOpenFaaS - zero serverless in 60 seconds anywhere with case-studies
OpenFaaS - zero serverless in 60 seconds anywhere with case-studies
 
CI/CD with AWS Code Services
CI/CD with AWS Code ServicesCI/CD with AWS Code Services
CI/CD with AWS Code Services
 
Building Cloud Virtual Topologies with Ravello and Ansible
Building Cloud Virtual Topologies with Ravello and AnsibleBuilding Cloud Virtual Topologies with Ravello and Ansible
Building Cloud Virtual Topologies with Ravello and Ansible
 
Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...Best Practices for Middleware and Integration Architecture Modernization with...
Best Practices for Middleware and Integration Architecture Modernization with...
 
Flink sql for continuous sql etl apps & Apache NiFi devops
Flink sql for continuous sql etl apps & Apache NiFi devopsFlink sql for continuous sql etl apps & Apache NiFi devops
Flink sql for continuous sql etl apps & Apache NiFi devops
 
API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020
 
Origins of Serverless
Origins of ServerlessOrigins of Serverless
Origins of Serverless
 
Cloud native - CI/CD
Cloud native - CI/CDCloud native - CI/CD
Cloud native - CI/CD
 
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
DevOps Fest 2019. Gianluca Arbezzano. DevOps never sleeps. What we learned fr...
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservices
 
ApacheCon NA - Apache Camel K: a cloud-native integration platform
ApacheCon NA - Apache Camel K: a cloud-native integration platformApacheCon NA - Apache Camel K: a cloud-native integration platform
ApacheCon NA - Apache Camel K: a cloud-native integration platform
 
JavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless ArchtiecturesJavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless Archtiectures
 
Supercharging CI/CD with GitLab and Rancher - June 2017 Online Meetup
Supercharging CI/CD with GitLab and Rancher - June 2017 Online MeetupSupercharging CI/CD with GitLab and Rancher - June 2017 Online Meetup
Supercharging CI/CD with GitLab and Rancher - June 2017 Online Meetup
 
It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)
It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)
It's a Breeze to develop Apache Airflow (London Apache Airflow meetup)
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as code
 

Similar to Build a RESTful API with the Serverless Framework

Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
Yan Cui
 
The path to a serverless-native era with Kubernetes
The path to a serverless-native era with KubernetesThe path to a serverless-native era with Kubernetes
The path to a serverless-native era with Kubernetes
sparkfabrik
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
Yan Cui
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Amazon Web Services
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
John Schneider
 
API workshop by AWS and 3scale
API workshop by AWS and 3scaleAPI workshop by AWS and 3scale
API workshop by AWS and 3scale
3scale
 
用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人
Kevin Luo
 
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
Amazon Web Services
 
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Amazon Web Services
 
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
Niklas Heidloff
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applications
Cesar Cardenas Desales
 
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Amazon Web Services
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience report
Yan Cui
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for Kubernetes
DevOps Indonesia
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
Amazon Web Services
 
Building Serverless applications with Python
Building Serverless applications with PythonBuilding Serverless applications with Python
Building Serverless applications with Python
Andrii Soldatenko
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applications
Cesar Cardenas Desales
 
Building serverless applications (April 2018)
Building serverless applications (April 2018)Building serverless applications (April 2018)
Building serverless applications (April 2018)
Julien SIMON
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)
DoiT International
 

Similar to Build a RESTful API with the Serverless Framework (20)

Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
 
The path to a serverless-native era with Kubernetes
The path to a serverless-native era with KubernetesThe path to a serverless-native era with Kubernetes
The path to a serverless-native era with Kubernetes
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
 
API workshop by AWS and 3scale
API workshop by AWS and 3scaleAPI workshop by AWS and 3scale
API workshop by AWS and 3scale
 
用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人
 
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
Building CI/CD Pipelines for Serverless Applications - SRV302 - re:Invent 2017
 
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
Building a DevOps Pipeline on AWS (DEV326) - AWS re:Invent 2018
 
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applications
 
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
Infrastructure Is Code with the AWS Cloud Development Kit (DEV372) - AWS re:I...
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience report
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for Kubernetes
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Building Serverless applications with Python
Building Serverless applications with PythonBuilding Serverless applications with Python
Building Serverless applications with Python
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applications
 
Building serverless applications (April 2018)
Building serverless applications (April 2018)Building serverless applications (April 2018)
Building serverless applications (April 2018)
 
Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)Kubernetes - State of the Union (Q1-2016)
Kubernetes - State of the Union (Q1-2016)
 

More from masahitojp

Python と型ヒントとその使い方
Python と型ヒントとその使い方Python と型ヒントとその使い方
Python と型ヒントとその使い方
masahitojp
 
Enjoy Type Hints and its benefits
Enjoy Type Hints and its benefitsEnjoy Type Hints and its benefits
Enjoy Type Hints and its benefits
masahitojp
 
Presentation kyushu-2018
Presentation kyushu-2018Presentation kyushu-2018
Presentation kyushu-2018
masahitojp
 
serverless framework + AWS Lambda with Python
serverless framework + AWS Lambda with Pythonserverless framework + AWS Lambda with Python
serverless framework + AWS Lambda with Python
masahitojp
 
The Benefits of Type Hints
The Benefits of Type HintsThe Benefits of Type Hints
The Benefits of Type Hints
masahitojp
 
20170131 python3 6 PEP526
20170131 python3 6 PEP526 20170131 python3 6 PEP526
20170131 python3 6 PEP526
masahitojp
 
chat bot framework for Java8
chat bot framework for Java8chat bot framework for Java8
chat bot framework for Java8
masahitojp
 
Akka meetup 2014_sep
Akka meetup 2014_sepAkka meetup 2014_sep
Akka meetup 2014_sep
masahitojp
 
Pyconjp2014_implementations
Pyconjp2014_implementationsPyconjp2014_implementations
Pyconjp2014_implementations
masahitojp
 
Pyconsg2014 pyston
Pyconsg2014 pystonPyconsg2014 pyston
Pyconsg2014 pyston
masahitojp
 
Riak map reduce for beginners
Riak map reduce for beginnersRiak map reduce for beginners
Riak map reduce for beginners
masahitojp
 
Play2 translate 20120714
Play2 translate 20120714Play2 translate 20120714
Play2 translate 20120714masahitojp
 
Play2の裏側
Play2の裏側Play2の裏側
Play2の裏側masahitojp
 
Play!framework2.0 introduction
Play!framework2.0 introductionPlay!framework2.0 introduction
Play!framework2.0 introduction
masahitojp
 
5分で説明する Play! scala
5分で説明する Play! scala5分で説明する Play! scala
5分で説明する Play! scala
masahitojp
 

More from masahitojp (16)

Python と型ヒントとその使い方
Python と型ヒントとその使い方Python と型ヒントとその使い方
Python と型ヒントとその使い方
 
Enjoy Type Hints and its benefits
Enjoy Type Hints and its benefitsEnjoy Type Hints and its benefits
Enjoy Type Hints and its benefits
 
Presentation kyushu-2018
Presentation kyushu-2018Presentation kyushu-2018
Presentation kyushu-2018
 
serverless framework + AWS Lambda with Python
serverless framework + AWS Lambda with Pythonserverless framework + AWS Lambda with Python
serverless framework + AWS Lambda with Python
 
The Benefits of Type Hints
The Benefits of Type HintsThe Benefits of Type Hints
The Benefits of Type Hints
 
20170131 python3 6 PEP526
20170131 python3 6 PEP526 20170131 python3 6 PEP526
20170131 python3 6 PEP526
 
chat bot framework for Java8
chat bot framework for Java8chat bot framework for Java8
chat bot framework for Java8
 
Akka meetup 2014_sep
Akka meetup 2014_sepAkka meetup 2014_sep
Akka meetup 2014_sep
 
Pyconjp2014_implementations
Pyconjp2014_implementationsPyconjp2014_implementations
Pyconjp2014_implementations
 
Pyconsg2014 pyston
Pyconsg2014 pystonPyconsg2014 pyston
Pyconsg2014 pyston
 
Pykonjp2014
Pykonjp2014Pykonjp2014
Pykonjp2014
 
Riak map reduce for beginners
Riak map reduce for beginnersRiak map reduce for beginners
Riak map reduce for beginners
 
Play2 translate 20120714
Play2 translate 20120714Play2 translate 20120714
Play2 translate 20120714
 
Play2の裏側
Play2の裏側Play2の裏側
Play2の裏側
 
Play!framework2.0 introduction
Play!framework2.0 introductionPlay!framework2.0 introduction
Play!framework2.0 introduction
 
5分で説明する Play! scala
5分で説明する Play! scala5分で説明する Play! scala
5分で説明する Play! scala
 

Recently uploaded

CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
gray level transformation unit 3(image processing))
gray level transformation unit 3(image processing))gray level transformation unit 3(image processing))
gray level transformation unit 3(image processing))
shivani5543
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
amsjournal
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
Addu25809
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 

Recently uploaded (20)

CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
gray level transformation unit 3(image processing))
gray level transformation unit 3(image processing))gray level transformation unit 3(image processing))
gray level transformation unit 3(image processing))
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
UNLOCKING HEALTHCARE 4.0: NAVIGATING CRITICAL SUCCESS FACTORS FOR EFFECTIVE I...
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENTNATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
NATURAL DEEP EUTECTIC SOLVENTS AS ANTI-FREEZING AGENT
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 

Build a RESTful API with the Serverless Framework

  • 1. Build a RESTfull API with the Serverless framework Plone Conference WebDay 2018 Nov 7th 1
  • 2. Introduction 1. Introduce myself 2. perpose of this presentation Plone Conference WebDay 2018 Nov 7th 2
  • 3. Introduce myself • Masato Nakamura • twitter: masahito • github: masahitojp • work at Nulab inc. Typetalk team • use Scala and JavaScript and Python • Python ❤ and ☕ ❤ Plone Conference WebDay 2018 Nov 7th 3
  • 4. Perpose of this presentation • You can understand buid a REST API with the Serverless Framework • I will talk especially for the AWS services Plone Conference WebDay 2018 Nov 7th 4
  • 5. Not covering today • Technical Details • AWS knowledge(IAM etc) Plone Conference WebDay 2018 Nov 7th 5
  • 6. Today I will talk about following things • How to create an RESTful API with the Amazon API Gateway • How to use the Serverless Framework • How to make deployment easier Plone Conference WebDay 2018 Nov 7th 6
  • 7. How to create RESTful API Plone Conference WebDay 2018 Nov 7th 7
  • 8. How to create RESTful API 1. Where to use RESTful API? 2. What is the Amazon API Gateway 3. What is AWS Lambda Plone Conference WebDay 2018 Nov 7th 8
  • 9. Where to use RESTful API? • Upload File to the Amazon S3 • Send Message to a service Plone Conference WebDay 2018 Nov 7th 9
  • 10. Target • You use CMS • You want to make API more easily • I want you to introduce the Amazon API Gateway Plone Conference WebDay 2018 Nov 7th 10
  • 11. What is the Amazon API Gateway API creation, application communication gateway. Create an endpoint. It is created from the management console of AWS. We do not write actual code. It also has an authentication function, it separates the environment, deploys and scales. Plone Conference WebDay 2018 Nov 7th 11
  • 12. What is the AWS Lambda A service that executes code. Create a function called Lambda function and write code. You can write it directly in the AWS management console, but basically upload the code. You can write even code, AWS Lamvs provide manage servers, scaling, logging. Plone Conference WebDay 2018 Nov 7th 12
  • 13. What you can do with combining We can create RESTful API ❤ Plone Conference WebDay 2018 Nov 7th 13
  • 14. Flow of API creation 1. create the Amazon API Gateway 2. create AWS Lambda funtion 3. connect AWS GateWay & AWS Lambda funtion Plone Conference WebDay 2018 Nov 7th 14
  • 15. 1). create the Amazon API Gateway Plone Conference WebDay 2018 Nov 7th 15
  • 16. 2). create AWS Lambda funtion Plone Conference WebDay 2018 Nov 7th 16
  • 17. 3). connect the Amazon API Gateway & AWS Lambda funtion Plone Conference WebDay 2018 Nov 7th 17
  • 18. Next I want to talk about the AWS Lambda Plone Conference WebDay 2018 Nov 7th 18
  • 19. How to use the Serverless framework Plone Conference WebDay 2018 Nov 7th 19
  • 20. How to use the Serverless framework 1. How to deploy AWS Lambda function. 2. Introduce the Serverless Framework Plone Conference WebDay 2018 Nov 7th 20
  • 21. Target • Python newbie • use or used the AWS Lambda Plone Conference WebDay 2018 Nov 7th 21
  • 22. Goal • ! Easy to use AWS Lambda for Python • When you write Code, You can update easily Plone Conference WebDay 2018 Nov 7th 22
  • 23. can register at AWS console • Write Code • Run Test Plone Conference WebDay 2018 Nov 7th 23
  • 24. When used only once This is enough Plone Conference WebDay 2018 Nov 7th 24
  • 25. • example: POST JSON -> send message to Chat Plone Conference WebDay 2018 Nov 7th 25
  • 26. • example: POST JSON -> send message to Chat • ! We want to use a 3rd Party lib • requests • add requirements.txt requests • run $ pip install -r requirements.txt -t vendor/ $ edit python-file $ zip /path/to/service-dir $ aws lambda ~~ Plone Conference WebDay 2018 Nov 7th 26
  • 27.   It's troublesome to do with the AWS console ! use 3rd party libraries ! Especially when using C-API ! Code version control (git etc) Plone Conference WebDay 2018 Nov 7th 27
  • 28. Deploy to the AWSLambda • Deployment using ZipFile is possible ! Code version control (git etc) Plone Conference WebDay 2018 Nov 7th 28
  • 29. • Deployment using ZipFile is possible $ aws lambda create-function --function-name AccessMemCache --region us-east-1 --zip-file fileb://path-to/app.zip --role execution-role-arn --handler app.handler --runtime python3.6 --timeout 30 --vpc-config SubnetIds=comma-separated-vpc-subnet-ids,SecurityGroupIds=default-security-group-id --memory-size 1024 https://docs.aws.amazon.com/ja_jp/lambda/latest/ dg/vpc-ec-upload-deployment-pkg.html Plone Conference WebDay 2018 Nov 7th 29
  • 30. I want to make it easier ! Create a zipfile each time you change -> deploy ! Run test locally • What we need now $ edit python-file $ (pip install ~~) $ zip /path/to/service-dir $ aws lambda ~~ Plone Conference WebDay 2018 Nov 7th 30
  • 31. Introduce the Serverless Framework Plone Conference WebDay 2018 Nov 7th 31
  • 32. What is the Serverless Framework? • http://www.serverless.com Serverless Framework – Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more! • AWS Lambda, Azure Functions, Google CloudFunctions を使ってサーバレスアーキテク チャで web, Mobile IoT アプリケーションを作ろう Plone Conference WebDay 2018 Nov 7th 32
  • 33. Description of the Serverless Framework • pros !! Code version control(git / svn / Hg) ! zip -> deploy is possible by executing Only 1 command ! manage CloudWatch/ AWS IAM Plone Conference WebDay 2018 Nov 7th 33
  • 34. Use the Serverless Framework How to create environments $ npm instal -g serverless $ sls -v 1.32.0 Plone Conference WebDay 2018 Nov 7th 34
  • 35. create AWS Lambda with the Serverless Framework $ sls create -t aws-python3 -p py3-hello Serverless: Generating boilerplate... Serverless: Generating boilerplate in "/Users/masahito-nulab/src/jobs/typetalk-serverless-internal/py3-hello" _______ __ | _ .-----.----.--.--.-----.----| .-----.-----.-----. | |___| -__| _| | | -__| _| | -__|__ --|__ --| |____ |_____|__| ___/|_____|__| |__|_____|_____|_____| | | | The Serverless Application Framework | | serverless.com, v1.27.3 -------' Serverless: Successfully generated boilerplate for template: "aws-python3" $ tree py3-hello/ py3-hello/ !"" handler.py #"" serverless.yml Plone Conference WebDay 2018 Nov 7th 35
  • 36. • handler.py import json def hello(event, context): body = { "message": "Go Serverless v1.0! Your function executed successfully!", "input": event } response = { "statusCode": 200, "body": json.dumps(body) } return response • serverless.yml service: py3-hello provider: name: aws runtime: python3.6 functions: hello: handler: handler.hello Plone Conference WebDay 2018 Nov 7th 36
  • 37. Run Test locally $ cd py3-hello $ sls invoke local -f hello { "statusCode": 200, "body": "{"message": "Go Serverless v1.0! Your function executed successfully!", "input": {}}" } Plone Conference WebDay 2018 Nov 7th 37
  • 38. Deploy to AWS Lambda ! Deployment will be simplified after setting the IAM/Role $ sls deploy Plone Conference WebDay 2018 Nov 7th 38
  • 39. How to make deployment easier Plone Conference WebDay 2018 Nov 7th 39
  • 40. How to make deployment easier 1. reduce troublesome for library installation 2. Non-Pure Python module Plone Conference WebDay 2018 Nov 7th 40
  • 41. Goal • Easy to use AWS Lambda for Python • ! When you write Code, You can update easily Plone Conference WebDay 2018 Nov 7th 41
  • 42. Plone Conference WebDay 2018 Nov 7th 42
  • 43. reduce troublesome for library installation ! required 3rd-party library installation # ! I often forget this $ pip install -r requirement.txt -t vendor/ $ sls deploy Plone Conference WebDay 2018 Nov 7th 43
  • 44. reduce troublesome for library installation Use serverless-framework plugin • UnitedIncome/serverless-python-requirements • serverless >= v1.12 Plone Conference WebDay 2018 Nov 7th 44
  • 45. How to install this plugin $ sls plugin install -n serverless-python-requirements service: py3-hello provider: name: aws runtime: python3.6 cfLogs: true plugins: - serverless-python-requirements functions: hello: handler: handler.hello Plone Conference WebDay 2018 Nov 7th 45
  • 46. Deploy ($ sls requirements install) $ sls deploy Plone Conference WebDay 2018 Nov 7th 46
  • 47. It is now possible to execute with a only 1 command ! Plone Conference WebDay 2018 Nov 7th 47
  • 48. Non-Pure Python module • Developers often use Windows / OSX for development environment • Python has lots of libraries written with C-API • numpy , TensorFlow , Image Libraries: pillow etc • Creating a zipfile locally does not work at AWS Lambda ! • The environment of AWS Lambda is Linux Plone Conference WebDay 2018 Nov 7th 48
  • 49. dockerize pip Cross-compile in docker environment • It uses docker image ”lambci / docker-lambda" service: py3-hello provider: name: aws runtime: python3.6 cfLogs: true plugins: - serverless-python-requirements custom: pythonRequirements: dockerizePip: true functions: hello: handler: handler.hello Plone Conference WebDay 2018 Nov 7th 49
  • 50. Today I talked about following things • How to create an RESTful API with the Amazon API Gateway • How to use the Serverless Framework • How to make deployment easier Plone Conference WebDay 2018 Nov 7th 50
  • 51. I hope you can write and deploy RESTfull API ❤ Plone Conference WebDay 2018 Nov 7th 51
  • 52. Thank you @masahito Plone Conference WebDay 2018 Nov 7th 52