This documentation is for the developer preview release of the AWS CDK. Do not use this version of the AWS CDK in production. Subsequent releases of the AWS CDK will likely include breaking changes.

@aws-cdk/aws-events

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'
    }
});

Reference

View in Nuget

csproj:

<PackageReference Include="Amazon.CDK.AWS.Events" Version="0.25.3" />

dotnet:

dotnet add package Amazon.CDK.AWS.Events --version 0.25.3

packages.config:

<package id="Amazon.CDK.AWS.Events" version="0.25.3" />

View in Maven Central

Apache Buildr:

'software.amazon.awscdk:events:jar:0.25.3'

Apache Ivy:

<dependency groupId="software.amazon.awscdk" name="events" rev="0.25.3"/>

Apache Maven:

<dependency>
  <groupId>software.amazon.awscdk</groupId>
  <artifactId>events</artifactId>
  <version>0.25.3</version>
</dependency>

Gradle / Grails:

compile 'software.amazon.awscdk:events:0.25.3'

Groovy Grape:

@Grapes(
@Grab(group='software.amazon.awscdk', module='events', version='0.25.3')
)

View in NPM

npm:

$ npm i @aws-cdk/aws-events@0.25.3

package.json:

{
  "@aws-cdk/aws-events": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-events@0.25.3

View in NPM

npm:

$ npm i @aws-cdk/aws-events@0.25.3

package.json:

{
  "@aws-cdk/aws-events": "^0.25.3"
}

yarn:

$ yarn add @aws-cdk/aws-events@0.25.3

CfnEventBusPolicy

class @aws-cdk/aws-events.CfnEventBusPolicy(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnEventBusPolicy;
const { CfnEventBusPolicy } = require('@aws-cdk/aws-events');
import { CfnEventBusPolicy } from '@aws-cdk/aws-events';
Extends:

@aws-cdk/cdk.Resource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
eventBusPolicyId
Type:string (readonly)
propertyOverrides
Type:CfnEventBusPolicyProps (readonly)
class ConditionProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnEventBusPolicy.ConditionProperty;
// CfnEventBusPolicy.ConditionProperty is an interface
import { CfnEventBusPolicy.ConditionProperty } from '@aws-cdk/aws-events';
key

CfnEventBusPolicy.ConditionProperty.Key

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-eventbuspolicy-condition.html#cfn-events-eventbuspolicy-condition-key

Type:string (optional)
type

CfnEventBusPolicy.ConditionProperty.Type

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-eventbuspolicy-condition.html#cfn-events-eventbuspolicy-condition-type

Type:string (optional)
value

CfnEventBusPolicy.ConditionProperty.Value

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-eventbuspolicy-condition.html#cfn-events-eventbuspolicy-condition-value

Type:string (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnEventBusPolicyProps (interface)

class @aws-cdk/aws-events.CfnEventBusPolicyProps

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnEventBusPolicyProps;
// CfnEventBusPolicyProps is an interface
import { CfnEventBusPolicyProps } from '@aws-cdk/aws-events';
action

AWS::Events::EventBusPolicy.Action

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbuspolicy.html#cfn-events-eventbuspolicy-action

Type:string
principal

AWS::Events::EventBusPolicy.Principal

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbuspolicy.html#cfn-events-eventbuspolicy-principal

Type:string
statementId

AWS::Events::EventBusPolicy.StatementId

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbuspolicy.html#cfn-events-eventbuspolicy-statementid

Type:string
condition

AWS::Events::EventBusPolicy.Condition

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbuspolicy.html#cfn-events-eventbuspolicy-condition

Type:ConditionProperty or @aws-cdk/cdk.Token (optional)

CfnRule

class @aws-cdk/aws-events.CfnRule(scope, id[, props])

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule;
const { CfnRule } = require('@aws-cdk/aws-events');
import { CfnRule } from '@aws-cdk/aws-events';
Extends:

@aws-cdk/cdk.Resource

Parameters:
  • scope (@aws-cdk/cdk.Construct) – scope in which this resource is defined
  • id (string) – scoped id of the resource
  • props (CfnRuleProps (optional)) – resource properties
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.Resource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
propertyOverrides
Type:CfnRuleProps (readonly)
ruleArn
Type:string (readonly)
ruleId
Type:string (readonly)
class EcsParametersProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule.EcsParametersProperty;
// CfnRule.EcsParametersProperty is an interface
import { CfnRule.EcsParametersProperty } from '@aws-cdk/aws-events';
taskDefinitionArn

CfnRule.EcsParametersProperty.TaskDefinitionArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html#cfn-events-rule-ecsparameters-taskdefinitionarn

Type:string
taskCount

CfnRule.EcsParametersProperty.TaskCount

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html#cfn-events-rule-ecsparameters-taskcount

Type:number or @aws-cdk/cdk.Token (optional)
class InputTransformerProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule.InputTransformerProperty;
// CfnRule.InputTransformerProperty is an interface
import { CfnRule.InputTransformerProperty } from '@aws-cdk/aws-events';
inputTemplate

CfnRule.InputTransformerProperty.InputTemplate

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-inputtransformer.html#cfn-events-rule-inputtransformer-inputtemplate

Type:string
inputPathsMap

CfnRule.InputTransformerProperty.InputPathsMap

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-inputtransformer.html#cfn-events-rule-inputtransformer-inputpathsmap

Type:@aws-cdk/cdk.Token or string => (string or @aws-cdk/cdk.Token) (optional)
class KinesisParametersProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule.KinesisParametersProperty;
// CfnRule.KinesisParametersProperty is an interface
import { CfnRule.KinesisParametersProperty } from '@aws-cdk/aws-events';
partitionKeyPath

CfnRule.KinesisParametersProperty.PartitionKeyPath

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-kinesisparameters.html#cfn-events-rule-kinesisparameters-partitionkeypath

Type:string
class RunCommandParametersProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule.RunCommandParametersProperty;
// CfnRule.RunCommandParametersProperty is an interface
import { CfnRule.RunCommandParametersProperty } from '@aws-cdk/aws-events';
runCommandTargets

CfnRule.RunCommandParametersProperty.RunCommandTargets

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandparameters.html#cfn-events-rule-runcommandparameters-runcommandtargets

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or RunCommandTargetProperty)[]
class RunCommandTargetProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule.RunCommandTargetProperty;
// CfnRule.RunCommandTargetProperty is an interface
import { CfnRule.RunCommandTargetProperty } from '@aws-cdk/aws-events';
key

CfnRule.RunCommandTargetProperty.Key

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandtarget.html#cfn-events-rule-runcommandtarget-key

Type:string
values

CfnRule.RunCommandTargetProperty.Values

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandtarget.html#cfn-events-rule-runcommandtarget-values

Type:@aws-cdk/cdk.Token or (string or @aws-cdk/cdk.Token)[]
class SqsParametersProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule.SqsParametersProperty;
// CfnRule.SqsParametersProperty is an interface
import { CfnRule.SqsParametersProperty } from '@aws-cdk/aws-events';
messageGroupId

CfnRule.SqsParametersProperty.MessageGroupId

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-sqsparameters.html#cfn-events-rule-sqsparameters-messagegroupid

Type:string
class TargetProperty

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRule.TargetProperty;
// CfnRule.TargetProperty is an interface
import { CfnRule.TargetProperty } from '@aws-cdk/aws-events';
arn

CfnRule.TargetProperty.Arn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-arn

Type:string
id

CfnRule.TargetProperty.Id

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-id

Type:string
ecsParameters

CfnRule.TargetProperty.EcsParameters

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-ecsparameters

Type:EcsParametersProperty or @aws-cdk/cdk.Token (optional)
input

CfnRule.TargetProperty.Input

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-input

Type:string (optional)
inputPath

CfnRule.TargetProperty.InputPath

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-inputpath

Type:string (optional)
inputTransformer

CfnRule.TargetProperty.InputTransformer

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-inputtransformer

Type:@aws-cdk/cdk.Token or InputTransformerProperty (optional)
kinesisParameters

CfnRule.TargetProperty.KinesisParameters

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-kinesisparameters

Type:KinesisParametersProperty or @aws-cdk/cdk.Token (optional)
roleArn

CfnRule.TargetProperty.RoleArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-rolearn

Type:string (optional)
runCommandParameters

CfnRule.TargetProperty.RunCommandParameters

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-runcommandparameters

Type:RunCommandParametersProperty or @aws-cdk/cdk.Token (optional)
sqsParameters

CfnRule.TargetProperty.SqsParameters

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-sqsparameters

Type:@aws-cdk/cdk.Token or SqsParametersProperty (optional)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)
ref

Inherited from @aws-cdk/cdk.Referenceable

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.Resource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.Resource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.Resource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.Resource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.Resource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.Resource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
toCloudFormation() → json

Inherited from @aws-cdk/cdk.Resource

Emits CloudFormation for this resource.

Return type:json
options

Inherited from @aws-cdk/cdk.Resource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.ResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.Resource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.Resource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.Resource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.StackElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.StackElement

Automatically detect references in this StackElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.StackElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.StackElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.StackElement

Return the path with respect to the stack

Type:string (readonly)

CfnRuleProps (interface)

class @aws-cdk/aws-events.CfnRuleProps

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.CfnRuleProps;
// CfnRuleProps is an interface
import { CfnRuleProps } from '@aws-cdk/aws-events';
description

AWS::Events::Rule.Description

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-description

Type:string (optional)
eventPattern

AWS::Events::Rule.EventPattern

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern

Type:json or @aws-cdk/cdk.Token (optional)
name

AWS::Events::Rule.Name

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-name

Type:string (optional)
roleArn

AWS::Events::Rule.RoleArn

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-rolearn

Type:string (optional)
scheduleExpression

AWS::Events::Rule.ScheduleExpression

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-scheduleexpression

Type:string (optional)
state

AWS::Events::Rule.State

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-state

Type:string (optional)
targets

AWS::Events::Rule.Targets

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-targets

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or TargetProperty)[] (optional)

EventPattern (interface)

class @aws-cdk/aws-events.EventPattern

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.EventPattern;
// EventPattern is an interface
import { EventPattern } from '@aws-cdk/aws-events';

Events in Amazon CloudWatch Events are represented as JSON objects. For more

information about JSON objects, see RFC 7159.

Rules use event patterns to select events and route them to targets. A

pattern either matches an event or it doesn’t. Event patterns are represented

as JSON objects with a structure that is similar to that of events, for

example:

It is important to remember the following about event pattern matching:

  • For a pattern to match an event, the event must contain all the field names

    listed in the pattern. The field names must appear in the event with the

    same nesting structure.

  • Other fields of the event not mentioned in the pattern are ignored;

    effectively, there is a "*": "*" wildcard for fields not mentioned.

  • The matching is exact (character-by-character), without case-folding or any

    other string normalization.

  • The values being matched follow JSON rules: Strings enclosed in quotes,

    numbers, and the unquoted keywords true, false, and null.

  • Number matching is at the string representation level. For example, 300,

    300.0, and 3.0e2 are not considered equal.

account

The 12-digit number identifying an AWS account.

Type:string[] (optional)
detail

A JSON object, whose content is at the discretion of the service

originating the event.

Type:any (optional)
detailType

Identifies, in combination with the source field, the fields and values

that appear in the detail field.

Represents the “detail-type” event field.

Type:string[] (optional)
id

A unique value is generated for every event. This can be helpful in

tracing events as they move through rules to targets, and are processed.

Type:string[] (optional)
region

Identifies the AWS region where the event originated.

Type:string[] (optional)
resources

This JSON array contains ARNs that identify resources that are involved

in the event. Inclusion of these ARNs is at the discretion of the

service.

For example, Amazon EC2 instance state-changes include Amazon EC2

instance ARNs, Auto Scaling events include ARNs for both instances and

Auto Scaling groups, but API calls with AWS CloudTrail do not include

resource ARNs.

Type:string[] (optional)
source

Identifies the service that sourced the event. All events sourced from

within AWS begin with “aws.” Customer-generated events can have any value

here, as long as it doesn’t begin with “aws.” We recommend the use of

Java package-name style reverse domain-name strings.

To find the correct value for source for an AWS service, see the table in

AWS Service Namespaces. For example, the source value for Amazon

CloudFront is aws.cloudfront.

Type:string[] (optional)
time

The event timestamp, which can be specified by the service originating

the event. If the event spans a time interval, the service might choose

to report the start time, so this value can be noticeably before the time

the event is actually received.

Type:string[] (optional)
version

By default, this is set to 0 (zero) in all events.

Type:string[] (optional)

EventRule

class @aws-cdk/aws-events.EventRule(scope, id[, props])

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.EventRule;
const { EventRule } = require('@aws-cdk/aws-events');
import { EventRule } from '@aws-cdk/aws-events';

Defines a CloudWatch Event Rule in this stack.

Extends:

@aws-cdk/cdk.Construct

Implements:

IEventRule

Parameters:
static import(scope, id, props) → @aws-cdk/aws-events.IEventRule

Imports a rule by ARN into this stack.

Parameters:
Return type:

IEventRule

addEventPattern([eventPattern])

Adds an event pattern filter to this rule. If a pattern was already specified,

these values are merged into the existing pattern.

For example, if the rule already contains the pattern:

{

“resources”: [ “r1” ],

“detail”: {

“hello”: [ 1 ]

}

}

And addEventPattern is called with the pattern:

{

“resources”: [ “r2” ],

“detail”: {

“foo”: [ “bar” ]

}

}

The resulting event pattern will be:

{

“resources”: [ “r1”, “r2” ],

“detail”: {

“hello”: [ 1 ],

“foo”: [ “bar” ]

}

}

Parameters:eventPattern (EventPattern (optional)) –
addTarget([target[, inputOptions]])

Adds a target to the rule. The abstract class RuleTarget can be extended to define new

targets.

No-op if target is undefined.

Parameters:
export() → @aws-cdk/aws-events.EventRuleImportProps

Implements @aws-cdk/aws-events.IEventRule.export()

Exports this rule resource from this stack and returns an import token.

Return type:EventRuleImportProps
validate() → string[]

Overrides @aws-cdk/cdk.Construct.validate()

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Return type:string[]
ruleArn

Implements @aws-cdk/aws-events.IEventRule.ruleArn()

The value of the event rule Amazon Resource Name (ARN), such as

arn:aws:events:us-east-2:123456789012:rule/example.

Type:string (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

EventRuleImportProps (interface)

class @aws-cdk/aws-events.EventRuleImportProps

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.EventRuleImportProps;
// EventRuleImportProps is an interface
import { EventRuleImportProps } from '@aws-cdk/aws-events';
eventRuleArn

The value of the event rule Amazon Resource Name (ARN), such as

arn:aws:events:us-east-2:123456789012:rule/example.

Type:string

EventRuleProps (interface)

class @aws-cdk/aws-events.EventRuleProps

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.EventRuleProps;
// EventRuleProps is an interface
import { EventRuleProps } from '@aws-cdk/aws-events';
description

A description of the rule’s purpose.

Type:string (optional)
enabled

Indicates whether the rule is enabled.

Type:boolean (optional)
Default:Rule is enabled
eventPattern

Describes which events CloudWatch Events routes to the specified target.

These routed events are matched events. For more information, see Events

and Event Patterns in the Amazon CloudWatch User Guide.

Type:EventPattern (optional)
ruleName

A name for the rule. If you don’t specify a name, AWS CloudFormation

generates a unique physical ID and uses that ID for the rule name. For

more information, see Name Type.

Type:string (optional)
scheduleExpression

The schedule or rate (frequency) that determines when CloudWatch Events

runs the rule. For more information, see Schedule Expression Syntax for

Rules in the Amazon CloudWatch User Guide.

Type:string (optional)
targets

Targets to invoke when this rule matches an event.

Input will be the full matched event. If you wish to specify custom

target input, use addTarget(target[, inputOptions]).

Type:IEventRuleTarget[] (optional)

EventRuleTargetProps (interface)

class @aws-cdk/aws-events.EventRuleTargetProps

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.EventRuleTargetProps;
// EventRuleTargetProps is an interface
import { EventRuleTargetProps } from '@aws-cdk/aws-events';
arn

The Amazon Resource Name (ARN) of the target.

Type:string
id

A unique, user-defined identifier for the target. Acceptable values

include alphanumeric characters, periods (.), hyphens (-), and

underscores (_).

Type:string
ecsParameters

The Amazon ECS task definition and task count to use, if the event target

is an Amazon ECS task.

Type:EcsParametersProperty (optional)
kinesisParameters

Settings that control shard assignment, when the target is a Kinesis

stream. If you don’t include this parameter, eventId is used as the

partition key.

Type:KinesisParametersProperty (optional)
roleArn

The Amazon Resource Name (ARN) of the AWS Identity and Access Management

(IAM) role to use for this target when the rule is triggered. If one rule

triggers multiple targets, you can use a different IAM role for each

target.

Type:string (optional)
runCommandParameters

Parameters used when the rule invokes Amazon EC2 Systems Manager Run

Command.

Type:RunCommandParametersProperty (optional)

IEventRule (interface)

class @aws-cdk/aws-events.IEventRule

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.IEventRule;
// IEventRule is an interface
import { IEventRule } from '@aws-cdk/aws-events';
Extends:@aws-cdk/cdk.IConstruct
ruleArn

The value of the event rule Amazon Resource Name (ARN), such as

arn:aws:events:us-east-2:123456789012:rule/example.

Type:string (readonly)
export() → @aws-cdk/aws-events.EventRuleImportProps

Exports this rule resource from this stack and returns an import token.

Return type:EventRuleImportProps
Abstract:Yes
node

Inherited from @aws-cdk/cdk.IConstruct

The construct node in the scope tree.

Type:@aws-cdk/cdk.ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)

IEventRuleTarget (interface)

class @aws-cdk/aws-events.IEventRuleTarget

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.IEventRuleTarget;
// IEventRuleTarget is an interface
import { IEventRuleTarget } from '@aws-cdk/aws-events';

An abstract target for EventRules.

asEventRuleTarget(ruleArn, ruleUniqueId) → @aws-cdk/aws-events.EventRuleTargetProps

Returns the rule target specification.

NOTE: Do not use the various inputXxx options. They can be set in a call to addTarget.

Parameters:
  • ruleArn (string) – The ARN of the CloudWatch Event Rule that would trigger this target.
  • ruleUniqueId (string) – A unique ID for this rule. Can be used to implement idempotency.
Return type:

EventRuleTargetProps

Abstract:

Yes

TargetInputTemplate (interface)

class @aws-cdk/aws-events.TargetInputTemplate

Language-specific names:

using Amazon.CDK.AWS.Events;
import software.amazon.awscdk.services.events.TargetInputTemplate;
// TargetInputTemplate is an interface
import { TargetInputTemplate } from '@aws-cdk/aws-events';

Specifies settings that provide custom input to an Amazon CloudWatch Events

rule target based on certain event data.

jsonTemplate

Input template where you can use the values of the keys from

inputPathsMap to customize the data sent to the target. Enclose each

InputPathsMaps value in brackets: <value>

This option is mutually exclusive with textTemplate.

Type:any (optional)
pathsMap

Map of JSON paths to be extracted from the event. These are key-value

pairs, where each value is a JSON path. You must use JSON dot notation,

not bracket notation.

Type:string => string (optional)
textTemplate

Input template where you can use the values of the keys from

inputPathsMap to customize the data sent to the target. Enclose each

InputPathsMaps value in brackets: <value>

The value passed here will be double-quoted to indicate it’s a string value.

This option is mutually exclusive with jsonTemplate.

Type:string (optional)