Last active
April 22, 2022 10:58
-
-
Save jbrechtel/e21dc3a5a5d5b0c78231f4bd1f96601a to your computer and use it in GitHub Desktop.
goaws SNS -> SQS subscription
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "CREATING SUBSCRIPTION WITH QUEUE ARN" | |
set -e | |
ENDPOINT_URL="http://localhost:4100" | |
export AWS_DEFAULT_REGION="us-east-1" | |
export AWS_SECRET_ACCESS_KEY="fakefakefake" | |
export AWS_ACCESS_KEY_ID="faketyfakefake" | |
TOPIC_ARN=$(aws --endpoint-url $ENDPOINT_URL sns create-topic --name test-topic | jq -r ".TopicArn") | |
echo "TOPIC_ARN: $TOPIC_ARN" | |
QUEUE_URL=$(aws --endpoint-url $ENDPOINT_URL sqs create-queue --queue-name test-queue | jq -r ".QueueUrl") | |
echo "QUEUE_URL: $QUEUE_URL" | |
QUEUE_ARN=$(aws --endpoint-url $ENDPOINT_URL sqs get-queue-attributes --queue-url $QUEUE_URL | jq -r ".Attributes.QueueArn") | |
echo "QUEUE_ARN: $QUEUE_ARN" | |
aws --endpoint-url $ENDPOINT_URL sns subscribe --topic-arn $TOPIC_ARN --protocol sqs --notification-endpoint $QUEUE_ARN | |
aws --endpoint-url $ENDPOINT_URL sns publish --topic-arn $TOPIC_ARN --message test-message | |
echo "RECEIVING MESSAGE" | |
aws --endpoint-url $ENDPOINT_URL sqs receive-message --queue-url $QUEUE_URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "CREATING SUBSCRIPTION WITH QUEUE URL" | |
set -e | |
ENDPOINT_URL="http://localhost:4100" | |
export AWS_DEFAULT_REGION="us-east-1" | |
export AWS_SECRET_ACCESS_KEY="fakefakefake" | |
export AWS_ACCESS_KEY_ID="faketyfakefake" | |
TOPIC_ARN=$(aws --endpoint-url $ENDPOINT_URL sns create-topic --name test-topic | jq -r ".TopicArn") | |
echo "TOPIC_ARN: $TOPIC_ARN" | |
QUEUE_URL=$(aws --endpoint-url $ENDPOINT_URL sqs create-queue --queue-name test-queue | jq -r ".QueueUrl") | |
echo "QUEUE_URL: $QUEUE_URL" | |
QUEUE_ARN=$(aws --endpoint-url $ENDPOINT_URL sqs get-queue-attributes --queue-url $QUEUE_URL | jq -r ".Attributes.QueueArn") | |
echo "QUEUE_ARN: $QUEUE_ARN" | |
aws --endpoint-url $ENDPOINT_URL sns subscribe --topic-arn $TOPIC_ARN --protocol sqs --notification-endpoint $QUEUE_URL | |
aws --endpoint-url $ENDPOINT_URL sns publish --topic-arn $TOPIC_ARN --message test-message | |
echo "RECEIVING MESSAGE" | |
aws --endpoint-url $ENDPOINT_URL sqs receive-message --queue-url $QUEUE_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment