ProvisionedPollerConfig

class aws_cdk.aws_lambda_event_sources.ProvisionedPollerConfig(*, maximum_pollers, minimum_pollers, poller_group_name=None)

Bases: object

(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.

Parameters:
  • maximum_pollers (Union[int, float]) – The maximum number of pollers that can be provisioned. Default: 200

  • minimum_pollers (Union[int, float]) – The minimum number of pollers that should be provisioned. Default: 1

  • poller_group_name (Optional[str]) – An optional identifier that groups multiple ESMs to share EPU capacity and reduce costs. ESMs with the same PollerGroupName share compute resources. Default: - not set, dedicated compute resource per event source.

ExampleMetadata:

infused

Example:

from aws_cdk.aws_lambda_event_sources import ProvisionedPollerConfig
from aws_cdk.aws_lambda_event_sources import ManagedKafkaEventSource

# my_function: lambda.Function


# Your MSK cluster arn
cluster_arn = "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4"

# Enable basic event and error metrics
my_function.add_event_source(ManagedKafkaEventSource(
    cluster_arn=cluster_arn,
    topic="basic-monitoring",
    starting_position=lambda_.StartingPosition.LATEST,
    # Provisioned mode is required for observability features
    provisioned_poller_config=ProvisionedPollerConfig(
        minimum_pollers=2,
        maximum_pollers=10
    ),
    metrics_config=lambda.MetricsConfig(
        metrics=[lambda_.MetricType.EVENT_COUNT, lambda_.MetricType.ERROR_COUNT
        ]
    )
))

Attributes

maximum_pollers

The maximum number of pollers that can be provisioned.

Default:

200

minimum_pollers

The minimum number of pollers that should be provisioned.

Default:

1

poller_group_name

An optional identifier that groups multiple ESMs to share EPU capacity and reduce costs.

ESMs with the same PollerGroupName share compute resources.

Default:
  • not set, dedicated compute resource per event source.