Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Application on Amazon Web Services with Mobile and Web Clients

Our new start-up company is trying to build a mobile app with an accompanied website. We are trying to setup our application on Amazon Web Services.

We have Java code running in an EC2 instance, which will store data in S3. We want clients (iOS and Web for now) to communicate with the Java Backend via a REST API. Ideally the website would be hosted under the same AWS account.

The Java Code and REST API are already set up in a very basic form, but the setup of the Website is unclear, since this is new to us all. We also would like to evaluate beforehand if such a setup is even feasible.

Since I am in charge of the Website i have already spend hours researching this specific setup, but i simply lack experience in cloud/backend development to come to a conclusion.

Here are some questions we would like to answer:

  • Where would the HTML files and accompanied JavaScript etc. files be stored?
  • How can data (images etc.) that is stored within S3 by the JAVA code be accessed from the Website directly?
  • How could something like bootstrapping of data within HTML files be achieved (in JSON format preferably)?
  • How could the server be set up to compress certain files like CSS or JavaScript?

Please point me into the right direction, any comment is appreciated.

like image 607
bendulum Avatar asked Feb 18 '26 03:02

bendulum


1 Answers

Where would the HTML files and accompanied JavaScript etc. files be stored?

Either on the same AWS EC2 box or a different one, just give it a static IP and link that IP to the domain you want, done. Just remember to have port 80 open as a firewall rule.

How can data (images etc.) that is stored within S3 by the JAVA code be accessed from the Website directly?

The files will have some url that you can link to directly in your html so it's essentially just a url.

How could something like bootstrapping of data within HTML files be achieved (in JSON format preferably)?

You have a number of choices here. You could potentially create some JSP files to generate the HTML and load the JSP files on access and cache them so they load up super fast. You could argue however, this is overkill and in some ways, the REST endpoint should be robust enough to handle the requests.

Part of me thinks you should endeavor to use the REST API for this information so you just have to manage one endpoint, why make an extra endpoint or over engineered solution for the HTML that you then have to maintain? Build once and reuse.

How could the server be set up to compress certain files like CSS or JavaScript?

During the build process, run the files through a minify process. This is built into maven so you could do it automatically or by hand using something like jscompress. This Minify plugin shows how to automatically minify your resources. Consider you'll need to be using Maven though as your build tool.

like image 120
david99world Avatar answered Feb 20 '26 15:02

david99world



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!