How to build a simple AWS Pub-Sub serverless application | Altostra
NEW: AI-Powered Cloud Deployments

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


How to build a simple AWS Pub-Sub serverless application

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:

  1. Amazon Simple Notification Service (SNS) - used as an event bus.
  2. AWS Lambdas - to publish and subscribe to messages.
  3. Amazon DynamoDB - to store received events.
  4. Amazon API Gateway - to expose the Lambda function as an API endpoint and trigger processing.

Discover the power of AWS Pub-Sub and build your own serverless application.

Try Now

To create and deploy a project, you first need to

  1. Sign Up for Altostra.
  2. Make sure you have integrated your AWS account. For more information read Altostra Docs: Cloud Integration.
  3. Create a new project using the pub-sub-service-nodejs template.
    Create PubSub project
  4. Deploy a new stack of the project.
    Deploy PubSub stack
  5. Wait for AWS to deploy your CloudFormation stack.
    This may take up to 5 minutes, but it usually takes less.
  6. Make request to your API gateway to test your PubSub project.
    Test your app
curl -X POST https://your-endpoint -d "hello world"
  1. Check your DynamoDB table, to make sure your subscribers react to the event.

  2. 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.

By submitting this form, you are accepting our Terms of Service and our Privacy Policy

Thanks for subscribing!

Ready to Get Started?

Get Started for Free