[AWS] Lambda by Python
当前统治数据分析的语言还是Python,还是暂时走:Python + GPU的常规路线好了。
numba, pyculib (分装了cublas)
Ref: Intro to AWS Lambda with Python | AWS Lambda Python Tutorial
AWS Lambda with Python calls S3
创建lambda函数
修改为python环境
注意将Runtime改为Python3.7

进入IDE
自动提供了基本模板代码。

测试模板代码
右上角"Test"按钮,打开测试模板代码。

Python Lambda --> S3
代码展示
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
}
IAM --> Role
给lambda添加访问S3特定数据的权限。
AWS Lambda with Python calls DynomoDB
创建lambda函数 - get_item
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
}
IAM --> Role
给Lambda添加访问DynamoDB特定数据的权限。
然后就能获得数据。

创建lambda函数 - put_item
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 */
[AWS] Lambda by Python的更多相关文章
- [翻译] 比较 Node.js,Python,Java,C# 和 Go 的 AWS Lambda 性能
[翻译] 比较 Node.js,Python,Java,C# 和 Go 的 AWS Lambda 性能 原文: Comparing AWS Lambda performance of Node.js, ...
- AWS Lambda
AWS Lambda 知识点总结 参考资料:Amazon 名词解释: 事件驱动型计算服务:通过事件来触发的计算服务 Amazon S3存储桶:一项面向Internet的存储服务,可以通过S3 随时在W ...
- Automated EBS Snapshots using AWS Lambda & CloudWatch
Overview In this post, we'll cover how to automate EBS snapshots for your AWS infrastructure using L ...
- How to return plain text from AWS Lambda & API Gateway
With limited experience in AWS Lambda & API Gateway, it's struggling to find the correct way to ...
- Qwiklab'实验-API Gateway, AWS Lambda'
title: AWS之Qwiklab subtitle: 2. Qwiklab'实验-API Gateway, AWS Lambda' date: 2018-09-20 17:29:20 --- In ...
- 使用AWS Lambda,API Gateway和S3 Storage快速调整图片大小
https://www.obytes.com/blog/2019/image-resizing-on-the-fly-with-aws-lambda,-api-gateway,-and-s3-stor ...
- 什么是AWS Lambda?——事件驱动的函数执行环境
AWS CTO Werner Vogels在AWS re:Invent 2014大会的第二场主题演讲上公布了两个新服务和一系列新的实例,两个新服务都相当令人瞩目:第一个宣布的新服务是Amazon EC ...
- AWS Lambda 借助 Serverless Framework,迅速起飞
前言 微服务架构有别于传统的单体式应用方案,我们可将单体应用拆分成多个核心功能.每个功能都被称为一项服务,可以单独构建和部署,这意味着各项服务在工作时不会互相影响 这种设计理念被进一步应用,就变成了无 ...
- python_way,day3 集合、函数、三元运算、lambda、python的内置函数、字符转换、文件处理
python_way,day3 一.集合 二.函数 三.三元运算 四.lambda 五.python的内置函数 六.字符转换 七.文件处理 一.集合: 1.集合的特性: 特性:无序,不重复的序列 如果 ...
随机推荐
- 卷积神经网络cnn的实现
卷积神经网络 代码:https://github.com/TimVerion/cat 卷积层 卷积层:通过在原始图像上平移来提取特征,每一个特征就是一个特征映射 原理:基于人脑的图片识别过程,我们可以 ...
- 漏洞挖掘技巧之利用javascript:
好久没更新博客了,更新一波. 场景: window.location.href=”” location=”” location.href=”” window.location.* 常见地点:任何二次跳 ...
- 基于Taro与Typescript开发的网易云音乐小程序
基于Taro与网易云音乐api开发,技术栈主要是:typescript+taro+taro-ui+redux,目前主要是着重小程序端的展示,主要也是借此项目强化下上述几个技术栈的使用,通过这个项目也可 ...
- Delphi - cxGrid字段类型设定为ComboBox 并实现动态加载Item
cxGrid设定字段类型为ComboBox 在cxGrid中选中需要设定的字段: 单击F11调出属性控制面板,在Properties下拉选项中选中ComboBox,完成字段类型的设定. cxGrid ...
- 【故障公告】再次出现数据库 CPU 居高不下的问题以及找到问题的线索
非常非常抱歉,今天上午的故障又一次给大家带来麻烦了,再次恳请大家的谅解. 在昨天升级阿里云 RDS SQL Server 实例的配置后(详见昨天的博文),万万没有想到,今天上午更高配置的阿里云 RDS ...
- CodeForces-38B-Chess枚举+思维
CodeForces-38B-Chess 这是一道与下象棋有关的题目,题意是给你一个车和马的坐标,然后再给你一个马,让你判断最后三者都不会被吃掉的可能性,注意的是三者是三个独立的个体. 这道题要知道一 ...
- CodeForces 758 D Ability To Convert
Ability To Convert 题意:给你一个n进制的60位的数,但是由于Alexander只会写0->9,所以他就会用10来表示十而不是A(假设进制>10); 题解:模拟就好了,先 ...
- Educational Codeforces Round 68 Editorial
题目链接:http://codeforces.com/contest/1194 A.Remove a Progre ...
- php preg_match pcre回溯绕过
原理需要知识:正则NFA回溯原理,php的pcre.backtrack_limit设置. 正则NFA回溯原理正则表达式是一个可以被"有限状态自动机"接受的语言类."有限状 ...
- 关于Ubunto在VMwark中无法全屏。
1.右键点击Ubunto桌面,进入终端 输入: 1.sudo apt-get install open-vm* 安装依赖项 2.sudo apt-get install open-vm-tools ...