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 réponses
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

répondu il y a 2 ans
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
EXPERT
Uri
répondu il y a 2 ans
profile picture
EXPERT
vérifié il y a 17 jours

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions