Decoupling Applications - SQS Flashcards
What is the purpose of AWS integration and messaging services?
To orchestrate and enable communication between different services or applications, allowing them to share data and information.
What are the two patterns of application communication?
Synchronous Communication
Asynchronous (Event-Based) Communication
What is synchronous communication in applications?
One application directly connects to another, such as a buying service directly calling a shipping service to perform an action.
What is asynchronous communication in applications?
Applications communicate via middleware (e.g., a queue), where one service sends messages to the queue and another service retrieves them without direct interaction.
What is a common problem with synchronous communication?
It can lead to system failures if one service overwhelms another due to sudden spikes in traffic or processing needs.
Why is decoupling applications beneficial?ues?
It allows independent scaling of services, prevents system overloads, and improves reliability during traffic spikes.
What AWS services are used for asynchronous communication?
SQS (Simple Queue Service): For queue-based decoupling.
SNS (Simple Notification Service): For pub/sub messaging.
Kinesis: For real-time data streaming and big data processing.
What is Amazon SQS?
Amazon SQS (Simple Queue Service) is a fully managed queuing service used to decouple application components, enabling scalable and reliable message-based communication.
What are the key components of an SQS queue?
Producers: Send messages to the queue.
Consumers: Poll and process messages from the queue.
What is the default and maximum retention period for SQS messages?
Default: 4 days.
Maximum: 14 days.
What are the size limits for messages in SQS?
Messages can be up to 256 KB.
What type of delivery does SQS provide?
At-least-once delivery: Messages may be delivered more than once.
Best-effort ordering: Messages may not always arrive in order.
How do consumers process messages from SQS?
Poll messages using the ReceiveMessage API.
Process messages.
Delete messages using the DeleteMessage API to prevent reprocessing.
How can Auto Scaling be integrated with SQS?
Use ApproximateNumberOfMessages as a trigger.
Set a CloudWatch alarm to scale EC2 instances in the Auto Scaling group based on queue length.
How does SQS ensure security?
Encryption in-flight: Messages sent over HTTPS.
At-rest encryption: Using KMS keys.
IAM Policies: Regulate API access.
Access Policies: Allow cross-account or service-specific access.