A few days ago I started building an iOS app that would be using a REST API to retrieve and store data. This REST API would be a server application that I also have to build. Since I am familiair with Java and Spring I decided to use Spring Boot as framework. To be able to use it with my iPhone it would be nice if I could run it on a server instead of my own development PC, so for this I choose AWS since I know how to use that. The only thing I hadn’t figured out yet was what would be the easiest way to get my Spring Boot application running on an AWS EC2 instance…
Well, that appeared to be Boxfuse! I never heard of this platform before but it turned out to be so easy to use that I cannot imagine there could be an easier way to get your (SpringBoot) application running in the cloud on AWS. You can choose to download the client and configure it or use the Maven plugin. Either way it just takes a simple command to get your application running on AWS (or a local VirtualBox). I haven’t looked into the more advanced options like database access and load balancing but as stated in their blog this should all be possible and just as easy to set up. I will definitely dig further into this and let you know my findings.
If you want to check this out it is as easy as the following steps:
- Create your Spring Boot REST application
- Set up your AWS account
- Set up your Boxfuse account
- Modify the pom.xml and get it running
Create your Spring Boot REST application
Just follow the steps as described here. I chose the Maven option since I know that best. After following these steps you should have a REST API running on your localhost.
Set up your AWS account
If you don’t have an account yet get one. It will be free for the first year if your consumption stays within certain boundaries, read more about it here. After setting this up you should be able to see the AWS Management Console.
Set up your Boxfuse account
When signing up for Boxfuse you will need a GitHub account. If you are one of the few developers that doesn’t have such account yet you can sign up here (also free). Now you are able to get a Boxfuse account and set it up. When that is done you are ready for the last step.
Modify the pom.xml and get it running
Go back to your Spring Boot application and open the pom file. Add the following to it:
<pluginRepository> <id>boxfuse-repo</id> <url>https://files.boxfuse.com</url> </pluginRepository> <plugin> <groupId>com.boxfuse.client</groupId> <artifactId>boxfuse-maven-plugin</artifactId> <version>188.8.131.528</version> <configuration> <user>your-boxfuse-client-user</user> <secret>your-boxfuse-client-secret</secret> </configuration> </plugin>
Now in your Terminal simply run the Maven command:
mvn boxfuse:run -Dboxfuse.env=test
Within a minute you will see that there is an EC2 instance added to your AWS Console and you can access the API in your browser:
So with having this process as easy as this you can completely focus yourself on developing functionality instead of investigating how to get thing deployed and running!