https://github.com/cdimascio/sqs-replay
♻️ CLI that replays AWS SQS messages between queues.
https://github.com/cdimascio/sqs-replay
aws cli replay sqs
Last synced: about 2 months ago
JSON representation
♻️ CLI that replays AWS SQS messages between queues.
- Host: GitHub
- URL: https://github.com/cdimascio/sqs-replay
- Owner: cdimascio
- License: mit
- Created: 2021-09-06T16:00:07.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-04T16:27:16.000Z (almost 4 years ago)
- Last Synced: 2025-02-04T10:57:20.791Z (over 1 year ago)
- Topics: aws, cli, replay, sqs
- Language: Rust
- Homepage:
- Size: 115 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## Install
MacOS
```shell
brew install cdimascio/tap/sqs_replay
```
## Usage
```shell
sqs-replay \
--source 'https://host/MyDLQueue' \
--dest 'https://host/MyQueue' \
--max-messages 200 \
--verbose
```
Note: exclude `max-messages` to replay all
## Options
```shell
USAGE:
sqs-replay [FLAGS] [OPTIONS] --source --dest
FLAGS:
-h, --help Print help information
-v, --verbose Outputs the contents of each SQS message replayed.
-V, --version Print version information
OPTIONS:
-d, --dest
The destination SQS url.
-m, --max-messages <10>
The maximum number of messages to replay.
-r, --region
The AWS region
-s, --source
The source SQS url.
-x, --dedup-regex
A regex applied to each message. The regex must contain at least one capture group.
The value captured by the 'last' capture group is used to uniquely identifty a message.
If multiple messages have the same identifier, only the first match message is replayed;
other messages are deleted.
Avoids replaying duplicate messages.
e.g --selector-regex 'id":"(.*?)"'
```
## Dedup Messages
sqs-replay can deduplicate messages. To avoid replaying logically similar messages, sqs-replay provides the `--dedup-regex` argument.
The values of `--dedup-regex` is a regex that (must) contain a single capture group that selects the message's deduplication identifier.
Subsequent messages that contain the same deduplication identifier will be deleted, but not replayed. `--dedup-regex` can be used with standard and FIFO queues.
```shell
sqs-replay \
--source 'https://host/MyDLQueue' \
--dest 'https://host/MyQueue' \
--max-messages 200
--dedup-regex 'id":"(.*?)"'
--verbose
```
The `deup-regex`, `id":"(.*?)"` matches the value of `id` in a json structure.
For example, if the following message were in the queue:
```shell
{
"id": "12345",
"name": "eliana"
}
```
```shell
{
"id": "45678",
"name": "luca"
}
```
```shell
{
"id": "12345",
"name": "eliana"
}
```
The `--deup-regex` will replay message 1 and 2, and delete 3.
## License
[MIT](LICENSE)