Skip to main content

Target

Manages a CloudWatch Event Target.

Sample code

Target to an SQS Queue

exports.createResources = () => [
{
type: "Target",
group: "CloudWatchEvents",
properties: ({}) => ({
Id: "S3NewImageEvent",
}),
dependencies: () => ({
rule: "sam-app-S3NewImageEvent",
sqsQueue: "sam-app-NewImageEventQueue",
}),
},
];

Target to a StepFunction State Machine

exports.createResources = () => [
{
type: "Target",
group: "CloudWatchEvents",
properties: ({}) => ({
Id: "terraform-20220331194525125100000008",
}),
dependencies: () => ({
rule: "terraform-20220331194511828000000002",
role: "terraform-20220331194511828200000005",
sfnStateMachine: "eventbridge-state-machine-demo",
}),
},
];

Target to a Log Group

exports.createResources = () => [
{
type: "Target",
group: "CloudWatchEvents",
properties: ({}) => ({
Id: "CloudWatchLogTarget",
}),
dependencies: () => ({
rule: "sam-app-EventBusLogRule",
logGroup: "/aws/events/sam-app",
}),
},
];

Properties

Dependencies

Full Examples

List

The rules can be filtered with the CloudWatchEvents::Target type:

gc l -t CloudWatchEvents::Target
Listing resources on 1 provider: aws
✓ aws
✓ Initialising
✓ Listing 3/3
┌───────────────────────────────────────────────────────────────────────┐
│ 1 CloudWatchEvents::Target from aws │
├───────────────────────────────────────────────────────────────────────┤
│ name: target::AutoScalingManagedRule::autoscaling │
│ managedByUs: NO │
│ live: │
│ Arn: arn:aws:autoscaling:us-east-1::: │
│ Id: autoscaling │
│ Rule: AutoScalingManagedRule │
│ EventBusName: default │
│ │
└───────────────────────────────────────────────────────────────────────┘


List Summary:
Provider: aws
┌──────────────────────────────────────────────────────────────────────┐
│ aws │
├──────────────────────────┬───────────────────────────────────────────┤
│ CloudWatchEvents::Target │ target::AutoScalingManagedRule::autoscal… │
└──────────────────────────┴───────────────────────────────────────────┘
1 resource, 1 type, 1 provider
Command "gc l -t CloudWatchEvents::Target" executed in 5s, 170 MB