README ¶
AWS Cognito event source for Knative Eventing
This event source consumes messages from a AWS Cognito identity pool 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 Cognito identity pool.
Deployment to Kubernetes
The AWS Cognito event source can be deployed to Kubernetes in different manners:
- As an
AWSCognitoIdentitySource
object, 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
valueFrom
attributes withvalue
inside API objects' manifests.
As a AWSCognitoIdentitySource object
Copy the sample manifest from config/samples/awscognitoidentitysource.yaml
and replace the pre-filled spec
attributes
with the values corresponding to your AWS Cognito identity pool. Then, create that AWSCognitoIdentitySource
object in
your Kubernetes cluster:
$ kubectl -n <my_namespace> create -f my-awscognitoidentitysource.yaml
As a ContainerSource object
Copy the sample manifest from config/samples/awscognito-containersource.yaml
and replace the pre-filled environment
variables under env
with the values corresponding to your AWS Cognito identity pool. Then, create that
ContainerSource
object in your Kubernetes cluster:
$ kubectl -n <my_namespace> create -f my-awscognito-containersource.yaml
As a Deployment object bound by a SinkBinding
Copy the sample manifest from config/samples/awscognito-sinkbinding.yaml
and replace the pre-filled environment
variables under env
with the values corresponding to your AWS Cognito identity pool. Then, create the Deployment
and SinkBinding
objects in your Kubernetes cluster:
$ kubectl -n <my_namespace> create -f my-awscognito-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_identity_pool>
export AWS_ACCESS_KEY_ID=<my_key_id>
export AWS_SECRET_ACCESS_KEY=<my_secret_key>
export NAME=my-awscognitoidentitysource
export NAMESPACE=default
export K_LOGGING_CONFIG=''
export K_METRICS_CONFIG='{"domain":"triggermesh.io/sources", "component":"awscognitoidentitysource", "configMap":{}}'
Then, run the event source with:
$ go run ./cmd/awscognitoidentitysource
In a Docker container
Using one of TriggerMesh's release images:
$ docker run --rm \
-e ARN=<arn_of_my_identity_pool> \
-e AWS_ACCESS_KEY_ID=<my_key_id> \
-e AWS_SECRET_ACCESS_KEY=<my_secret_key> \
-e NAME=my-awscognitoidentitysource \
-e NAMESPACE=default \
-e K_LOGGING_CONFIG='' \
-e K_METRICS_CONFIG='{"domain":"triggermesh.io/sources", "component":"awscognitoidentitysource", "configMap":{}}' \
gcr.io/triggermesh/awscognitoidentitysource:latest
Documentation ¶
There is no documentation for this package.