SlideShare una empresa de Scribd logo
1 de 53
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

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 infrastructureAnton 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 applicationsCesar 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 PipelineJulien 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 CloudPeter 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-studiesAlex Ellis
 
CI/CD with AWS Code Services
CI/CD with AWS Code ServicesCI/CD with AWS Code Services
CI/CD with AWS Code ServicesPulkit 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 AnsibleDamien 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 devopsTimothy 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 2020Eran Stiller
 
Cloud native - CI/CD
Cloud native - CI/CDCloud native - CI/CD
Cloud native - CI/CDElad 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 microservicesRachel 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 platformNicola Ferraro
 
JavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless ArchtiecturesJavaDay Lviv: Serverless Archtiectures
JavaDay Lviv: Serverless ArchtiecturesAntons 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 MeetupShannon 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 codedaisuke awaji
 

La actualidad más candente (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 a Build REST API with Serverless

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 Kubernetessparkfabrik
 
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 Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventJohn Schneider
 
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
 
API workshop by AWS and 3scale
API workshop by AWS and 3scaleAPI workshop by AWS and 3scale
API workshop by AWS and 3scale3scale
 
用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 2017Amazon 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 2018Amazon 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 applicationsCesar 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 RecapDaniel Zivkovic
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience reportYan Cui
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDevOps Indonesia
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep DiveAmazon Web Services
 
Building Serverless applications with Python
Building Serverless applications with PythonBuilding Serverless applications with Python
Building Serverless applications with PythonAndrii Soldatenko
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applicationsCesar 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 a Build REST API with Serverless (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 Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
 
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...
 
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)
 

Más de 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 benefitsmasahitojp
 
Presentation kyushu-2018
Presentation kyushu-2018Presentation kyushu-2018
Presentation kyushu-2018masahitojp
 
serverless framework + AWS Lambda with Python
serverless framework + AWS Lambda with Pythonserverless framework + AWS Lambda with Python
serverless framework + AWS Lambda with Pythonmasahitojp
 
The Benefits of Type Hints
The Benefits of Type HintsThe Benefits of Type Hints
The Benefits of Type Hintsmasahitojp
 
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 Java8masahitojp
 
Akka meetup 2014_sep
Akka meetup 2014_sepAkka meetup 2014_sep
Akka meetup 2014_sepmasahitojp
 
Pyconjp2014_implementations
Pyconjp2014_implementationsPyconjp2014_implementations
Pyconjp2014_implementationsmasahitojp
 
Pyconsg2014 pyston
Pyconsg2014 pystonPyconsg2014 pyston
Pyconsg2014 pystonmasahitojp
 
Riak map reduce for beginners
Riak map reduce for beginnersRiak map reduce for beginners
Riak map reduce for beginnersmasahitojp
 
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 introductionmasahitojp
 
5分で説明する Play! scala
5分で説明する Play! scala5分で説明する Play! scala
5分で説明する Play! scalamasahitojp
 

Más de 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
 

Último

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 

Último (20)

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 

Build REST API with Serverless

  • 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