Registry / devops / aws-cdk-aws-events-targets

aws-cdk-aws-events-targets

JSON →
library1.204.0pypypi✓ verified 84d ago

AWS CDK (Cloud Development Kit) library providing constructs for Amazon EventBridge event targets. Version 1.204.0 is the latest in the CDK v1 line. This library is part of the AWS CDK v1 which is in maintenance mode, with v2 being the actively developed version. Release cadence is typically weekly with minor releases.

pip install aws-cdk-aws-events-targets==1.204.0
INSTALL
IMPORT
SIG · AWS-CDK-AWS-EVENTS
A
aws-cdk-aws-events-targets
devopspythonv1.204.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LambdaFunction
from aws_cdk.aws_events_targets import LambdaFunction
from aws_cdk.aws_events import LambdaFunction
LambdaFunction is a target, not in aws-events
SqsQueue
from aws_cdk.aws_events_targets import SqsQueue
from aws_cdk.aws_sqs import SqsQueue as target
Incorrect import path; should use events_targets
SnsTopic
from aws_cdk.aws_events_targets import SnsTopic
from aws_cdk.aws_sns import SnsTopic as target
Incorrect import path; should use events_targets

Creates a Lambda function triggered by a scheduled EventBridge rule.

from aws_cdk import core from aws_cdk import aws_events as events from aws_cdk import aws_events_targets as targets from aws_cdk import aws_lambda as lambda_ app = core.App() stack = core.Stack(app, "MyStack") fn = lambda_.Function(stack, "MyFunction", runtime=lambda_.Runtime.PYTHON_3_7, handler="index.handler", code=lambda_.Code.from_inline("def handler(event, context):\n print(event)") ) rule = events.Rule(stack, "MyRule", schedule=events.Schedule.rate(core.Duration.minutes(5)) ) rule.add_target(targets.LambdaFunction(fn)) app.synth()
Debug
Known issues
gotchaAll event targets accept a `bind` parameter for providing additional IAM permissions, but not all targets handle it the same way. For example, LambdaFunction requires explicit permission to be invoked by EventBridge, which is automatically added when you add the target to a rule. However, for custom targets, you might need to manually add permissions.
fix
Always check the official CDK documentation for the specific target's IAM requirements.
affects: all
breakingMigrating from CDK v1 to v2 changes the import paths and class names. The module `aws-cdk-aws-events-targets` is not available in v2; instead, targets are part of the `aws-cdk-lib/aws-events-targets` module.
fix
For CDK v2, use `from aws_cdk import aws_events_targets` or `from aws-cdk-lib.aws-events-targets import ...`.
affects: v1 vs v2
deprecatedThe `codebuild` and `ecs` targets were deprecated in CDK v1 and removed in v2. Use the `aws-cdk-lib.aws-events-targets` equivalents.
fix
For CDK v1, check latest docs for deprecated targets. Migrate to v2 for up-to-date constructs.
affects: >=1.100.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aws_cdk.aws_events_targets'
Missing dependency or wrong CDK version (e.g., CDK v2 does not have this module).
fix
Install the correct version: `pip install aws-cdk-aws-events-targets==1.204.0`. For CDK v2, use `aws-cdk-lib`.
AttributeError: module 'aws_cdk.aws_events_targets' has no attribute 'LambdaFunction'
Import path typo (e.g., using `LambdaFunction` from `aws_events`).
fix
Use `from aws_cdk.aws_events_targets import LambdaFunction`.
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk.corerequiredCDK core library required
aws-cdk.aws-eventsrequiredEvent buses and rules
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
2
Resources
aws-cdk-aws-events-targets — pip install aws-cdk-aws-events-targets · libregistry