user1990406
user1990406

Reputation: 659

post json directly to amazon s3 bucket from ionic/angular front end

I am struggling to figure out how, or if possible, I can post/put data into an aws s3 bucket from an angular/ionic application...

I have a mobile application that has two surveys, one for before using the product, second for after using the product... after both surveys I want to just dumb the data in an aws bucket. The amount of data is pretty small... about 50 surveys are expected each with basic text answers to ~20ish questions.

Does anyone have any idea how I can do this in ionic/angular or any front end? Do I need to convert it to a file somehow and then post that?

Any help is appreciated

Upvotes: 0

Views: 1152

Answers (1)

You can upload a JSON object directly to a bucket in s3. You don't have to upload it through a file, although I have no idea how to do it in Ionic/Angular, here is sample of how it is done in Node.

s3.putObject({Bucket: 'bucket_name',Key: 'my_products.json',Body: JSON.stringify(products), ContentType: "application/json"},function(err, data){console.log(JSON.stringify(err)+" "+JSON.stringify(data));});

Upvotes: 1

Related Questions