1
1
# AWS Target for Knative Eventing
2
2
3
- This event target allows for invoking several types of AWS services. Currently,
4
- this target supports:
5
- * Lambdas
6
- * SNS
7
- * SQS
8
- * Kinesis
3
+ This event target receives [ CloudEvents] [ ce ] over HTTP, and can send to a
4
+ defined AWS service. Currently, this target supports:
9
5
10
- ## Prerequisites
11
-
12
- Utilizing any of the AWS services requires that they already exist, and the AWS
13
- credentials in use will have access to invoke the underlying services.
14
-
15
- ## Controller Deployment
16
-
17
- ### Kubernetes Manifests
18
-
19
- // TODO use our images
20
-
21
- ### From Code
22
-
23
- You can use the [ ko] ( https://github.com/google/ko ) tool to compile and deploy from source.
24
-
25
- ``` console
26
- ko create -f ./config
27
- ```
6
+ - Lambdas
7
+ - SNS
8
+ - SQS
9
+ - Kinesis
28
10
29
- ## Adding the AWS Secrets
30
-
31
- A set of AWS API keys will need to be created and added to the same namespace
32
- hosting the target, and would resemble:
11
+ ## Prerequisites
33
12
34
- ``` yaml
35
- apiVersion : v1
36
- kind : Secret
37
- metadata :
38
- name : aws
39
- type : Opaque
40
- stringData :
41
- AWS_ACCESS_KEY_ID : <REPLACE ME WITH A REAL KEY>
42
- AWS_SECRET_ACCESS_KEY : <REPLACE ME WITH A REAL SECRET>
43
- ` ` `
13
+ Utilizing any of the AWS services requires that the targeted services already
14
+ exist, and the AWS API credentials in use will have access to invoke the
15
+ underlying services.
44
16
45
17
## Creating an AWS Service Target
46
18
47
- Once the AWS Target Controller has been deployed, a target for Lambdas, SNS, and
48
- SQS can be created by defining an AwsTarget object:
19
+ At Triggermesh, create a new aws secret based on the API credentials from the
20
+ prerequisites.
49
21
22
+ A sample target would resemble the following:
50
23
``` yaml
51
24
apiVersion : targets.triggermesh.io/v1alpha1
52
25
kind : AWSTarget
53
26
metadata :
54
- name : triggermesh-aws-lambda
27
+ name : <UNIQUE TARGET NAME>
55
28
spec :
56
- lambda :
57
- arn : arn:aws:lambda:us-west-2:043455440429:function:snslistener
29
+ <AWS SERVICE> :
30
+ arn : <SERVICE ARN>
31
+ partition : <KINESIS PARTITION>
58
32
awsApiKey :
59
33
secretKeyRef :
60
34
name : aws
61
- key : AWS_ACCESS_KEY_ID
35
+ key : aws_access_key_id
62
36
awsApiSecret :
63
37
secretKeyRef :
64
38
name : aws
65
- key : AWS_SECRET_ACCESS_KEY
39
+ key : aws_secret_access_key
66
40
` ` `
67
41
68
- The sub spec can be one of: lambda, sns, sqs, or kenisis. Note that the Kinesis target will be a little different:
69
- ` ` ` yaml
70
- apiVersion : targets.triggermesh.io/v1alpha1
71
- kind : AWSTarget
72
- metadata :
73
- name : triggermesh-aws-kinesis
74
- spec :
75
- kinesis :
76
- arn : arn:aws:kinesis:us-west-2:043455440429:stream/cabtest
77
- partition : " test"
78
- awsApiKey :
79
- secretKeyRef :
80
- name : aws
81
- key : AWS_ACCESS_KEY_ID
82
- awsApiSecret :
83
- secretKeyRef :
84
- name : aws
85
- key : AWS_SECRET_ACCESS_KEY
86
- ` ` `
87
-
88
- _NOTE: The ` AWS_ACCESS_KEY` and `AWS_SECRET_ACCESS_KEY` secrets must be installed
89
- and accessible to the target service_.
42
+ When used in the Bridge, ensure that the Generic Target is used, and when copying the sample target yaml from above, replace ` <AWS SERVICE>` with:
90
43
91
- # # AWS Target as an Event Sink
44
+ - lambda
45
+ - sns
46
+ - sqs
47
+ - kinesis
92
48
93
- Lastly, a triggering mechanism needs to be added to listen for a Knative
94
- event .
49
+ In addition, the `partition` line is required and the `<KINESIS PARTITION>` entry
50
+ will need to be updated with the Kinesis partition name. Otherwise, it can be removed .
95
51
96
- ` ` ` yaml
97
- apiVersion: eventing.knative.dev/v1beta1
98
- kind: Trigger
99
- metadata:
100
- name: aws-sample-lambda-trigger
101
- spec:
102
- broker: default
103
- subscriber:
104
- ref:
105
- apiVersion: targets.triggermesh.io/v1alpha1
106
- kind: AWSTarget
107
- name: triggermesh-aws-lambda
108
-
109
- ` ` `
110
-
111
- For additional samples, take a look at the [samples](samples/) path.
52
+ Lastly, update `<UNIQUE TARGET NAME>` to reflect a name for the target that will be referenced by the bridge trigger.
112
53
113
54
# # Triggering an AWS Service via the Target
114
55
@@ -125,4 +66,9 @@ curl -v http://triggermesh-aws-lambda.default.svc.cluster.local \
125
66
-H "Ce-Source: awesome/instance" \
126
67
-H "Ce-Id: 536808d3-88be-4077-9d7a-a3f162705f79" \
127
68
-d '{"greeting":"Hi from TriggerMesh"}'
128
- ` ` `
69
+ ` ` `
70
+
71
+ *NOTE*: The body of the event is freeform and meant to be interpreted by the
72
+ target service.
73
+
74
+ [ce] : https://cloudevents.io
0 commit comments