Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS EC2 Sink Kamelet #386

Merged
merged 4 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions aws-ec2-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: aws-ec2-sink
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjA2NSIgaGVpZ2h0PSIyNTAwIiB2aWV3Qm94PSIwIDAgMjU2IDMxMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTQyLjc1NCAyNDQuNDk1bC0yOS45MTggNi44MjZWNTcuNTY1bDI5LjkxOCA2LjgzOXYxODAuMDkxIiBmaWxsPSIjRjY4NTM2Ii8+PHBhdGggZD0iTTgwLjA4MiAyNTUuOTMxbC0zNy4zMjggMTAuNjA4VjQyLjYxMmwzNy4zMjggMTAuNTk1djIwMi43MjRNMTI3Ljk2NiAyNjcuNjgxbC00Ny44ODQgMTcuNTI0VjIzLjk0Nmw0Ny44ODQgMTcuNTE2djIyNi4yMTlNMjU2IDI0NS4wNzlsLTEyOC4wMzQgNjQuMDE3VjBMMjU2IDY0LjAxN3YxODEuMDYyIiBmaWxsPSIjRjY4NTM2Ii8+PHBhdGggZD0iTTEwMi40NDQgMTIuNzYzTDEyNy45NjYgMHYzMDkuMDk2bC0yNS41MjItMTIuNzU5VjEyLjc2M002MC4zMjUgMzMuODJsMTkuNzU3LTkuODc4djI2MS4yMTJsLTE5Ljc1Ny05Ljg3OFYzMy44Mk0yNy4wMTYgNTAuNDc3bDE1LjczOC03Ljg2OXYyMjMuODhsLTE1LjczOC03Ljg3NFY1MC40NzdNMTIuODM2IDU3LjU2NUwwIDYzLjk4M3YxODEuMTM0bDEyLjgzNiA2LjQxNFY1Ny41NjUiIGZpbGw9IiM5RDUwMjUiLz48L3N2Zz4="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "AWS EC2"
labels:
camel.apache.org/kamelet.type: sink
spec:
definition:
title: AWS EC2 Sink
description: |-
Check the status of EC2 instances

The Kamelet expects the following headers to be set:

- `instanceIds` / `ce-instanceIds`: as a comma separated list of EC2 instance ids.
required:
- accessKey
- secretKey
- region
type: object
properties:
accessKey:
title: Access Key
description: The access key obtained from AWS
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
secretKey:
title: Secret Key
description: The secret key obtained from AWS
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
region:
title: AWS Region
description: The AWS region to connect to
type: string
example: eu-west-1
dependencies:
- "camel:aws2-ec2"
- "camel:kamelet"
flow:
from:
uri: kamelet:source
steps:
- choice:
when:
- simple: "${header[instanceIds]}"
steps:
- set-header:
name: CamelAwsEC2InstancesIds
simple: "${header[instanceIds]}"
- simple: "${header[ce-instanceIds]}"
steps:
- set-header:
name: CamelAwsEC2InstancesIds
simple: "${header[ce-instanceIds]}"
- to:
uri: "aws2-ec2:ec2-route"
parameters:
accessKey: "{{accessKey}}"
secretKey: "{{secretKey}}"
region: "{{region}}"
operation: "monitorInstances"
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/kamelets/aws-ec2-sink.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* xref:ROOT:avro-serialize-action.adoc[image:kamelets/avro-serialize-action.svg[] Avro Serialize Action]
* xref:ROOT:aws-cloudwatch-sink.adoc[image:kamelets/aws-cloudwatch-sink.svg[] AWS CloudWatch Metrics Sink]
* xref:ROOT:aws-ddb-streams-source.adoc[image:kamelets/aws-ddb-streams-source.svg[] AWS DynamoDB Streams Source]
* xref:ROOT:aws-ec2-sink.adoc[image:kamelets/aws-ec2-sink.svg[] AWS EC2 Sink]
* xref:ROOT:aws-kinesis-firehose-sink.adoc[image:kamelets/aws-kinesis-firehose-sink.svg[] AWS Kinesis Firehose Sink]
* xref:ROOT:aws-kinesis-sink.adoc[image:kamelets/aws-kinesis-sink.svg[] AWS Kinesis Sink]
* xref:ROOT:aws-kinesis-source.adoc[image:kamelets/aws-kinesis-source.svg[] AWS Kinesis Source]
Expand Down
70 changes: 70 additions & 0 deletions docs/modules/ROOT/pages/aws-ec2-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/aws-ec2-sink.svg[] AWS EC2 Sink

*Provided by: "Apache Software Foundation"*

*Support Level for this Kamelet is: "Preview"*

Check the status of EC2 instances

The Kamelet expects the following headers to be set:

- `instanceIds` / `ce-instanceIds`: as a comma separated list of EC2 instance ids.

== Configuration Options

The following table summarizes the configuration options available for the `aws-ec2-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accessKey {empty}* *| Access Key| The access key obtained from AWS| string| |
| *region {empty}* *| AWS Region| The AWS region to connect to| string| | `"eu-west-1"`
| *secretKey {empty}* *| Secret Key| The secret key obtained from AWS| string| |
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `aws-ec2-sink` can be used in various contexts.

=== Knative Sink

The `aws-ec2-sink` Kamelet can be used as Knative sink by binding it to a Knative object.

.aws-ec2-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: aws-ec2-sink-binding
spec:
source:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: aws-ec2-sink
properties:
accessKey: "The Access Key"
region: "eu-west-1"
secretKey: "The Secret Key"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-ec2-sink-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

[source,shell]
----
kubectl apply -f aws-ec2-sink-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: aws-ec2-sink
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjA2NSIgaGVpZ2h0PSIyNTAwIiB2aWV3Qm94PSIwIDAgMjU2IDMxMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTQyLjc1NCAyNDQuNDk1bC0yOS45MTggNi44MjZWNTcuNTY1bDI5LjkxOCA2LjgzOXYxODAuMDkxIiBmaWxsPSIjRjY4NTM2Ii8+PHBhdGggZD0iTTgwLjA4MiAyNTUuOTMxbC0zNy4zMjggMTAuNjA4VjQyLjYxMmwzNy4zMjggMTAuNTk1djIwMi43MjRNMTI3Ljk2NiAyNjcuNjgxbC00Ny44ODQgMTcuNTI0VjIzLjk0Nmw0Ny44ODQgMTcuNTE2djIyNi4yMTlNMjU2IDI0NS4wNzlsLTEyOC4wMzQgNjQuMDE3VjBMMjU2IDY0LjAxN3YxODEuMDYyIiBmaWxsPSIjRjY4NTM2Ii8+PHBhdGggZD0iTTEwMi40NDQgMTIuNzYzTDEyNy45NjYgMHYzMDkuMDk2bC0yNS41MjItMTIuNzU5VjEyLjc2M002MC4zMjUgMzMuODJsMTkuNzU3LTkuODc4djI2MS4yMTJsLTE5Ljc1Ny05Ljg3OFYzMy44Mk0yNy4wMTYgNTAuNDc3bDE1LjczOC03Ljg2OXYyMjMuODhsLTE1LjczOC03Ljg3NFY1MC40NzdNMTIuODM2IDU3LjU2NUwwIDYzLjk4M3YxODEuMTM0bDEyLjgzNiA2LjQxNFY1Ny41NjUiIGZpbGw9IiM5RDUwMjUiLz48L3N2Zz4="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "AWS EC2"
labels:
camel.apache.org/kamelet.type: sink
spec:
definition:
title: AWS EC2 Sink
description: |-
Check the status of EC2 instances

The Kamelet expects the following headers to be set:

- `instanceIds` / `ce-instanceIds`: as a comma separated list of EC2 instance ids.
required:
- accessKey
- secretKey
- region
type: object
properties:
accessKey:
title: Access Key
description: The access key obtained from AWS
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
secretKey:
title: Secret Key
description: The secret key obtained from AWS
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
region:
title: AWS Region
description: The AWS region to connect to
type: string
example: eu-west-1
dependencies:
- "camel:aws2-ec2"
- "camel:kamelet"
flow:
from:
uri: kamelet:source
steps:
- choice:
when:
- simple: "${header[instanceIds]}"
steps:
- set-header:
name: CamelAwsEC2InstancesIds
simple: "${header[instanceIds]}"
- simple: "${header[ce-instanceIds]}"
steps:
- set-header:
name: CamelAwsEC2InstancesIds
simple: "${header[ce-instanceIds]}"
- to:
uri: "aws2-ec2:ec2-route"
parameters:
accessKey: "{{accessKey}}"
secretKey: "{{secretKey}}"
region: "{{region}}"
operation: "monitorInstances"