# README
SNS SQS Lambda Go Example
Pre-requisites
docker version 17+
See how to download and install in Docker site.
docker compose version v2.26.1+
See how to download and install in Docker site.
v2.26.1
golang version 1.11+
See how to download and install in Golang site.
Makefile
Some commands on this project are made using GNU make
, to know available actions on make, use make
or make usage
:
make
make usage
Development
Copy env vars:
cp .env.example .env
Build the lambda (Generate GO binary, run golint and run unit tests):
make build
Start docker compose services:
make start
Stop and remove docker compose services:
make stop
Run the dependencies:
docker compose up
Testing locally:
awslocal sns publish --topic-arn arn:aws:sns:us-east-1:000000000000:sns-topic-example --message "{\"match\":{\"id\": 1}}"
To validate the the message arrived in the destination sqs queue:
awslocal sqs receive-message --queue-url http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/queue-destination-example
Creating aws infra with terraform:
terraform apply --auto-approve
Testing in AWS:
SNS_TOPIC=aws sns list-topics
aws sns publish --topic-arn $SNS_TOPIC --message "{\"whatever\":{\"id\": 1}}"