{"id":18937995,"url":"https://github.com/davidarchanjo/spring-boot-localstack-sns","last_synced_at":"2026-04-09T16:32:27.035Z","repository":{"id":119392201,"uuid":"543790711","full_name":"davidarchanjo/spring-boot-localstack-sns","owner":"davidarchanjo","description":"This project demonstrate how to subscribe an endpoint to consume event from SNS topic by using the LocalStack","archived":false,"fork":false,"pushed_at":"2022-10-03T19:33:53.000Z","size":661,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T21:43:26.864Z","etag":null,"topics":["aws","docker-compose","localstack","service-endpoint","sns","sns-topic","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidarchanjo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-30T21:07:55.000Z","updated_at":"2024-06-02T12:44:46.000Z","dependencies_parsed_at":"2023-12-28T07:15:11.053Z","dependency_job_id":null,"html_url":"https://github.com/davidarchanjo/spring-boot-localstack-sns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-localstack-sns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-localstack-sns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-localstack-sns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidarchanjo%2Fspring-boot-localstack-sns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidarchanjo","download_url":"https://codeload.github.com/davidarchanjo/spring-boot-localstack-sns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239937700,"owners_count":19721484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","docker-compose","localstack","service-endpoint","sns","sns-topic","spring-boot"],"created_at":"2024-11-08T12:13:09.991Z","updated_at":"2026-03-22T01:30:16.208Z","avatar_url":"https://github.com/davidarchanjo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![banner](./assets/banner.jpg)\n\n# INTRODUCTION\nWhen building applications for the cloud, we need to be able to make test through and after the development phase in an environment minimally similar or ideally the same as the production environment where the application will run. We who develop for the AWS not always have an AWS account available in which we can simulate the environment, resources and/or services as we have in corporate projects.\n\nWith this problem in mind, [LocalStack](https://github.com/localstack/localstack) was conceived to be a fully cloud service emulator for testing and simulation for the major AWS services, e.g. DynamoDB, SNS, SQS, Lambda, we usually use to compose cloud-native applications right from the comfort of our local machine. LocalStack offers almost the same functionality, with some limitations, and APIs as the AWS cloud environment does.\n\n\n# OBJECTIVES\nThis project intends to demonstrate the following three points:\n- create a SNS topic on LocalStack (via command line)\n- publish an event to a SNS topic (via command line)\n- subscribe a REST endpoint to consume events from a SNS topic (via command line)\n\n\n# PREREQUISITES\nYou should have the following technologies installed on your system:\n- [docker-compose](https://docs.docker.com/compose/install/)\n- [localstack](https://github.com/localstack/localstack)\n- [awscli](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)\n- [awslocal](https://github.com/localstack/awscli-local)\n- [java 14+](https://www.liquidweb.com/kb/how-to-install-java-windows-ubuntu-macos/)\n- [gradle](https://gradle.org/install/)\n\n**P.S.** In addition to these tools, you should have a basic understanding on [how to manipulate the command line interface (CLI)](https://www.linuxjournal.com/content/linux-command-line-interface-introduction-guide).\n\n\n# TESTING\nOpen three terminal from the folder you downloaded or cloned the repository and go as follows:\n\n## 1. LAUNCH THE APPLICATION\nFrom the first terminal, execute:\n```bash\n./mvnw spring-boot:run\n```\n\n## 2. INITIALIZE LOCALSTACK\nFrom the second terminal, execute:\n```bash\ndocker-compose -f ./devops/docker-compose.yml up\n```\nYou should get something like on the terminal:\n![localstack](./assets/localstack.jpg)\n\n## 3. SET THE ENDPOINT ADDRESS\nFrom the third terminal, execute:\n```bash\nENDPOINT=http://host.docker.internal:8080\n```\n**P.S.** In order to be able to connect to services in the host machine from inside a container we should use `host.docker.internal` instead of `localhost` in the endpoint's address.\n\n## 4. CREATE THE TOPIC\n```bash\nTOPIC_ARN=$(awslocal sns create-topic --name test-topic --output json | jq -r '.TopicArn')\n```\n\n## 5. SUSBSCRIBE THE ENDPOINT\n```bash\nawslocal sns subscribe --topic-arn $TOPIC_ARN --notification-endpoint $ENDPOINT --protocol http --attributes RawMessageDelivery=true\n```\n\n## 6. SEND A MESSAGE\n```bash\nawslocal sns publish --topic-arn $TOPIC_ARN --message '{\"firstName\": \"David\", \"lastName\": \"Archanjo\"}'\n```\nFrom the first terminal in which the application is running, you should get something like the following:\n![event](./assets/event.jpg)\n\n# FINAL NOTES\nLocalStack is a tool that should definitely be part of our cloud development stack because it is one of the most viable way to explore AWS services and their features in a controlled, customizable and, most importantly, free of charge environment.\n\nNotice in this project I made use of only one of the many AWS services provided by LocalStack. To check the complete and up-to-date list of all AWS emulated services and their availability, visit this [link](https://docs.localstack.cloud/aws/feature-coverage/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidarchanjo%2Fspring-boot-localstack-sns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidarchanjo%2Fspring-boot-localstack-sns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidarchanjo%2Fspring-boot-localstack-sns/lists"}