AWS CloudWatch Events Construct Library
Project description
AWS CloudWatch Events Construct Library
Amazon CloudWatch Events delivers a near real-time stream of system events that describe changes in AWS resources. For example, an AWS CodePipeline emits the State Change event when the pipeline changes it's state.
- Events: An event indicates a change in your AWS environment. AWS resources can generate events when their state changes. For example, Amazon EC2 generates an event when the state of an EC2 instance changes from pending to running, and Amazon EC2 Auto Scaling generates events when it launches or terminates instances. AWS CloudTrail publishes events when you make API calls. You can generate custom application-level events and publish them to CloudWatch Events. You can also set up scheduled events that are generated on a periodic basis. For a list of services that generate events, and sample events from each service, see CloudWatch Events Event Examples From Each Supported Service.
- Targets: A target processes events. Targets can include Amazon EC2 instances, AWS Lambda functions, Kinesis streams, Amazon ECS tasks, Step Functions state machines, Amazon SNS topics, Amazon SQS queues, and built-in targets. A target receives events in JSON format.
- Rules: A rule matches incoming events and routes them to targets for processing. A single rule can route to multiple targets, all of which are processed in parallel. Rules are not processed in a particular order. This enables different parts of an organization to look for and process the events that are of interest to them. A rule can customize the JSON sent to the target, by passing only certain parts or by overwriting it with a constant.
The EventRule
construct defines a CloudWatch events rule which monitors an
event based on an event
pattern
and invoke event targets when the pattern is matched against a triggered
event. Event targets are objects that implement the IEventTarget
interface.
Normally, you will use one of the source.onXxx(name[, target[, options]]) -> EventRule
methods on the event source to define an event rule associated with
the specific activity. You can targets either via props, or add targets using
rule.addTarget
.
For example, to define an rule that triggers a CodeBuild project build when a commit is pushed to the "master" branch of a CodeCommit repository:
const onCommitRule = repo.onCommit('OnCommitToMaster', project, 'master');
You can add additional targets, with optional input
transformer
using eventRule.addTarget(target[, input])
. For example, we can add a SNS
topic target which formats a human-readable message for the commit.
For example, this adds an SNS topic as a target:
onCommitRule.addTarget(topic, {
template: 'A commit was pushed to the repository <repo> on branch <branch>',
pathsMap: {
branch: '$.detail.referenceName',
repo: '$.detail.repositoryName'
}
});
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws-cdk.aws-events-0.26.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61b15fafeab5327eae683d8419b0f2532843b32d0ff0bdbe0af03fd979f4b09b |
|
MD5 | 33af8be5d52dbf56f156f07e8dd6b436 |
|
BLAKE2b-256 | 5399fdb6e4f4dc85823536de764683a7652d09fec3c11e48c71cc0e8066d94d1 |
Hashes for aws_cdk.aws_events-0.26.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1ddcc34d2b28d7c5b415fcb08109474fdc5df056ea1361db780773226758e14 |
|
MD5 | 67dc26a133623f0805c4e8c87ab4cf6a |
|
BLAKE2b-256 | f27ae1c4f4a3e77169fc94b1d8645e3b0619b76a1e16fdce7e60850cc75cea91 |