Giter Club home page Giter Club logo

aws-sar-lambda-publish-amazonmq's Introduction

AWS Lambda publish to Amazon MQ

Deploy an Amazon MQ broker and an AWS Lambda function that can publish to it. This project also includes a sample Node.js client application that can connect to the Amazon MQ broker and receive messages published by the Lambda function.

.
├── README.MD                   <-- This instructions file
├── src
│  └── PublishMessage               <-- Source code for a lambda function
│       └── app.js                  <-- Lambda handler to publish messages to an MQTT endpoint on Amazon MQ
│       └── package.json            <-- NodeJS dependencies and scripts
├── client-app
│   └── app.js                  <-- Node.js app to subscribe to messages from an MQTT endpoint on Amazon MQ
│   └── package.json            <-- NodeJS dependencies and scripts
├── template.yaml               <-- SAM template

Services Deployed

  • A Lambda function for publishing messages to Amazon MQ over MQTT.
  • An Amazon MQ SINGLE_INSTANCE broker.

Requirements

Installation Instructions

  1. Create an AWS account if you do not already have one and login.
  2. Go to the app's page on the Serverless Application Repository and click "Deploy"
  3. Provide the required app parameters (see parameter details below) and click "Deploy"

Parameter Details

  • AdminUsername: (Required) A username for AmazonMQ console access.
  • AdminPassword: (Required) A password for AmazonMQ console access. 12 characters and at least 4 unique characters.
  • ClientUsername: (Required) A username for a client.
  • ClientPassword: (Required) A password for a client. 12 characters and at least 4 unique characters.

Using this Application

To run the Node.js client-app run the following commands in the client-app directory in this repository. Replacing the arguments with credentials from your Amazon MQ broker.

npm install
node app.js "username" "password" "wss://endpoint:port" "some/topic"

Testing the Lambda function:

  • Navigate to the AWS Lambda console and choose the newly created PublishMessage function.
  • Create a test event.
  • Run a test invocation.
  • Messages published will appear in the console of the Node.js client-app.

==============================================

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-sar-lambda-publish-amazonmq's People

Contributors

virgilvox avatar amazon-auto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.