deep dive on aws chalicedeep dive on aws chalice a serverless microframework for python james...
TRANSCRIPT
![Page 1: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/1.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
T O K Y O2
01
9.1
0.0
3-
04
![Page 2: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/2.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
T O K Y O
20
19
.10
.03
-0
4Deep Dive on AWS ChaliceA Serverless Microframework for Python
James Saryerwinnie | @jsaryerSenior Software Development EngineerAmazon Web Services
D - 1
![Page 3: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/3.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Overview of Chalice
Deployment
Python Packaging
AWS IAM Policy Generation
![Page 4: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/4.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 5: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/5.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Chalice is a microframework for writing serverless apps in python
Framework for creating serverless applications
CLI for deployment and packaging
![Page 6: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/6.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Overview
from chalice import Chalice
app = Chalice(app_name='helloworld')
@app.route('/')def index():
return {'hello': 'world'}
![Page 7: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/7.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Overview
from chalice import Chalice
app = Chalice(app_name='helloworld')
@app.route('/')def index():
return {'hello': 'world'}
$ chalice deploy
https://dfut7pnl47/dev/
![Page 8: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/8.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Overview
from chalice import Chalice
app = Chalice(app_name='helloworld')
@app.route('/')def index():
return {'hello': 'world'}
$ chalice deploy
https://dfut7pnl47/dev/
Framework CLI
![Page 9: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/9.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 10: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/10.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
More Chalice [email protected]_s3_event('mybucket')def resize_image(event):
pass
@app.schedule('rate(5 minutes)')def rate_handler(event):
pass
@app.on_sns_message(topic='mytopic')def handler(event):
pass
@app.on_sqs_message(queue='myqueue')def handler(event):
pass
@app.lambda_function()def handler(event, context):
pass
@app.route('/resource/{value}',methods=['PUT'])
def resource(value):pass
@app.authorizer(ttl_seconds=30)def jwt_auth(auth_request):
pass
@app.on_ws_message()def websocket_msg(event):
pass
![Page 11: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/11.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 12: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/12.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Chalice deploy
AWS Lambda
Amazon API Gateway
Role
AWS Cloud
Permissions
Swagger Doc
Deployment ZIP
from chalice import Chalice
app = Chalice(app_name='helloworld')
@app.route('/')
def index():
return {'hello': 'world'}
![Page 13: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/13.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Chalice deploy
AWS Cloud
AWS Lambda
Amazon API Gateway
Permissions
App Code
Deployment ZIP
Swagger Doc
Role
![Page 14: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/14.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Warning about Internals
Disclaimer: these are implementation details
The goal is to better understand how Chalice can help you
![Page 15: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/15.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 16: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/16.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 17: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/17.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Websocket App
import boto3
from chalice import Chalice
app = Chalice(app_name='websocket')
app.experimental_feature_flags.update([
'WEBSOCKETS'
])
app.websocket_api.session =boto3.Session()
@app.on_ws_connect()
def connect(event):
print('New connection: %s’ %
event.connection_id)
@app.on_ws_message()
def message(event):
print('%s: %s' % (event.connection_id,
event.body))
![Page 18: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/18.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Websocket App
import boto3
from chalice import Chalice
app = Chalice(app_name='websocket')
app.experimental_feature_flags.update([
'WEBSOCKETS'
])
app.websocket_api.session =boto3.Session()
@app.on_ws_connect()
def connect(event):
print('New connection: %s’ %
event.connection_id)
@app.on_ws_message()
def message(event):
print('%s: %s' % (event.connection_id,
event.body))
![Page 19: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/19.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Websocket App
import boto3
from chalice import Chalice
app = Chalice(app_name='websocket')
app.experimental_feature_flags.update([
'WEBSOCKETS'
])
app.websocket_api.session =boto3.Session()
@app.on_ws_connect()
def connect(event):
print('New connection: %s’ %
event.connection_id)
@app.on_ws_message()
def message(event):
print('%s: %s' % (event.connection_id,
event.body))
![Page 20: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/20.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 21: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/21.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Graph Builder
![Page 22: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/22.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
from chalice import Chalice
app = Chalice(app_name='one')
@app.lambda_function()
def handler(event, context):
return {}
Application Graph Builder
![Page 23: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/23.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Graph Builder
![Page 24: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/24.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 25: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/25.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 26: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/26.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 27: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/27.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 28: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/28.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 29: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/29.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 30: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/30.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 31: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/31.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 32: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/32.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 33: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/33.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 34: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/34.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 35: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/35.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dependency Order
![Page 36: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/36.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 37: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/37.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Local Build
![Page 38: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/38.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Local Build
![Page 39: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/39.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Local Build
![Page 40: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/40.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 41: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/41.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Planner
![Page 42: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/42.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Planner
![Page 43: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/43.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Additional Plan Instructions
![Page 44: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/44.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 45: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/45.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Executor
![Page 46: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/46.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Executor
![Page 47: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/47.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 48: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/48.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Benefits of this Architecture
DECOUPLED
Each stage is independent which makes it easy to test and optimize each stage without affecting other stages.
ALTERNATIVES
You can swap out components with alternate implementations, supporting other deployment backends.
CONTROL IO
IO only happens a specific stages in the pipeline. We can implement features such as dry run and fast feedback loops.
![Page 49: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/49.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 50: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/50.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 51: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/51.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
.├── app.py└── requirements.txt
boto3==1.9.188botocore==1.12.204jmespath==0.9.3cryptography==2.7
![Page 52: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/52.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
.├── app.py└── requirements.txt
boto3==1.9.188botocore==1.12.204jmespath==0.9.3cryptography==2.7
pip install -r requirements.txt
![Page 53: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/53.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ aws lambda create-function ¥--function-name Hello ¥--role-name MyApp ¥--runtime python3.6 ¥--handler app.handler ¥--zip-file fileb://app.zip
![Page 54: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/54.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
deploy.zip
$ aws lambda create-function ¥--function-name Hello ¥--role-name MyApp ¥--runtime python3.6 ¥--handler app.handler ¥--zip-file fileb://app.zip
![Page 55: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/55.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
deploy.zip
Chalice Runtime
Your Application Code
Third Party Package Dependencies
![Page 56: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/56.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 57: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/57.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
deploy.zip
Chalice Runtime
Your Application Code
Third Party Package Dependencies
![Page 58: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/58.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
deploy.zip
Chalice Runtime
Your Application Code
Third Party Package Dependencies
![Page 59: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/59.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ file cryptography/hazmat/bindings/_openssl.so
hazmat/bindings/_openssl.so: Mach-O universal binary with 2 architectures:
[i386:Mach-O bundle i386] [x86_64:Mach-O 64-bit bundle x86_64]
bindings/_openssl.so (for i386): Mach-O bundle i386
bindings/_openssl.so (for x86_64): Mach-O 64-bit bundle x86_64
pip install cryptography
![Page 60: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/60.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
$ file cryptography/hazmat/bindings/_openssl.so
hazmat/bindings/_openssl.so: Mach-O universal binary with 2 architectures:
[i386:Mach-O bundle i386] [x86_64:Mach-O 64-bit bundle x86_64]
bindings/_openssl.so (for i386): Mach-O bundle i386
bindings/_openssl.so (for x86_64): Mach-O 64-bit bundle x86_64
pip install cryptography
![Page 61: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/61.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 62: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/62.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Python Packaging
![Page 63: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/63.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
deploy.zip
![Page 64: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/64.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 65: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/65.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
![Page 66: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/66.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
![Page 67: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/67.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
![Page 68: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/68.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
Amazon CloudWatch Logs
![Page 69: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/69.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
Amazon VPC
![Page 70: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/70.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
AWS Lambda
Amazon API Gateway
Permissions
![Page 71: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/71.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
Amazon DynamoDB
![Page 72: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/72.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
![Page 73: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/73.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS IAM Policy Generation
![Page 74: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/74.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
import boto3from chalice import Chalice
app = Chalice(app_name='test-policy')client = boto3.client('dynamodb')
@app.route('/')def list_tables():
return client.list_tables()
![Page 75: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/75.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
client = boto3.client('dynamodb')
![Page 76: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/76.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
client.list_tables()
![Page 77: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/77.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Run the Auto Policy Generator
$ chalice gen-policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["dynamodb:ListTables"],
"Resource": ["*"],
"Sid": "30b6e077c9314011a8406dc262185caf"
}
]
}
![Page 78: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/78.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Caveat
• Experimental
• Use as a starting point
• Can specify your own IAM policy file to use
• Also specify a specific IAM Role ARN to use
![Page 79: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/79.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 80: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/80.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Wrapping Up
Overview of Chalice
Deployment
Python Packaging
IAM Policy Generation
![Page 81: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/81.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Next Steps
Try out AWS Chalice! https://chalice.readthedocs.io/en/latest/
Create feature requests: https://github.com/aws/chalice
AWS Chalice Workshop Next
![Page 82: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/82.jpg)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
![Page 83: Deep Dive on AWS ChaliceDeep Dive on AWS Chalice A Serverless Microframework for Python James Saryerwinnie | @jsaryer Senior Software Development Engineer Amazon Web Services ... AWS](https://reader033.vdocuments.us/reader033/viewer/2022042807/5f78b0ec3de4946a757a97cc/html5/thumbnails/83.jpg)
Thank you!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
James Saryerwinnie
@jsaryer