Subramanyam G
Subramanyam G

Reputation: 21

How to deploy spring boot rest project to private AWS API GATEWAY?

I have a spring boot rest project which is running successfully, and I am getting success response on http://localhost:8080/students. How can I expose this SpringBoot REST API into a private AWS API GATEWAY? I have to expose the REST API service, and I have to give the endpoints to the client, to access this service. I have no idea how to present and create endpoints in AWS API GATEWAY!

Upvotes: 2

Views: 4171

Answers (1)

GiorgosDev
GiorgosDev

Reputation: 1767

API Gateway will work as mediator between clients and your application. So in the first place your application should be exposed so AWS Gateway could make a call to it.

If you are running application on your local pc you need to expose it to Internet by setting static IP and openning corresponding ports in firewall if you have one. This may works for debug/testing purpose, but in general it is bad because you will expose your application to Internet and client services would have possibility to connect to it directly, instead of gateway.

Other and more proper on my opinion would be to run your application in AWS EC2 instance or in AWS beanstalk. In this case you can configure private endpoint for your application and make it available only through API Gateway. Here you can find more details https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-private-endpoints/

So let's suppose you have your application up and running and available for API Gateway. In this case you will need to perform :

  1. Create API in API Gateway

  2. Create resources, i.e. path /user would be user resource

  3. For each resource create a method, i.e. GET, POST, etc. Select integration type HTTP for your methods and set the endpoint it will use
  4. Deploy API to staging

Upvotes: 3

Related Questions