AWSHowToJava

Wiremock on AWS Elastic Beanstalk

You need a Wiremock and you need it fast!

You have no time to setup a server to run it on!

Behold.. Wiremock on Elastic Beanstalk

 

 

  1.  Download the wiremock standalone jar: http://wiremock.org/docs/running-standalone/ and put it in a separate folder
  2. Run it locally on port 5000: java -jar wiremock-standalone-2.25.0.jar --port 5000
    • Why 5000? It’s the default port that Elastic Beanstalk uses to serve Java applications
  3. To allow you to specify the –port option you have to give Elastic Beanstalk a Procfile
    • touch Procfile
    • in the Procfile enter web: java -jar wiremock-standalone-2.25.0.jar --port 5000
  4. Bundle the jar and Procfile into a zip
    • zip -r wiremock.zip wiremock-standalone-2.25.0.jar Procfile
  5. Create a new environment in elastic beanstalk with the wiremock.zip as uploaded code.
  6. A few minutes later your wiremock will be available!

 

Test it out!

Create a stub.

And try it out.

Hooray!

 

Resources: https://medium.com/@autumn.bom/deploying-spring-boot-jar-application-on-beanstalk-java-se-platform-45d8d04608ae

 

Leave a Reply

Your email address will not be published.