How should one use the HttpAlbIntegration for HttpApi on API Gateway v2 library?
At current, my application does indeed build and deploy. However, when I query requests.get(endpoint/ping)
the response is 'Healthy Connection'. In truth, I defined a JSON response, where {"status": "ok"} should be returned.
Here's a method FastAPI application hosted on Fargate tasks:
# Health check route
@router.get("/ping", status_code=status.HTTP_200_OK)
async def ping():
logging.info(f"ping request received.")
# SageMaker will ping this to check if the endpoint is healthy
return JSONResponse({"status": "ok"})
In CDK, I define my integration as
// Create the HTTP ALB Integration
const albIntegration = new apigwv2_integrations.HttpAlbIntegration(`AlbIntegration-${props.stageName}`,
listener,
);
// Create the HTTP API with the integration
this.httpApi = new apigwv2.HttpApi(this, `HttpApi-${props.stageName}`, {
defaultIntegration: albIntegration,
});
My theories are
- A VPC Link is needed and the listener object is insufficient.
- Some parameters are needed to ensure that API Gateway does not modify responses
- Some other explanation
HttpApi HttpAlbIntegration
Can I get clarification and cause/resolution here and proper usage of HttpAlbIntegration?