README
¶
AWS SQS event source for Knative Eventing
This event source consumes messages from a AWS SQS queue and sends them as CloudEvents to an arbitrary event sink.
Contents
Prerequisites
- Register an AWS account
- Create an Access Key in your AWS IAM dashboard.
- Create a SQS queue.
Deployment to Kubernetes
The AWS SQS event source can be deployed to Kubernetes in different manners:
- As an
AWSSQSSourceobject, to a cluster where the TriggerMesh AWS Sources Controller is running. - As a Knative
ContainerSource, to any cluster running Knative Eventing.
ℹ The sample manifests below reference AWS credentials (Access Key) from a Kubernetes Secret object called
awscreds. This Secret can be generated with the following command:$ kubectl -n <my_namespace> create secret generic awscreds \ --from-literal=aws_access_key_id=<my_key_id> \ --from-literal=aws_secret_access_key=<my_secret_key>Alternatively, credentials can be used as literal strings instead of references to Kubernetes Secrets by replacing
valueFromattributes withvalueinside API objects' manifests.
As a AWSSQSSource object
Copy the sample manifest from config/samples/awssqssource.yaml and replace the pre-filled spec attributes with the
values corresponding to your AWS SQS queue. Then, create that AWSSQSSource object in your Kubernetes cluster:
$ kubectl -n <my_namespace> create -f my-awssqssource.yaml
As a ContainerSource object
Copy the sample manifest from config/samples/awssqs-containersource.yaml and replace the pre-filled environment
variables under env with the values corresponding to your AWS SQS queue. Then, create that ContainerSource object
in your Kubernetes cluster:
$ kubectl -n <my_namespace> create -f my-awssqs-containersource.yaml
As a Deployment object bound by a SinkBinding
Copy the sample manifest from config/samples/awssqs-sinkbinding.yaml and replace the pre-filled environment variables
under env with the values corresponding to your AWS SQS queue. Then, create the Deployment and SinkBinding
objects in your Kubernetes cluster:
$ kubectl -n <my_namespace> create -f my-awssqs-sinkbinding.yaml
Running locally
Running the event source on your local machine can be convenient for development purposes.
In the shell
Ensure the following environment variables are exported to your current shell's environment:
export ARN=<arn_of_my_sqs_queue>
export AWS_ACCESS_KEY_ID=<my_key_id>
export AWS_SECRET_ACCESS_KEY=<my_secret_key>
export NAME=my-awssqssource
export NAMESPACE=default
export K_SINK=http://<url_of_event_sink>
export K_LOGGING_CONFIG=''
export K_METRICS_CONFIG='{"domain":"triggermesh.io/sources", "component":"awssqssource", "configMap":{}}'
Then, run the event source with:
$ go run ./cmd/awssqssource
In a Docker container
Using one of TriggerMesh's release images:
$ docker run --rm \
-e ARN=<arn_of_my_sqs_queue> \
-e AWS_ACCESS_KEY_ID=<my_key_id> \
-e AWS_SECRET_ACCESS_KEY=<my_secret_key> \
-e NAME=my-awssqssource \
-e NAMESPACE=default \
-e K_SINK=http://<url_of_event_sink> \
-e K_LOGGING_CONFIG='' \
-e K_METRICS_CONFIG='{"domain":"triggermesh.io/sources", "component":"awssqssource", "configMap":{}}' \
gcr.io/triggermesh/awssqssource:latest
Documentation
¶
There is no documentation for this package.