Upload data to S3 using lambda

0

I am currently working on a mobile app on which we have implemented data storage in S3 bucket. What we are currently doing is that we are generating presigned url from lambda and then sending it to the react native app on front end from where we upload the data.

The difficulty we are facing is that as we can have upto 10-15 files at a given time and it will affect the user experience of the mobile app. So, is there any way we can upload the files to S3 bucket from lambda instead of doing from front end?

2개 답변
1

This may not be what you're looking for, but I use python and you may be using the same functions on your front end, so this may help you. Not sure.

Here's what I'm doing:

mb = 1024 ** 2

config = TransferConfig(multipart_threshold=1024 * 25, max_concurrency=int(psutil.cpu_count() / 2),
                        multipart_chunksize=1024 * 25, use_threads=False)

try:
    upload_file_response = s3.upload_file(source, destination, key, Config=config)

There's an article that mentions you can limit the bandwidth of the connection you're using in the TransferConfig class options. Here's that article: Again, this may or may not help you. Sorry if it doesn't.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/customizations/s3.html#boto3.s3.transfer.TransferConfig

답변함 2년 전
0

Not sure what you are concerned about. Is it the fact that you need to generate 10-15 pre-signed URLs? What about it? The time it takes?

You can always generate all the URLs in a single API call. Also, if you are using Cognito user pools to authenticate the users, you can also associate an Identity pool, obtain AWS credentials on the client and generate the pre-signed URLs there, saving on the network round trip.

Finally, you can upload the files to Lambda that will save to S3. Not sure it will be quicker. Note that Lambda has a 6MB payload size limit.

profile pictureAWS
전문가
Uri
답변함 2년 전
profile picture
전문가
검토됨 23일 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠