What Elastic Beanstalk Environment should I choose?

Viewed 105

My job is to move our existing java calculation (servlet as WAR file) from our own server to AWS. This is a calculation without user interface or database. Other companies should be able to call the calculation in their programs. The servlet takes a post request with Json payload and the response sends Json payload back to client after the calculation is performed. The calculation is relatively heavy and therefore time-consuming (1-2 sec.).

I have decided to use AWS Elastic Beanstalk for the cloud computing but I'm in doubt as to what EB Environment to use - Server or Worker environment? and if I should use AWS API Gateway in front of EB?

Hopefully somebody can clarify this for me.

1 Answers

Worker environment produces an SQS queue where you submit your jobs into. To enable access to it from outside of AWS you would have to front it with API Gateway (preferred way).

However, the worker environment works in asynchronous way. It does not return job results to the caller. You would need to have some other mechanism for your clients to get the results back, e.g. though different API call.

An alternative is web environment where the clients get the response back directly from your json processing application. 1-2 seconds is not that long of a wait for an HTTP request.

For more complex solution based on EB, one could look at Creating links between Elastic Beanstalk environments. You would have a front-end environment for your clients linked with worker environment that does the json job processing.

The other way would be to rewrite the app into lambda, if possible of course. Lambda seems as a good fit for 1-2 seconds processing tasks.

Related