AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Serverless patterns - EventBridge to SNS Resources: # Define the SNS topic MySnsTopic: Type: AWS::SNS::Topic # Define the event rule to filter for events EventRule: Type: AWS::Events::Rule Properties: Description: "EventRule" EventPattern: account: - !Sub '${AWS::AccountId}' source: - "demo.cli" Targets: - Arn: !Ref MySnsTopic Id: "SNStopic" # Allow EventBridge to invoke SNS EventBridgeToToSnsPolicy: Type: AWS::SNS::TopicPolicy Properties: PolicyDocument: Statement: - Effect: Allow Principal: Service: events.amazonaws.com Action: sns:Publish Resource: !Ref MySnsTopic Topics: - !Ref MySnsTopic Outputs: MySnsTopicName: Description: SNS topic name Value: !GetAtt MySnsTopic.TopicName MySnsTopicArn: Description: SNS topic ARN Value: !Ref MySnsTopic