日本語ファイル名処理エラー - lucen2k/python GitHub Wiki

エラー

[ERROR]	costs.py	137	
{
    "status": "error",
    "message": "cannot import from S3:costs/park.%E8%B2%BB%E7%94%A8%E3%83%9E%E3%82%B9%E3%82%BF.csv An error occurred (404) when calling the HeadObject operation: Not Found"
}

対応

from urllib.parse import unquote_plus

...

def lambda_handler(event, context):
    for record in event['Records']:
        bucket = record['s3']['bucket']['name']
        key = unquote_plus(record['s3']['object']['key'])

結果

[DEBUG] controller.py 76 costs/park.費用マスタ.csv

参考:https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/with-s3-example-deployment-pkg.html