I want to integrate AWS ECS with API Gateway (REST API) without using NLB, lambda, or any other service.

0

I want to integrate my ECS cluster services with the API gateway, but I don't want to use NLB or any other service in between, like lambda, etc.

3 Answers
0
profile pictureAWS
EXPERT
answered 7 months ago
0

If your ECS cluster is private, i.e., you can't access it from the internet, then you need to use VPC Link from API Gateway to get into the VPC. If you are using REST API, it only supports NLB. If you are using an HTTP API, you can use an NLB, ALB or CloudMap (which may be what you want).

If your cluster is exposed to the internet, you can connect API Gateway directly to it, but, API Gateway is not a load balancer, so you will only be able to connect it to a single instance. Also, if your service is exposed to the internet, users can bypass it and access the service directly, so it is not recommended.

profile pictureAWS
EXPERT
Uri
answered 7 months ago
0

Here's how to integrate AWS ECS with API Gateway (REST API) using a private integration, without NLB, Lambda, or other services:

►Prerequisites:

  • An ECS cluster with a running service.

  • An API Gateway with a REST API defined.

  • VPC Setup: Both your ECS cluster and API Gateway must be within the same VPC (Virtual Private Cloud).

►Steps:

• Create a VPC Link:

  1. In the API Gateway console, navigate to VPN Links.
  2. Click Create.
  3. Provide a name for the link and choose your VPC from the dropdown menu.
  4. Click Create

• Configure Private Integration:

  1. Go to your REST API in API Gateway.
  2. Select Resources and choose the resource you want to integrate with your ECS service.
  3. Click Actions and select Create Method.
  4. Choose your desired HTTP method (e.g., GET, POST).
  5. Under Integration Type, select Private integration.
  6. For Integration HTTP Method, choose the method your ECS service expects (likely POST).
  7. Under Endpoint Type, select VPC Link.
  8. Choose the VPC Link you created in step 1.
  9. For Target, use the following format: arn:aws:ecs:${region}:${account-id}:cluster/${cluster-name}/service/${service-name}:${revision}. Replace the placeholders with your specific information.
  10. Click Save.

►Explanation:

This approach directly connects your API Gateway to your ECS service within the same VPC. API Gateway requests are routed through the VPC Link to your ECS service, bypassing the need for an NLB or Lambda function.

If you want to know about more information then you can check this-: https://www.nimbleappgenie.com/blogs/aws-marketplace-integration/

profile picture
answered a month ago

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