當前統治數據分析的語言仍是Python,仍是暫時走:Python + GPU的常規路線好了。html
numba, pyculib (分裝了cublas)python
Ref: 使用 Python 構建 Lambda 函數json
Ref: Intro to AWS Lambda with Python | AWS Lambda Python Tutorialapp
注意將Runtime改成Python3.7ide
自動提供了基本模板代碼。函數
右上角"Test"按鈕,打開測試模板代碼。測試
import json import boto3 s3 = boto3.resource('s3') def lambda_handler(event, context): bucket_list = [] for bucket in s3.buckets.all(): print(bucket.name) bucket_list.append(bucket.name)
return { 'statusCode': 200 'body': bucket_list }
給lambda添加訪問S3特定數據的權限。spa
import json import boto3 dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('planets') def lambda_handler(event, context): response = table.get_item( Key={ 'id': 'mercury' } ) print(response) return { 'statusCode':200, 'body':response }
給Lambda添加訪問DynamoDB特定數據的權限。3d
而後就能得到數據。code
import json import boto3 dynamodb = boto3.resource('dynamodb') table = dynamodb.Table('planets') def lambda_handler(event, context): response = table.put_item( Item={ 'id': 'neptune', 'temp': 'super cold' } ) response = {
'message': 'Item added'
} return { 'statusCode':200, 'body': response }
/* continue */