【发布时间】:2021-03-06 03:31:13
【问题描述】:
import boto3
import json
s3 = boto3.client('s3')
def lambda_handler(event, context):
bucket = "cloud-translate-output"
key = "key value"
try:
data = s3.get_object(Bucket=bucket, Key=key)
json_data = data["Body"].read()
return{
"response_code" : 200,
"data": str(json_data)
}
except Exception as e:
print (e)
raise e
我正在使用 xcode 制作 ios 应用程序。 我想使用aws按照app-api gateway-lambda-s3的顺序将数据从s3带到app。但是有没有办法在app中使用api使用api的数据,如果我将此数据上传到s3的1号桶,cloudformation会翻译上传的文本文件并自动将其保存到2号桶,我想将存储在2号存储桶中的文本数据文件通过lambda而不是键值导入应用程序,有没有办法只使用存储桶的名称?
【问题讨论】:
标签: amazon-web-services amazon-s3 aws-lambda amazon-cloudformation translate