Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
aws_events
✓ from aws_cdk import aws_events
✗ import aws_cdk_aws_events
CDK v1 construct libraries are imported as submodules of `aws_cdk`, not directly using their PyPI package name.
This quickstart demonstrates how to create an EventBridge rule that triggers a Lambda function every 5 minutes using `aws-cdk-aws-events` within an AWS CDK v1 application. Run `cdk deploy` after `app.synth()` to deploy.
import aws_cdk as cdk
from aws_cdk import aws_events
from aws_cdk import aws_events_targets as targets
from aws_cdk import aws_lambda as lambda_
class MyEventStack(cdk.Stack):
def __init__(self, scope: cdk.App, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Define a simple Lambda function to be a target
my_lambda = lambda_.Function(
self, "MyEventHandler",
runtime=lambda_.Runtime.PYTHON_3_9,
handler="index.handler",
code=lambda_.Code.from_inline("import json; def handler(event, context): print(json.dumps(event)); return 'OK'")
)
# Create an EventBridge rule that triggers every 5 minutes
rule = aws_events.Rule(
self, "MyScheduleRule",
schedule=aws_events.Schedule.rate(cdk.Duration.minutes(5)),
description="Rule that triggers every 5 minutes"
)
# Add the Lambda function as a target for the rule
rule.add_target(targets.LambdaFunction(my_lambda))
app = cdk.App()
MyEventStack(app, "MyEventBridgeStack")
app.synth()
cdk --version
Debug
Known issues
breakingAWS CDK v1 is in maintenance mode; new projects should use AWS CDK v2. Migrating from v1 to v2 involves significant breaking changes to package imports and construct APIs.fixFor new projects, install `aws-cdk-lib` and use v2 constructs. For existing v1 projects, consult the AWS CDK v2 migration guide before upgrading. Key changes include unified package imports (e.g., `from aws_cdk import aws_events` becomes `from aws_cdk_lib import aws_events`), removal of some L1 constructs, and updated construct signatures.
affects: All v1.x.x versions, when migrating to v2.x.x
gotchaForgetting to call `app.synth()` or run `cdk deploy` will result in no CloudFormation template generation or AWS resource deployment.fixEnsure `app.synth()` is called at the end of your CDK application entry point. After synthesis, use the AWS CDK CLI command `cdk deploy` (and `cdk bootstrap` if this is your first deployment to an environment) to provision resources in your AWS account.
affects: All v1.x.x
gotchaWhen defining EventBridge rules for cross-account or cross-region events, ensure proper permissions are granted and event bus policies are correctly configured. A common mistake is restricting the `Detail` field too broadly, preventing events from matching.fixReview EventBridge documentation for best practices on event patterns and permissions. Use `aws_events.EventBus.from_event_bus_arn()` for existing buses and ensure `PolicyStatement` is correctly attached to allow `events:PutEvents` from source accounts/regions.
affects: All v1.x.x
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
No dependency data recorded yet.