Create a custom SpringBoot based API Gateway or use AWS API Gateway?

0

Hi!

I have already a working app deployed in AWS and I'm using an API gateway with OpenAPI approach and is done in SpringBoot. So far is working super good and everything goes smooth. Now I need to create another stack of services that will be part of my main app, but since those services will manage a completely different things I need to create a new API Gateway to manage only that part.

I did some tests trying to use an AWS Gateway using it on my (IAC) but I found a little bit difficult to configure with an OpenAPI approach in the OpenAPI contract. Also I found a little bit difficult to configure it with my Cognito user pool authorizer to authorize the requests with the accessToken. For the other hand, in my already existing SpringBoot API gateway I have more control of everything.

What is the best approach? Create another SpringBoot based API Gateway? Or use AWS Gateway?

1 Answer
0

Hi

API Gateway allows for the rapid definition of APIs without the need for extensive coding, making use of serverless technologies to streamline API development on AWS. Please refer this blog below to understand how you can implement as per Open API standards.

https://aws.amazon.com/blogs/opensource/create-restful-apis-on-aws-with-openapi-specification-with-no-coding/

Additional benefits of Amazon API Gateway include flexibility in defining security controls, scalability and monitoring. For your specific use-case, it can also help avoid frequent patching & upkeep of your spring boot api gateway.

Thanks

profile pictureAWS
Rama
answered 3 months ago
  • And how can I define in my OpenAPI contract the internal endpoints to which the request should be redirected? I saw this x-amazon-apigateway-integration for the OpenAPI contract, but I didn't find any examples for Rest type APIs, only for Lambdas

  • If my understanding is right, you are looking to a custom backend e.g. an http service on EC2 instance etc. In this case you could use x-amazon-apigateway-integration as an extension to your Open API definition as below [I have extended the example provided on the blog] PLease adapt it as per your usecase. I hope this clarifies.

    /equipment:

    get:
      summary: List all my sports equipment
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: '200'
        requestParameters:
        uri: http://<domain>/itemstore/items
        passthroughBehavior: when_no_match
        httpMethod: GET
        type: http
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions