- Newest
- Most votes
- Most comments
You're correct that HTTP API is generally more cost-effective than REST API for simple use cases like yours. However, you've identified a key limitation - HTTP API doesn't currently support direct integration with Kinesis Firehose.
Given your requirements, here are a few options you could consider:
-
Keep using REST API with Firehose: If the cost difference isn't prohibitively high, this might still be the simplest solution, especially if it's already working well for you.
-
Use HTTP API with Kinesis Data Streams (KDS): While this doesn't align perfectly with your current setup, it could be a viable alternative. You'd need to set up a process to move data from KDS to Firehose or directly to S3.
-
Use HTTP API with a Lambda function: You could set up an HTTP API that triggers a Lambda function. The Lambda function would then write to Firehose. This adds a small amount of complexity but allows you to use the more cost-effective HTTP API while still leveraging Firehose.
-
Direct client-to-Firehose: If possible, consider having your clients write directly to Firehose, bypassing API Gateway entirely. This would require careful management of credentials and permissions.
-
Use Amazon EventBridge: You could set up an HTTP API endpoint that sends events to EventBridge, which can then be configured to send data to Firehose.
Each of these options has trade-offs in terms of cost, complexity, and scalability. The best choice depends on your specific requirements, expected traffic volume, and willingness to manage additional components in your architecture.
If cost is the primary concern and you don't need the additional features of REST API, option 3 (HTTP API with Lambda) might provide a good balance of cost-effectiveness and simplicity while allowing you to continue using Firehose.
Sources
HTTP API Gateway direct integration with Kinesis Data Stream | AWS re:Post
aws-apigateway-kinesisstreams - AWS Solutions Constructs
Ingest telemetry messages in near real time with Amazon API Gateway, Amazon Data Firehose, and Amazon Location Service | AWS Big Data Blog
Hey, great question, and yes, you're totally right: API Gateway REST APIs are significantly more expensive than HTTP APIs, especially at scale. If you don’t need features like usage plans, authorizers, or fine-grained throttling, HTTP APIs are a much better fit for your use case.
You're also right that HTTP APIs don’t support direct integration with Kinesis Firehose — they only support Kinesis Data Streams (KDS), which isn’t ideal for your S3 delivery model.
Workaround: Use HTTP API → Lambda Proxy → Firehose One popular, low-cost pattern is:
HTTP API → Lambda (minimal logic) → Firehose → S3
Here’s why this works well: HTTP API: Cheaper, simple, and still gives you a clean POST endpoint for tracking events. Lambda: Lightweight proxy (can be as short as 10–15 lines of code) that takes the request and pushes the payload to Firehose. Firehose: Continues to handle batching and delivery to S3 as usual.
This pattern is:
Way cheaper than using REST API
Still scales well, especially if the Lambda is short-lived and stateless.
Gives you control to pre-process, enrich, or filter if needed later.
Example Python Lambda handler (just to show how light it can be):
import boto3 import json firehose = boto3.client('firehose') def lambda_handler(event, context): payload = event['body'] # Raw JSON string response = firehose.put_record( DeliveryStreamName='your-firehose-stream', Record={'Data': payload + '\n'} ) return { 'statusCode': 200, 'body': json.dumps({'message': 'Event received'}) }
Additionally, Use Lambda Function URLs if you want to bypass API Gateway entirely. https://docs.aws.amazon.com/lambda/latest/dg/urls-intro.html
answered a year ago
