{"id":18048068,"url":"https://github.com/ivangfr/springboot-aws-localstack-dynamodb-lambda-sns-sqs","last_synced_at":"2026-03-18T00:01:52.325Z","repository":{"id":49438065,"uuid":"512419049","full_name":"ivangfr/springboot-aws-localstack-dynamodb-lambda-sns-sqs","owner":"ivangfr","description":"In this project, we will use LocalStack to locally simulate some services provided by AWS Cloud such as: DynamoDB, Lambda, SNS and SQS. Additionally, to simplify the use of AWS managed services, we will use Spring Cloud AWS.","archived":false,"fork":false,"pushed_at":"2026-01-18T10:28:29.000Z","size":15204,"stargazers_count":22,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-18T17:48:16.180Z","etag":null,"topics":["aws","aws-dynamodb","aws-lambda","aws-sns","aws-sqs","docker","java","localstack","semantic-ui","spring-boot","spring-cloud-aws","spring-cloud-function-adapter-aws","spring-web-mvc","springdoc-openapi","thymeleaf","websocket"],"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/ivangfr.png","metadata":{"files":{"readme":"README.md","changelog":"news-consumer/pom.xml","contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ivangfr"}},"created_at":"2022-07-10T11:38:33.000Z","updated_at":"2026-01-18T10:28:33.000Z","dependencies_parsed_at":"2024-03-12T07:26:01.296Z","dependency_job_id":"e2ea14ae-41fa-4e49-ac4f-e0e0f54cc8ad","html_url":"https://github.com/ivangfr/springboot-aws-localstack-dynamodb-lambda-sns-sqs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivangfr/springboot-aws-localstack-dynamodb-lambda-sns-sqs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivangfr","download_url":"https://codeload.github.com/ivangfr/springboot-aws-localstack-dynamodb-lambda-sns-sqs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30636635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T23:56:54.546Z","status":"ssl_error","status_checked_at":"2026-03-17T23:56:28.952Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","aws-dynamodb","aws-lambda","aws-sns","aws-sqs","docker","java","localstack","semantic-ui","spring-boot","spring-cloud-aws","spring-cloud-function-adapter-aws","spring-web-mvc","springdoc-openapi","thymeleaf","websocket"],"created_at":"2024-10-30T20:11:14.338Z","updated_at":"2026-03-18T00:01:52.305Z","avatar_url":"https://github.com/ivangfr.png","language":"Java","funding_links":["https://github.com/sponsors/ivangfr"],"categories":[],"sub_categories":[],"readme":"# springboot-aws-localstack-dynamodb-lambda-sns-sqs\n\nIn this project, we will use [`LocalStack`](https://localstack.cloud/) to locally simulate some services provided by [`AWS Cloud`](https://aws.amazon.com/) such as: [`DynamoDB`](https://aws.amazon.com/dynamodb/), [`Lambda`](https://aws.amazon.com/lambda/), [`SNS`](https://aws.amazon.com/sns/) and [`SQS`](https://aws.amazon.com/sqs/). Additionally, to simplify the use of AWS managed services, we will use [`Spring Cloud AWS`](https://spring.io/projects/spring-cloud-aws).\n\n\u003e **Note**: Also, take a look at the [`springboot-aws-localstack-opensearch-s3-secretsmanager`](https://github.com/ivangfr/springboot-aws-localstack-opensearch-s3-secretsmanager) repository. There, we have implemented two Spring Boot applications for indexing and searching movies. We also used LocalStack to simulate AWS Cloud services locally, such as [`OpenSearch`](https://aws.amazon.com/opensearch-service/), [`S3`](https://aws.amazon.com/s3/), and [`Secrets Manager`](https://aws.amazon.com/secrets-manager/).\n\n## Proof-of-Concepts \u0026 Articles\n\nOn [ivangfr.github.io](https://ivangfr.github.io), I have compiled my Proof-of-Concepts (PoCs) and articles. You can easily search for the technology you are interested in by using the filter. Who knows, perhaps I have already implemented a PoC or written an article about what you are looking for.\n\n## Additional Readings\n\n- \\[**Medium**\\] [**Spring Boot apps to trigger and consume DynamoDB News table updates using AWS Lambda, SNS and SQS**](https://medium.com/@ivangfr/spring-boot-apps-to-trigger-and-consume-dynamodb-news-table-updates-using-aws-lambda-sns-and-sqs-957570cf9a3a)\n- \\[**Medium**\\] [**Spring Boot Apps for Movie Indexing/Search with AWS OpenSearch, S3 and Secrets Manager**](https://medium.com/@ivangfr/spring-boot-apps-for-movie-indexing-search-with-aws-opensearch-s3-and-secrets-manager-a95ad0697e51)\n- \\[**Medium**\\] [**Implementing a Spring Boot App using AWS DynamoDB as database**](https://medium.com/@ivangfr/implementing-a-spring-boot-app-using-aws-dynamodb-as-database-5dbf8b7fc924)\n- \\[**Medium**\\] [**Implementing a Spring Boot App that uses AWS Secrets Manager to store its MongoDB credentials**](https://medium.com/@ivangfr/implementing-a-spring-boot-app-that-uses-aws-secrets-manager-to-store-its-mongodb-credentials-f805a4c74d9a)\n- \\[**Medium**\\] [**Implementing a Serverless AWS Lambda with Spring Cloud Function \u0026 AWS Adapter**](https://medium.com/@ivangfr/implementing-a-serverless-aws-lambda-with-spring-cloud-function-aws-adapter-05fd6d48ba45)\n- \\[**Medium**\\] [**Using AWS SNS and SQS to stream Alerts from a Spring Boot producer to consumers**](https://medium.com/@ivangfr/using-aws-sns-and-sqs-to-stream-alerts-from-a-spring-boot-producer-to-consumers-0b0a974e40fc)\n\n## Project Diagram\n\n![project-diagram](documentation/project-diagram.jpeg)\n\n## Applications\n\n- ### news-producer\n\n  [`Spring Boot`](https://docs.spring.io/spring-boot/index.html) Java Web application that exposes a REST API to manage news. It uses DynamoDB as database.\n\n  It has the following endpoints:\n  ```text\n     GET /api/news\n     GET /api/news/{id}\n    POST /api/news {\"title\": \"...\"}\n    POST /api/news/randomly\n  DELETE /api/news/{id}\n  ```\n\n- ### dynamodb-lambda-function\n\n  [`Spring Cloud Function`](https://spring.io/projects/spring-cloud-function) application that uses [`AWS Adapter`](https://docs.spring.io/spring-cloud-function/reference/adapters/aws-intro.html) to convert it to a form that can run in `AWS Lambda`.\n\n  `dynamodb-lambda-function` listens to events emitted by an event-source created to monitor changes in `DynamoDB` news table. Once it receives an event, it processes it and publishes a news event to an `SNS` topic. Later, `SNS` publishes the news event to a `SQS` queue.\n\n- ### news-consumer\n\n  `Spring Boot` Java Web application that polls the news events that are queued in a `SQS` queue.\n\n## Prerequisites\n\n- [`Java 25`](https://www.oracle.com/java/technologies/downloads/#java25) or higher;\n- A containerization tool (e.g., [`Docker`](https://www.docker.com), [`Podman`](https://podman.io), etc.)\n\n## Package dynamodb-lambda-function jar\n\n- In a terminal, make sure you inside the `springboot-aws-localstack-dynamodb-lambda-sns-sqs` root folder:\n\n- Run the following script:\n  ```bash\n  ./package-dynamodb-lambda-function-jar.sh\n  ```\n  When `Maven` packaging finishes, the jar file generated in `dynamodb-lambda-function/target` folder is copied to `dynamodb-lambda-function/shared` folder.\n\n## Start and Initialize LocalStack\n\n- In a terminal, make sure you are in inside the `springboot-aws-localstack-dynamodb-lambda-sns-sqs` root folder:\n\n- Start `LocalStack` Docker container:\n  ```bash\n  DEBUG=1 docker compose up -d\n  ```\n\n- \\[Optional\\] Debug logs are enabled so that we have more insights about what is happening. To monitor `localstack` Docker container logs, run the command below:\n  ```bash\n  docker logs localstack\n  ```\n\n- Initialize `LocalStack` by running the following script:\n  ```bash\n  ./init-localstack.sh\n  ```\n  The script will create:\n  - create `news-topic` in `SNS`;\n  - create `news-consumer-queue` in `SQS`;\n  - subscribe `news-consumer-queue` to `news-topic`;\n  - create `news` table in `DynamoDB`;\n  - create `ProcessDynamoDBEvent` Lambda function;\n  - create an `event-source-mapping` to connect `DynamoDB` to `ProcessDynamoDBEvent` Lambda function.\n\n## Running applications with Maven\n\n- **news-producer**\n\n  In a terminal and, inside the `springboot-aws-localstack-dynamodb-lambda-sns-sqs` root folder, run the following command:\n  ```bash\n  export AWS_REGION=eu-west-1 \u0026\u0026 export AWS_ACCESS_KEY_ID=key \u0026\u0026 export AWS_SECRET_ACCESS_KEY=secret \u0026\u0026 \\\n    ./mvnw clean spring-boot:run --projects news-producer\n  ```\n\n- **news-consumer**\n\n  In another terminal and, inside the `springboot-aws-localstack-dynamodb-lambda-sns-sqs` root folder, run the command below:\n  ```bash\n  export AWS_REGION=eu-west-1 \u0026\u0026 export AWS_ACCESS_KEY_ID=key \u0026\u0026 export AWS_SECRET_ACCESS_KEY=secret \u0026\u0026 \\\n    ./mvnw clean spring-boot:run --projects news-consumer\n  ```\n\n## Running applications as Docker container\n\n- ### Build Docker images\n\n  In a terminal and, inside the `springboot-aws-localstack-dynamodb-lambda-sns-sqs` root folder, run the following script:\n  ```bash\n  ./build-docker-images.sh\n  ```\n\n- ### Run Docker containers\n\n  - **news-producer**\n\n    In a terminal, run the following command:\n    ```bash\n    docker run --rm --name news-producer -p 9080:9080 \\\n      -e AWS_REGION=eu-west-1 -e AWS_ACCESS_KEY_ID=key -e AWS_SECRET_ACCESS_KEY=secret \\\n      --network=springboot-aws-localstack-dynamodb-lambda-sns-sqs_default \\\n      ivanfranchin/news-producer:1.0.0\n    ```\n\n  - **news-consumer**\n\n    In a new terminal, run the command below:\n    ```bash\n    docker run --rm --name news-consumer -p 9081:9081 \\\n      -e AWS_REGION=eu-west-1 -e AWS_ACCESS_KEY_ID=key -e AWS_SECRET_ACCESS_KEY=secret \\\n      -e NEWS_PRODUCER_URL=http://news-producer:9080 \\\n      --network=springboot-aws-localstack-dynamodb-lambda-sns-sqs_default \\\n      ivanfranchin/news-consumer:1.0.0\n    ```\n\n## Application URL\n\n| Application     | Type    | URL                                   |\n|-----------------|---------|---------------------------------------|\n| `news-producer` | Swagger | http://localhost:9080/swagger-ui.html |\n| `news-consumer` | UI      | http://localhost:9081                 |\n\n## Playing around\n\n- **Creating news**\n\n  - In a terminal, run the following command:\n    ```bash\n    curl -i -X POST http://localhost:9080/api/news \\\n      -H 'Content-Type: application/json' \\\n      -d '{\"title\": \"Palmeiras is three-time champion of the Copa Libertadores da América\"}'\n    ```\n\n    or to create news randomly:\n    ```bash\n    curl -i -X POST http://localhost:9080/api/news/randomly\n    ```\n\n  - In `news-consumer` UI, the news should be displayed.\n\n- **Deleting news**\n\n  - In a terminal, run the following command:\n    ```bash\n    curl -i -X DELETE http://localhost:9080/api/news/\u003cNEWS-ID\u003e\n    ```\n\n  - In `news-consumer` UI, the news should be removed.\n\n## Demo\n\nIn the `GIF` below, we use `news-producer` Swagger UI to create one random news. Then, we delete the news created previously. Finally, we create more two more news randomly.\n\n![demo](documentation/demo.gif)\n\n## Shutdown\n\n- To stop the applications, go to the terminal where they are running and press `Ctrl+C`;\n- To stop and remove Docker Compose containers, network, and volumes, go to a terminal and, inside the `springboot-aws-localstack-dynamodb-lambda-sns-sqs` root folder, run the following command:\n  ```bash\n  docker compose down -v\n  ```\n\n## Cleanup\n\nTo remove the Docker images created by this project, go to a terminal and, inside the `springboot-aws-localstack-dynamodb-lambda-sns-sqs` root folder, run the script below:\n```bash\n./remove-docker-images.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivangfr%2Fspringboot-aws-localstack-dynamodb-lambda-sns-sqs/lists"}