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

New Construct proposal: SNS notification #83

Open
carvajalluis opened this issue Aug 5, 2021 · 3 comments
Open

New Construct proposal: SNS notification #83

carvajalluis opened this issue Aug 5, 2021 · 3 comments

Comments

@carvajalluis
Copy link

there is a large chance that at some point you need an outgoing notification topic with its permissions and policy to provide event driven architecture intercommunication, to notify end users , to notify it , etc. So that you can reference it from lambda code.

@mnapoli
Copy link
Member

mnapoli commented Aug 6, 2021

Hi, thanks for opening this issue!

Could you explain in a bit more detail what you have in mind? Would it be a construct to handle SNS notifications, or to send them?

If you have a proposal of YAML syntax feel free.

@carvajalluis
Copy link
Author

carvajalluis commented Aug 10, 2021

Hello @mnapoli ,
definitely send is my current intent. I'm a bit rough yet on serverless and it might not be complete or production ready but this is what I have been creating.

resources:
  Resources:
    AlarmTopic:
      Type: AWS::SNS::Topic
      Properties:
        DisplayName: "User alerts"
        TopicName: user-alert-${self:provider.stage}
        Subscription:
          - Endpoint: user@mail.com
            Protocol: email
    AlarmTopicPolicy:
      Type: AWS::SNS::TopicPolicy
      DependsOn:
        - AlarmTopic
      Properties:
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Sid: AllowServerlessFrameworkEnterpriseToPublish
              Effect: Allow
              Resource: !Ref AlarmTopic
              Principal:
                Service: lambda.amazonaws.com
              Action: "sns:Publish"
        Topics:
          - Ref: AlarmTopic
  Outputs:
    AlarmSnsTopicArn:
      Description: ARN for the SNS Alarm Topic
      Value: !Ref AlarmTopic

some thing along those lines where I can create a construct and give it publish access to any particular construct worker. i could have some misconception yet so please correct me if I'm wrong.

@mnapoli
Copy link
Member

mnapoli commented Aug 24, 2021

OK I see, thanks!

The end goal here is to add email alarms, right? I'm wondering if this isn't something we should solve directly (the high level problem). I'd be interested to know how you use the alarm? (what triggers it)

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

No branches or pull requests

2 participants