Skip to content

Creating a Source


Make sure you have completed the installation procedure before continuing with any of the guides.

In this guide we will create a point to point Bridge between an AWS SQS queue and a microservice application called sockeye which displays events in a web interface. This simple flow is depicted below.

We will create:

  • The sockeye target which serves as an event display.
  • The AWSSQSSource which consumes events from an AWS SQS queue.

Event display

First of all, we need to have a tool to see the events that come from our source.

Create a sockeye service by saving the following YAML manifest in a file called sockeye.yaml and applying it to your Kubernetes cluster:

kind: Service
  name: sockeye
        - image:
kubectl apply -f sockeye.yaml

Open the web interface in a browser at the URL found with the following command:

$ kubectl get ksvc sockeye -o=jsonpath='{.status.url}'

Create a AWS SQS Event source

You can explore the specification of the object using the kubectl explain command. You will see that you need the ARN (i.e Amazon Resource Name) of your AWS SQS queue and the AWS API keys that give you access to SQS.

$ kubectl explain awssqssource.spec
KIND:     AWSSQSSource

RESOURCE: spec <Object>

     Desired state of the event source.

   arn  <string> -required-
     ARN of the Amazon SQS queue to consume messages from. The expected format
     is documented at

   credentials  <Object>
     Credentials to interact with the Amazon SQS API. For more information about
     AWS security credentials, please refer to the AWS General Reference at

   receiveOptions   <Object>
     Options that control the behavior of message receivers.

   sink <Object> -required-
     The destination of events sourced from Amazon SQS.

Create a secret called awscreds which contains your access key and your secret key like so:

kubectl create secret generic awscreds \
  --from-literal=access_key_id=<ACCESS_KEY_ID> \

Then, write a YAML manifest for your SQS source similar to the one below. The following sample points to a SQS queue, referenced by its ARN and a secret called awscreds.

kind: AWSSQSSource
  name: sqs-guide
  arn: arn:aws:sqs:us-east-1:123456789012:triggermesh
        key: access_key_id
        name: awscreds
        key: secret_access_key
        name: awscreds
      kind: Service
      name: sockeye

Create this source with the kubectl apply -f command.


Verify that your source is ready with:

$ kubectl get awssqssource
NAME          READY   REASON   SINK                                      AGE
sqs-guide     True             http://sockeye.sebgoa.svc.cluster.local   3m57s

You can go to the AWS SQS console and put a message in the queue as shown in the following screenshot:

The message will get consumed by the source and sent directly to Sockeye in a CloudEvent format. Below is a screenshot of Sockeye displaying the received event.

More about Sources

Learn more about Sources on the Concepts page.

Back to top