github.com/argoproj/argo-events@v1.9.1/docs/eventsources/setup/aws-sns.md (about)

     1  # AWS SNS
     2  
     3  SNS event-source subscribes to AWS SNS topics, listens events and helps sensor trigger the workloads.
     4  
     5  ## Event Structure
     6  
     7  The structure of an event dispatched by the event-source over eventbus looks like following,
     8  
     9              {
    10                  "context": {
    11                    "type": "type_of_event_source",
    12                    "specversion": "cloud_events_version",
    13                    "source": "name_of_the_event_source",
    14                    "id": "unique_event_id",
    15                    "time": "event_time",
    16                    "datacontenttype": "type_of_data",
    17                    "subject": "name_of_the_configuration_within_event_source"
    18                  },
    19                  "data": {
    20                   "header": "sns headers",
    21                     "body": "body refers to the sns notification data",
    22                  }
    23              }
    24  
    25  ## Setup
    26  
    27  1. Create a topic called `test` using aws cli or AWS SNS console.
    28  
    29  1. Fetch your access and secret key for AWS account and base64 encode them.
    30  
    31  1. Create a secret called `aws-secret` as follows.
    32  
    33          apiVersion: v1
    34          kind: Secret
    35          metadata:
    36            name: aws-secret
    37          type: Opaque
    38          data:
    39            accesskey: <base64-access-key>
    40            secretkey: <base64-secret-key>
    41  
    42  1. Deploy the secret.
    43  
    44          kubectl -n argo-events apply -f aws-secret.yaml
    45  
    46  1. The event-source for AWS SNS creates a pod and exposes it via service.
    47     The name for the service is in `<event-source-name>-eventsource-svc` format.
    48     You will need to create an Ingress or OpenShift Route for the event-source service so that it can be reached from AWS.
    49     You can find more information on Ingress or Route online.
    50  
    51  1. Create the event source by running the following command. Make sure to update the URL in the configuration within the event-source.
    52  
    53          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/aws-sns.yaml
    54  
    55  1. Go to SNS settings on AWS and verify the webhook is registered. You can also check it by inspecting the event-source pod logs.
    56  
    57  1. Create the sensor by running the following command.
    58  
    59          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/aws-sns.yaml
    60  
    61  1. Publish a message to the SNS topic, and it will trigger an argo workflow.
    62  
    63  1. Run `argo list` to find the workflow.
    64  
    65  ## Troubleshoot
    66  
    67  Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).