question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple services sharing same SNS (localstack)

See original GitHub issue

Hi, thanks for this great plugin!

I have two services isolated, each with its serverless.yaml file. Im using localstack. I had to set the port differently for each service to make them work in parallel. I will be adding more services, so each will have to be on a different port, right? Is there a way to prevent this?

Also, the HOST IP ADDRESS (sns-subscribe-endpoint) has to be set for each computer, is there a way to use localhost or something?

Thanks!

Service A:

  serverless-offline-sns:
    port: 4003
    host: 0.0.0.0 # Enable plugin to listen on every local address
    sns-subscribe-endpoint: 192.168.0.107 # Host ip address
    sns-endpoint: http://localhost:4575 # Default localstack sns endpoint
    debug: true
    region: ${self:provider.region}

Service B:

  serverless-offline-sns:
    port: 4002
    host: 0.0.0.0 # Enable plugin to listen on every local address
    sns-subscribe-endpoint: 192.168.0.107 # Host ip address
    sns-endpoint: http://localhost:4575 # Default localstack sns endpoint
    debug: true
    region: ${self:provider.region}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
ricardovfcommented, Apr 13, 2020

For the sns-subscribe-endpoint i did this:

sns-subscribe-endpoint: ${env:DEV_LOCAL_IP, 'host.docker.internal'} # Host ip address

On OSX no need for DEV_LOCAL_IP on the env, but on linux, yes.

0reactions
icameroncommented, Jul 7, 2021

@chasevida @falecci

What worked for me was to setup a sls offline local sns service bridge

local-sns.yaml

service: local-sns
frameworkVersion: '2'
provider:
  name: aws
  runtime: nodejs12.x
  lambdaHashingVersion: 20201221
plugins:
  - serverless-offline-sns
  - serverless-offline
custom:
  serverless-offline-sns:
    port: 4002
    host: 0.0.0.0 
    debug: true
    accountId: 123456789012

then on the other services yamls

custom:
  serverless-offline-sns:
    port: 4005 #different port for each service 
    host: 0.0.0.0 # Enable plugin to listen on every local address
    sns-subscribe-endpoint: localhost
    sns-endpoint: http://localhost:4002 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Localstack SNS and SQS for local testing - Medium
Let's say we have two microservices, order service and delivery service. ... LocalStack can be used to test various AWS services like S3,...
Read more >
SQS SNS Subscription between two different Localstack ...
I have two different set of Services. Each service set has a Localstack container running. Can an SQS created in one Localstack service...
Read more >
Configuration - LocalStack Docs
LocalStack allows for many different configuration options. ... e.g., services are started in different containers using docker-compose.
Read more >
Spring Cloud Messaging With AWS and LocalStack - Auth0
Setting up LocalStack is dead simple; you just need to use the docker-compose file below, and it will start SNS and SQS services...
Read more >
Using LocalStack for AWS SNS Mule Connector - YouTube
GitHub Repo LocalStack : https://github.com/localstackMuleSoft AWS Simple Queue Services Connector: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found