Skip to content

Commit 69540ce

Browse files
authored
Update README.md
1 parent 0709aea commit 69540ce

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

APIGateway-SQS-ReceiveMessages/README.md

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
## AWS API Gateway to AWS SQS
22

33
This pattern creates a REST API Gateway that directly integrates with AWS SQS to read messages.
4-
Learn more about this pattern at Serverless Land Patterns: << Add the live URL here >>
5-
Important: This application uses various AWS services that incur costs beyond the Free Tier usage. Please review the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.
4+
Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/
5+
6+
**Important**: This application uses various AWS services that incur costs beyond the Free Tier usage. Please review the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.
67

78
## Requirements
89

@@ -15,50 +16,63 @@ Important: This application uses various AWS services that incur costs beyond th
1516

1617
1. Clone the GitHub repository:
1718
```git clone https://github.com/aws-samples/serverless-patterns```
19+
1820
2. Navigate to the pattern directory:
1921
```cd APIGateway-SQS-ReceiveMessages```
22+
2023
3. Deploy using AWS SAM:
2124
```sam deploy --guided```
25+
2226
During the prompts:
2327
- Enter a stack name
2428
- Select your desired AWS Region
2529
- Allow SAM CLI to create IAM roles with required permissions
26-
- After initial deployment with sam deploy --guided, subsequent deployments can use sam deploy with the saved configuration (samconfig.toml).
27-
- Note the outputs from the deployment process, as they contain resource names and/or ARNs needed for testing.
30+
31+
After initial deployment with sam deploy --guided, subsequent deployments can use sam deploy with the saved configuration (samconfig.toml).
32+
33+
Note the outputs from the deployment process, as they contain resource names and/or ARNs needed for testing.
2834

2935
## How it works
3036

3137
This pattern creates an Amazon API Gateway REST API endpoint that directly connects to Amazon SQS using service integrations. Users can retrieve messages by calling the GET method of the invoke URL (API Gateway) provided in the Stack Output.
38+
3239
The invoke URL supports query string parameters such as MaxNumberOfMessages=5, VisibilityTimeout=15, and AttributeName=All to customize the response.
40+
3341
For detailed parameter definitions, refer to the [AWS API Reference Documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html).
3442

3543
## Usage Example and Consideration
3644

3745
This pattern is ideal for scenarios where you need to retrieve messages from SQS via HTTPS without using AWS SDK. Common use cases include:
38-
Web applications that need to poll SQS queues for new messages, Mobile applications requiring secure access to SQS messages, Third-party integrations where direct AWS SDK access isn't practical, Microservices architectures where services need to read messages over HTTP/HTTPS, Legacy system integrations that support only HTTP/HTTPS protocols, Development environments where simplified queue access is preferred
46+
Web applications that need to poll SQS queues for new messages, Mobile applications requiring secure access to SQS messages, Third-party integrations where direct AWS SDK access isn't practical, Legacy system integrations that support only HTTP/HTTPS protocols, Development environments where simplified queue access is preferred.
47+
3948
Please review [API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html) and [SQS Quotas](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-quotas.html) for service limits before implementation.
4049

4150
## Testing
4251

4352
Follow these steps to test the integration:
53+
4454
1. First, send test messages to the queue:
45-
```chmod +x send_message_to_queue.sh```
46-
```./send_message_to_queue.sh {queueURL} {number of messages}```
55+
```chmod +x send_message_to_queue.sh```
56+
```./send_message_to_queue.sh {queueURL} {number of messages}```
57+
4758
Example:
4859
```./send_message_to_queue.sh https://sqs.us-east-1.amazonaws.com/210987654321/myQueue 3```
60+
4961
2. Then, retrieve messages using the API Gateway endpoint:
62+
5063
Basic retrieval:
5164
```curl --location --request GET '{ApiEndpoint output value}'```
65+
5266
Advanced retrieval with parameters:
5367
```curl --location --request GET '{ApiEndpoint output value}?MaxNumberOfMessages=5&VisibilityTimeout=15&AttributeName=All'```
68+
5469
Parameter details are available in the [AWS API Reference Documentation](
55-
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html
56-
).
70+
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html).
5771

58-
Expected Output
72+
## Expected Output
5973

6074
When Queue is Empty:
61-
~~~
75+
```json
6276
{
6377
"ReceiveMessageResponse": {
6478
"ReceiveMessageResult": {
@@ -69,9 +83,10 @@ When Queue is Empty:
6983
}
7084
}
7185
}
72-
~~~
86+
```
87+
7388
When Queue has Messages:
74-
~~~
89+
```json
7590
{
7691
"ReceiveMessageResponse": {
7792
"ReceiveMessageResult": {
@@ -92,16 +107,20 @@ When Queue has Messages:
92107
}
93108
}
94109
}
95-
~~~
110+
```
96111

97112
## Cleanup
98113

99114
Delete the stack using SAM:
100-
```sam delete```
115+
```
116+
sam delete
117+
```
118+
101119
Confirm when prompted to delete the stack and its resources.
102120

103-
Note: You can also use
104-
```sam delete --no-prompts``` to skip confirmation steps.
121+
Note: You can also use `sam delete --no-prompts` to skip confirmation steps.
122+
123+
---
105124

106125
Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
107126
SPDX-License-Identifier: MIT-0

0 commit comments

Comments
 (0)