Amazon API Gateway vs Amazon SQS
Discover how Amazon API Gateway compares to Amazon SQS, and understand which is right for your use case, based on dimensions such as core features, pricing, reliability, and scalability.
What is Amazon API Gateway?
Amazon API Gateway is a pay-as-you-go service for building, deploying, and managing RESTful APIs and WebSocket APIs. It handles traffic management, CORS support, access and authentication, version management, and more.
Suitable for:
- Realtime chat applications
- Online collaborative apps
- Multiplayer gaming
- Realtime analytics
- Monitoring services
Not suitable for:
- Heavy data transfers
Pros:
- Pre-built adapters
- Fine-grained security features
- Scalable
- Multiple SDKs
Cons:
- Complex setup
- Learning curve
- Enterprise-focused
What is Amazon SQS?
Amazon Simple Queue Service (SQS) is a fully managed messaging queuing service which enables decoupling and scaling of distributed systems. It is secure, reliable, and suitable for handling asynchronous communication between software components, which ensures that messages are not lost and are processed efficiently.
Suitable for:
- Scaling microservices
- Message processing
- Transaction processing
- Job queues
Not suitable for:
- Long message retention
- Large message sizes
Pros:
- Message locking
- Near infinite scalability
- Reliable delivery
- Dead-letter queues
- Reduced overhead
Cons:
- High cost at scale
- Vendor lock-in
- No support for routing
- Short message retention
Compare Amazon API Gateway and Amazon SQS
Let’s compare Amazon API Gateway and Amazon SQS, looking at key dimensions such as their core features, pricing, integrations, QoS, performance, and security and compliance.
Disclaimer:This comparison was created based on documentation and resources freely available online about Amazon API Gateway and Amazon SQS. The content was last updated on 10 Oct 2024 for Amazon API Gateway and on 16 Aug 2024 for Amazon SQS. Be sure to double-check everything before you make any decisions. If you do find anything incorrect or out of date, then please contact us.
Core features | |||
Pub/Sub messaging | Reduces communication code complexity, simplifying the process of building highly functional and architecturally complex realtime apps. | Amazon API Gateway No | Amazon SQS No AWS SQS is a queueing system and not a pub/sub messaging system. |
Chat capabilities | Accelerates the time to implement rich chat experiences with features such as read receipts, typing indicators, and more. | Amazon API Gateway Partial API Gateway does not natively support chat capabilities. However, this can be achieved using different AWS services like Lambda and DynamoDB. | Amazon SQS No |
Collaboration capabilities | Enables you to quickly integrate realtime collaborative features like live cursors, member location, avatar stacks, and component locking. | Amazon API Gateway Yes | Amazon SQS No |
State sync capabilities | Enables realtime data synchronization across devices and users, ensuring a cohesive and up-to-date user experience. | Amazon API Gateway Partial API Gateway does not natively support state synchronization, but it can be achieved through integration with services like Amazon DynamoDB, AWS AppSync, AWS Lambda, and Amazon S3. | Amazon SQS Partial AWS SQS can be implemented with AWS AppSync which supports real-time data synchronization using GraphQL subscriptions. This allows UI updates to reflect changes in the underlying data store (like DynamoDB or other databases) without the need for polling. |
Presence | Maintaining a view of which users are connected, and their associated metadata, enables their online status to be updated in realtime. | Amazon API Gateway No | Amazon SQS Partial Partially supported, requiring integration with other AWS services. |
Occupancy | High-level metrics about the clients currently connected to a channel make it simple to show things such as connected user count, or display which channels are the most popular. | Amazon API Gateway Partial API Gateway does not have built-in support for occupancy tracking. Occupancy tracking functionality requires integration with AWS Lambda, DynamoDB, or ElastiCache. | Amazon SQS No |
Message interactions | Enables interaction with previously-sent messages, facilitating the implementation of features like message reactions and threads. | Amazon API Gateway Partial Message interactions are not natively supported in API Gateway. However, you can programmatically build interactions on the application layer with AWS Lambda. | Amazon SQS No |
Message history | Enables clients to catch up on missed messages when inactive, ensuring a user doesn’t miss any important messages. | Amazon API Gateway Partial You can custom build message history functionality on Amazon DynamoDB and Amazon S3, but it's not supported natively in API Gateway. | Amazon SQS Partial Amazon S3 can be used to archive past messages, while AWS AppSync can facilitate retrieving messages and syncing them with UI updates. However, managing message history may require additional custom development or integration. |
Push notifications | Cross-platform push notifications make it possible to deliver important and timely messages to users even when they’re inactive. | Amazon API Gateway Partial API Gateway doesn't natively support push notifications, but you can build them be integrating with Amazon SNS or AWS Amplify. | Amazon SQS Partial Amazon SQS can be integrated with AWS SNS to deliver push notifications based on events. |
Message delta compression | Minimizes bandwidth and can reduce latency, particularly in scenarios where continuous updates are sent. | Amazon API Gateway No | Amazon SQS No |
Programmatic management | Enables the automation of provisioning, management, and testing of service resources, simplifying integration with existing development workflows such as CI. | Amazon API Gateway Yes Fully supported through AWS SDKs, the CLI, and CloudFormation. | Amazon SQS Yes AWS provides comprehensive APIs and SDKs for programmatic management of its services. |
Pricing | |||
Free plan | With a free plan, you can test the service’s functionality and compatibility with your project before committing to a paid plan. | Amazon API Gateway Yes The Amazon API Gateway free tier includes one million API calls received for REST APIs, one million API calls received for HTTP APIs, and one million messages and 750,000 connection minutes for WebSocket APIs per month for up to 12 months. Read more | Amazon SQS Yes The Amazon SQS Free Tier offers up to 1 million requests per month at no cost for all customers for both standard and FIFO Queues. |
Pricing model | The pricing model should align with your project's expected load, usage patterns, and budget in order to be cost-effective and efficient. | Amazon API Gateway API Gateway has a free plan and a pay-as-you-go plan:
| Amazon SQS AWS SQS has a free tier and pay-as-you-go pricing model based on usage (number of queue requests and data transfer). Read more |
Integrations & interoperability | |||
SDKs | Supporting multiple languages and platforms offers greater flexibility when building cross-platform realtime apps. | Amazon API Gateway
| Amazon SQS
|
Supported realtime protocols | Support for multiple protocols provides the flexibility to choose a protocol that best suits your project’s requirements. | Amazon API Gateway
| Amazon SQS
|
Serverless functions | Enables integration with third-party cloud providers by facilitating the execution of custom code against messages to perform business logic like on-the-fly translation. | Amazon API Gateway
| Amazon SQS None natively; serverless functions are available through integration with AWS Lambda. |
Streaming & queueing | Provides a dependable method to reroute messages from the service to third-party streams and queues for further processing. | Amazon API Gateway | Amazon SQS Yes |
Observability services | Enables realtime monitoring and troubleshooting by offering insights into service behavior directly in your observability platform of choice. | Amazon API Gateway Yes Amazon API Gateway logs API calls, latency, and error rates to Amazon CloudWatch in your AWS account. | Amazon SQS Partial AWS SQS provides an integration with Amazon CloudWatch for monitoring usage and metrics. |
CI/CD tools | Makes it possible to provision and configure service infrastructure as part of a CI or CD pipeline, enabling repeatable and reliable deployments. | Amazon API Gateway Yes Supports:
| Amazon SQS Yes Supports:
|
Quality of Service | |||
Scalability | Scalability is vital as it ensures the service can handle increased data load or users without compromising performance. | Amazon API Gateway AWS API Gateway is scalable, supporting high connection rates, numerous routes and integrations, and long-lived connections without explicit concurrent connection limits. You can find more info on limits here. | Amazon SQS No published metrics are available. |
Guaranteed message delivery | Ensures messages are never lost during transmission, even in the presence of network disruptions. | Amazon API Gateway No | Amazon SQS Yes AWS SQS provides robust support for guaranteed message delivery, ensuring that each message is reliably delivered to its intended recipient. |
Guaranteed message ordering | Maintains the sequence of messages as they were sent. This is particularly important in apps where the chronological order of messages is essential for meaningful communication. | Amazon API Gateway No | Amazon SQS Yes For AWS SQS FIFO Queues, messages are delivered in the exact order they are sent, following a strict First-In-First-Out (FIFO) sequence. |
Exactly-once message delivery | Guarantees that each message is processed exactly once, preventing data inconsistencies that can arise from duplicate processing or missing messages. | Amazon API Gateway No | Amazon SQS Yes When using AWS SQS FIFO Queues, messages are delivered exactly once with no duplication. |
Performance & availability | |||
Uptime Guarantee | An uptime guarantee instills confidence in the reliability of the service and protects your business from the negative impacts of downtime. | Amazon API Gateway 99.95%. Read more | Amazon SQS 99.9%. Read more |
Global edge network | By bringing servers (Points of Presence, or PoP) geographically closer to the devices of end users, and routing requests to the nearest PoP, global latency is reduced to a minimum. | Amazon API Gateway Yes API Gateway API endpoints can be configured to be closer to where the majority of your traffic is originating from. Read more | Amazon SQS Yes |
Multi-region data replication (message durability) | By replicating data across multiple regions, the risk of data loss or downtime is greatly mitigated since if data is lost or a server fails in one region, the information can be retrieved from another. | Amazon API Gateway Partial API Gateway supports multi-region data replication only when integrated with Amazon CloudFront. Read more | Amazon SQS Partial AWS SQS provides high message durability within a single AWS region by replicating messages across multiple Availability Zones. But it does not natively support cross-region replication. For multi-region data replication, you can use additional strategies, such as using AWS services like AWS Lambda or AWS Data Pipeline to replicate messages from SQS queues in one region to SQS queues in another region. |
No single point of failure or congestion | Having no single point of failure means a system is resilient and can continue to operate even if one part fails. Avoiding a single point of congestion ensures messages flow efficiently across the system and avoids bottlenecks that could lead to performance issues under load. | Amazon API Gateway No | Amazon SQS Yes Messages in AWS SQS are distributed across various availability zones in a region, ensuring high availability and scalability. |
Latency | Low latency is crucial for realtime apps as it ensures swift and efficient data transmissions, providing a smoother and more responsive user experience. | Amazon API Gateway Unknown. | Amazon SQS Latencies for SendMessage, ReceiveMessage, and DeleteMessage API requests range from tens to low hundreds of milliseconds. |
Security & compliance | |||
API key authentication | Simplifies the authentication code on trusted servers compared to requesting, managing, and refreshing tokens. | Amazon API Gateway Yes | Amazon SQS Yes |
Token-based authentication | Provides a means to securely authenticate user devices against your user management system. | Amazon API Gateway Yes | Amazon SQS No AWS SQS does not directly support token-based authentication. Instead, AWS SQS relies on AWS Identity and Access Management (IAM) for authentication and authorization. |
Single Sign-On (SSO) authentication | SSO streamlines login processes, boosts security by minimizing password use, and meets compliance needs for secure data access management. | Amazon API Gateway Yes AWS API Gateway supports SSO by integrating with identity providers such as OpenID Connect (OIDC) and SAML. Read more | Amazon SQS Yes |
Rules for permissions and operations | Provides control over which users can subscribe and publish to certain channels. | Amazon API Gateway Yes Rules for permissions and operations can be configured using AWS Identity and Access Management. Read more | Amazon SQS Yes |
End-to-end encryption | Ensures that the data transmitted between the client and the API server remains confidential and secure while in transit. | Amazon API Gateway | Amazon SQS Yes |
Encryption at rest | Ensures data stored by the service is secure and compliant, while also mitigating the risks of a data breach. | Amazon API Gateway Partial It is possible to encrypt data at rest using AWS SDKs or AWS CLI when creating a file system. This is not done automatically. Read more | Amazon SQS Yes AWS SQS supports encryption at rest using AWS KMS (Key Management Service). |
Compliance | Compliance with regulations can impact your ability to meet legal obligations in your industry. | Amazon API Gateway
| Amazon SQS
|
Alternatives to Amazon API Gateway and Amazon SQS
While both Amazon API Gateway and Amazon SQS are worth considering as options for realtime experiences, they aren’t without their limitations. We suggest evaluating them against the following alternatives to make sure you find the right solution for your needs.
Alternatives to Amazon API Gateway
AWS AppSync enables developers to seamlessly handle and synchronize mobile app data in real-time across multiple devices and users.
Socket.IO is a library that provides realtime, bi-directional communication between clients and servers. It allows the management of connections, sending and receiving messages, and more.
Pusher is a first-generation pub/sub messaging service that provides bi-directional hosted APIs for adding realtime features to applications.
Alternatives to Amazon SQS
RabbitMQ is the open-source message broker supporting multiple messaging protocols.
ActiveMQ is an open-source message broker with support for multiple protocols, offering high availability and scalability for enterprise messaging.
Apache Kafka is an open-source real-time data streaming platform.
Discover how Amazon API Gateway and Amazon SQS stack up against Ably
Ably is the definitive realtime experience platform of the internet. See how we compare to Amazon API Gateway and Amazon SQS on key dimensions such as core features, pricing, integrations, QoS, performance, and security and compliance.
Try Ably for free to discover the benefits for yourself
Ably has built reliable realtime infrastructure so you don’t have to. On our free plan you benefit from:
- 6M monthly messages
- 200 concurrent channels
- 200 concurrent connections