当前统治数据分析的语言仍是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 */