Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add support to specify a SNS topic that belongs to a different region #105

Closed
DaichiUeura opened this issue Mar 9, 2017 · 13 comments

Comments

@DaichiUeura
Copy link

Hello,

I tried to set a SNS topic existed in a different region as a trigger like below. However CloudFormation said "Invalid parameter: TopicArn". Is this a current limitation or something like that?

...
Parameters:
  EventTopicArn:
    Type: String
Resources:
  SampleProcessor:
    Type: 'AWS::Serverless::Function'
    Properties:
...
      Events:
        SampleSNS:
          Type: SNS
          Properties:
            Topic: !Ref EventTopicArn
...
@jolexa
Copy link

jolexa commented Mar 22, 2017

@DaichiUeura - I am seeking the same answer, may you tell me why you closed this? Was there a resolution? Thanks!

@DaichiUeura
Copy link
Author

DaichiUeura commented Mar 23, 2017

@jolexa The reason why I closed this is that this seems to be not a SAM file issue. Here is the explanation from AWS support.

This error happens when a SNS Topic and a SNS Subscription are created in different regions(i.e. Both needs to exist in a same region). If there is a SNS Topic declaration at Events property in a SAM file, a SNS Subscription is created in the region where a stack is created.

To avoid the issue, we need;

  1. Do not refer a SNS Topic existed in a different region from SAM.
  2. Add a Lambda::Permission resource into SAM for the Lambda function to be able to be invoked from the SNS Topic.
  3. Create a SNS Subscription where the SNS Topic exists.

@jolexa
Copy link

jolexa commented Mar 23, 2017

Ok, thanks. I understand and was afraid that was the case. I think that SAM should be able to parse the region from the SNS TopicArn and be able to implicitly do the correct thing. That may be tricky with the cloudformation architecture. Would you mind 1) Updating this issue's title to say "Feature Request:" and 2) re-open the issue so that we can get a SAM maintainer's opinion/attention someday?

@DaichiUeura DaichiUeura changed the title Unable to specify a SNS topic that belongs to a different region Feature Request: Add support to specify a SNS topic that belongs to a different region as event Mar 23, 2017
@DaichiUeura DaichiUeura changed the title Feature Request: Add support to specify a SNS topic that belongs to a different region as event Feature Request: Add support to specify a SNS topic that belongs to a different region Mar 23, 2017
@DaichiUeura DaichiUeura reopened this Mar 23, 2017
@DaichiUeura
Copy link
Author

DaichiUeura commented Mar 23, 2017

@jolexa Done ;)

@sanathkr
Copy link
Contributor

Appreciate the feature request. SAM can't do much here because it can only meddle with resources we create in the template. Outside resources are pretty much a blackbox when it comes to SAM

@ghost
Copy link

ghost commented Feb 22, 2018

I created pull request to add description in specification #312

@evantorrie
Copy link

This should be possible now since Cloudformation has added a Region parameter to the SNS Topic subscription format, viz. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html

@evantorrie
Copy link

@DaichiUeura Can we reopen this? Given that it's now supported in CloudFormation?

@keetonian keetonian reopened this Mar 25, 2019
@keetonian
Copy link
Contributor

Reopening since CFN added support.

@keetonian
Copy link
Contributor

This should be a simple contribution if someone wants to make it:

Update sns.py to match the CFN equivalent in the docs

Add Region into the SNS Event definition.

Add appropriate tests and documentation.

@53ningen
Copy link
Contributor

53ningen commented Jun 21, 2019

I created a pull request to resolve this issue.
#989

@jlhood jlhood added stage/waiting-for-release and removed contributors/good-first-issue Good first issue for a contributor labels Jul 2, 2019
@jlhood
Copy link
Contributor

jlhood commented Jul 2, 2019

Pending v1.14.0 release

@ShreyaGangishetty
Copy link

Closing this issue as this is released in v1.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants