0
私はから読み取るように、1行ずつレスポンスの内容を読み込むにはどうすればいいですか?aws lambda
を使用してs3に格納されたcsvファイルをロードします。アマゾンラムダのレスポンス['Body']からデータを解析する方法
reader = csv.reader(f)
for line in reader:
#do something
line[1] = line[1].lower()
ラムダ関数:あなたのための
import urllib
import boto3
print('Loading function')
s3 = boto3.client('s3')
def lambda_handler(event, context):
bucket = event['Records'][0]['s3']['bucket']['name']
key = urllib.unquote_plus(event['Records'][0]['s3']['object']['key'].encode('utf8'))
response = s3.get_object(Bucket=bucket, Key=key)
content = response['Body'].read()
#read content line by line as a list