How to build a simple AWS Pub-Sub serverless application
Pub/Sub is an asynchronous and scalable messaging service that decouples services producing messages from services processing those messages. Pub-Sub is used in multiple use cases like data streaming, event bus, real-time event distribution, and more. Since it’s commonly used we created an open-source template for a quickstart.
Bohdan Basov
April 27 2023 · 4 min read
SHARE ON

How to create and launch Pub-Sub application on AWS
Altostra has created an open-source pub-sub-service-nodejs
template you can use to deploy and launch your own simple AWS Pub-Sub application in a few minutes.
This is serverless application that integrates multiple publishers and subscribers in single system, using the following Amazon Web Services (AWS) services:
- Amazon Simple Notification Service (SNS) - used as an event bus.
- AWS Lambdas - to publish and subscribe to messages.
- Amazon DynamoDB - to store received events.
- Amazon API Gateway - to expose the Lambda function as an API endpoint and trigger processing.
To create and deploy a project, you first need to
- Sign Up for Altostra.
- Make sure you have integrated your AWS account. For more information read Altostra Docs: Cloud Integration.
- Create a new project using the
pub-sub-service-nodejs
template. - Deploy a new stack of the project.
- Wait for AWS to deploy your CloudFormation stack.
This may take up to 5 minutes, but it usually takes less. - Make request to your API gateway to test your PubSub project.
curl -X POST https://your-endpoint -d "hello world"
Check your DynamoDB table, to make sure your subscribers react to the event.
It's up to you now to change the Altostra
pub-sub-service-nodejs
code to expand the app functionality as you wish.
In Summary
The Pub-Sub template, provides a quick and easy way to implement a messaging system that supports multiple publishers and subscribers in a single application, with all the necessary AWS services pre-configured and integrated. Using Altostra’s templates can help developers focus on the core logic of their application, rather than the underlying infrastructure, and can accelerate the development and deployment process. You can customize your project to your specific needs, enabling you to quickly create complex and scalable applications without having to reinvent the wheel.
For more information about Pub-Sub Services on AWS you can refer to “Pub-Sub Services on AWS: What are your options?” blog which provides a comprehensive overview of PubSub, pros and cons, and real-world use cases.
Stay connected
For more information about Altostra’s platform please visit Altostra’s documentation or our blog. Stay connected with us on Twitter, LinkedIn, YouTube, and Facebook. We’d love to hear from you.