mardi 5 mai 2015

REST GET Request to AWS EC2

In short, I am looking to use Appery.io REST APIs to connect to an AWS EC2 instance, read from S3, and then respond back to Appery.io. Here is the process that I am trying to accomplish:

  1. Connect to EC2 by calling the correct EC2 URL with a "GET 1" request from Appery.io's dashboard (see sudo code below)
  2. EC2 gets the S3 Object, "1" (I have this code written)
  3. EC2 responds to the GET request with data associated with Object "1"

Here is some sudo code for what I want to accomplish:

// Initialization:
From Appery.io dashboard, call the EC2 instance via REST GET request (see pictures below)

// Server Code:
var request = listen(REST requests)
if request == "GET"
  var object = request.param[0] // in the "GET 1" example, this would return "1"
  var response = S3.getObject(object) // I have this code already written
return response

For reference, here are pictures of Appery.io's Dashboard:

enter image description here enter image description here enter image description here enter image description here enter image description here

Notes:

  • I am using Node.js on the server side
  • I tried going through the Amazon REST documentation, but I found it confusing and outdated.

Bonus points from me: What would be different if I wanted to issue a POST request as well to update the S3 database? Note that I also, have this code written on my EC2 server, I just need to call the url proper REST url from Appery.io.

Thank for so much for looking into this question. In advance, I greatly appreciate your time and assistance.




Aucun commentaire:

Enregistrer un commentaire