AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Create an API destination in EventBridge - open API using freshdesk.com Parameters: MyFreshdeskURL: Type: String Default: https://<>.freshdesk.com/api/v2/tickets MyAPIKeyValue: NoEcho: true Type: String Default: '<>' Password: NoEcho: true Type: String Default: '<>' Resources: MyEventBus: Type: AWS::Events::EventBus Properties: Name: "FreshdeskEventBus" MyConnection: Type: AWS::Events::Connection Properties: AuthorizationType: BASIC Description: 'My connection with username/password' AuthParameters: BasicAuthParameters : Username : !Ref MyAPIKeyValue Password : !Ref Password MyApiDestination: Type: AWS::Events::ApiDestination Properties: Name: 'FreshdeskAPI' ConnectionArn: !GetAtt MyConnection.Arn InvocationEndpoint: !Ref MyFreshdeskURL HttpMethod: POST InvocationRateLimitPerSecond: 10 EventBridgeTargetRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: - events.amazonaws.com Action: - sts:AssumeRole Policies: - PolicyName: AllowAPIdestinationAccess PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: 'events:InvokeApiDestination' Resource: !GetAtt MyApiDestination.Arn MyDLQueue: Type: AWS::SQS::Queue EventRule: Type: AWS::Events::Rule Properties: Description: "EventRule" State: "ENABLED" EventBusName: !Ref MyEventBus EventPattern: source: - "freshdesktest" Targets: - Arn: !GetAtt MyApiDestination.Arn RoleArn: !GetAtt EventBridgeTargetRole.Arn Id: "MyAPIdestination" InputPath: $.detail DeadLetterConfig: Arn: !GetAtt MyDLQueue.Arn Outputs: MyEventBusName: Description: Application EventBus Name Value: !Ref MyEventBus MyEventBusArn: Description: Application EventBus ARN Value: !GetAtt MyEventBus.Arn MyConnectionName: Value: !Ref MyConnection MyConnectionArn: Value: !GetAtt MyConnection.Arn MyApiDestinationName: Value: !Ref MyApiDestination MyApiDestinationArn: Value: !GetAtt MyApiDestination.Arn EventBridgeTargetRoleArn: Value: !GetAtt EventBridgeTargetRole.Arn MyDLQueue: Value: !GetAtt MyDLQueue.Arn