aws-solutions-constructs.aws-eventbridge-lambda


Nameaws-solutions-constructs.aws-eventbridge-lambda JSON
Version 2.74.0 PyPI version JSON
download
home_pagehttps://github.com/awslabs/aws-solutions-constructs.git
SummaryCDK Constructs for deploying AWS Events Rule that inveokes AWS Lambda
upload_time2024-10-22 18:09:21
maintainerNone
docs_urlNone
authorAmazon Web Services
requires_python~=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aws-eventbridge-lambda module

<!--BEGIN STABILITY BANNER-->---


![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)

---
<!--END STABILITY BANNER-->

| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|:-------------|:-------------|

<div style="height:8px"></div>

| **Language**     | **Package**        |
|:-------------|-----------------|
|![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_eventbridge_lambda`|
|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-eventbridge-lambda`|
|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.eventbridgelambda`|

## Overview

This AWS Solutions Construct implements an AWS EventBridge rule and an AWS Lambda function.

Here is a minimal deployable pattern definition:

Typescript

```python
import { Construct } from 'constructs';
import { Stack, StackProps, Duration } from 'aws-cdk-lib';
import { EventbridgeToLambdaProps, EventbridgeToLambda } from '@aws-solutions-constructs/aws-eventbridge-lambda';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as events from 'aws-cdk-lib/aws-events';

const constructProps: EventbridgeToLambdaProps = {
  lambdaFunctionProps: {
    code: lambda.Code.fromAsset(`lambda`),
    runtime: lambda.Runtime.NODEJS_16_X,
    handler: 'index.handler'
  },
  eventRuleProps: {
    schedule: events.Schedule.rate(Duration.minutes(5))
  }
};

new EventbridgeToLambda(this, 'test-eventbridge-lambda', constructProps);
```

Python

```python
from aws_solutions_constructs.aws_eventbridge_lambda import EventbridgeToLambda, EventbridgeToLambdaProps
from aws_cdk import (
    aws_lambda as _lambda,
    aws_events as events,
    Duration,
    Stack
)
from constructs import Construct

EventbridgeToLambda(self, 'test-eventbridge-lambda',
                    lambda_function_props=_lambda.FunctionProps(
                        code=_lambda.Code.from_asset('lambda'),
                        runtime=_lambda.Runtime.PYTHON_3_9,
                        handler='index.handler'
                    ),
                    event_rule_props=events.RuleProps(
                        schedule=events.Schedule.rate(
                            Duration.minutes(5))
                    ))
```

Java

```java
import software.constructs.Construct;

import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.Duration;
import software.amazon.awscdk.services.events.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.lambda.Runtime;
import software.amazon.awsconstructs.services.eventbridgelambda.*;

new EventbridgeToLambda(this, "test-eventbridge-lambda",
        new EventbridgeToLambdaProps.Builder()
                .lambdaFunctionProps(new FunctionProps.Builder()
                        .runtime(Runtime.NODEJS_16_X)
                        .code(Code.fromAsset("lambda"))
                        .handler("index.handler")
                        .build())
                .eventRuleProps(new RuleProps.Builder()
                        .schedule(Schedule.rate(Duration.minutes(5)))
                        .build())
                .build());
```

## Pattern Construct Props

| **Name**     | **Type**        | **Description** |
|:-------------|:----------------|-----------------|
|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|User provided props to override the default props for the Lambda function.|
|existingEventBusInterface?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.IEventBus.html)| Optional user-provided custom EventBus for construct to use. Providing both this and `eventBusProps` results an error.|
|eventBusProps?|[`events.EventBusProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.EventBusProps.html)|Optional user-provided properties to override the default properties when creating a custom EventBus. Setting this value to `{}` will create a custom EventBus using all default properties. If neither this nor `existingEventBusInterface` is provided the construct will use the `default` EventBus. Providing both this and `existingEventBusInterface` results an error.|
|eventRuleProps|[`events.RuleProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.RuleProps.html)|User provided eventRuleProps to override the defaults|

## Pattern Properties

| **Name**     | **Type**        | **Description** |
|:-------------|:----------------|-----------------|
|eventBus?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.IEventBus.html)|Returns the instance of events.IEventBus used by the construct|
|eventsRule|[`events.Rule`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Rule.html)|Returns an instance of events.Rule created by the construct|
|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Returns an instance of lambda.Function created by the construct|

## Default settings

Out of the box implementation of the Construct without any override will set the following defaults:

### Amazon EventBridge Rule

* Grant least privilege permissions to EventBridge rule to trigger the Lambda Function

### AWS Lambda Function

* Configure limited privilege access IAM role for Lambda function
* Enable reusing connections with Keep-Alive for NodeJs Lambda function
* Enable X-Ray Tracing
* Set Environment Variables
* AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)

## Architecture

![Architecture Diagram](architecture.png)

---


© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/awslabs/aws-solutions-constructs.git",
    "name": "aws-solutions-constructs.aws-eventbridge-lambda",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Amazon Web Services",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/11/be/47cd8edb4467f5e409d5e5c2d97253c35f2532724baaf0cfa8b4800fa380/aws_solutions_constructs_aws_eventbridge_lambda-2.74.0.tar.gz",
    "platform": null,
    "description": "# aws-eventbridge-lambda module\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)\n\n---\n<!--END STABILITY BANNER-->\n\n| **Reference Documentation**:| <span style=\"font-weight: normal\">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|\n|:-------------|:-------------|\n\n<div style=\"height:8px\"></div>\n\n| **Language**     | **Package**        |\n|:-------------|-----------------|\n|![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_eventbridge_lambda`|\n|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-eventbridge-lambda`|\n|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.eventbridgelambda`|\n\n## Overview\n\nThis AWS Solutions Construct implements an AWS EventBridge rule and an AWS Lambda function.\n\nHere is a minimal deployable pattern definition:\n\nTypescript\n\n```python\nimport { Construct } from 'constructs';\nimport { Stack, StackProps, Duration } from 'aws-cdk-lib';\nimport { EventbridgeToLambdaProps, EventbridgeToLambda } from '@aws-solutions-constructs/aws-eventbridge-lambda';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as events from 'aws-cdk-lib/aws-events';\n\nconst constructProps: EventbridgeToLambdaProps = {\n  lambdaFunctionProps: {\n    code: lambda.Code.fromAsset(`lambda`),\n    runtime: lambda.Runtime.NODEJS_16_X,\n    handler: 'index.handler'\n  },\n  eventRuleProps: {\n    schedule: events.Schedule.rate(Duration.minutes(5))\n  }\n};\n\nnew EventbridgeToLambda(this, 'test-eventbridge-lambda', constructProps);\n```\n\nPython\n\n```python\nfrom aws_solutions_constructs.aws_eventbridge_lambda import EventbridgeToLambda, EventbridgeToLambdaProps\nfrom aws_cdk import (\n    aws_lambda as _lambda,\n    aws_events as events,\n    Duration,\n    Stack\n)\nfrom constructs import Construct\n\nEventbridgeToLambda(self, 'test-eventbridge-lambda',\n                    lambda_function_props=_lambda.FunctionProps(\n                        code=_lambda.Code.from_asset('lambda'),\n                        runtime=_lambda.Runtime.PYTHON_3_9,\n                        handler='index.handler'\n                    ),\n                    event_rule_props=events.RuleProps(\n                        schedule=events.Schedule.rate(\n                            Duration.minutes(5))\n                    ))\n```\n\nJava\n\n```java\nimport software.constructs.Construct;\n\nimport software.amazon.awscdk.Stack;\nimport software.amazon.awscdk.StackProps;\nimport software.amazon.awscdk.Duration;\nimport software.amazon.awscdk.services.events.*;\nimport software.amazon.awscdk.services.lambda.*;\nimport software.amazon.awscdk.services.lambda.Runtime;\nimport software.amazon.awsconstructs.services.eventbridgelambda.*;\n\nnew EventbridgeToLambda(this, \"test-eventbridge-lambda\",\n        new EventbridgeToLambdaProps.Builder()\n                .lambdaFunctionProps(new FunctionProps.Builder()\n                        .runtime(Runtime.NODEJS_16_X)\n                        .code(Code.fromAsset(\"lambda\"))\n                        .handler(\"index.handler\")\n                        .build())\n                .eventRuleProps(new RuleProps.Builder()\n                        .schedule(Schedule.rate(Duration.minutes(5)))\n                        .build())\n                .build());\n```\n\n## Pattern Construct Props\n\n| **Name**     | **Type**        | **Description** |\n|:-------------|:----------------|-----------------|\n|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|\n|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html)|User provided props to override the default props for the Lambda function.|\n|existingEventBusInterface?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.IEventBus.html)| Optional user-provided custom EventBus for construct to use. Providing both this and `eventBusProps` results an error.|\n|eventBusProps?|[`events.EventBusProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.EventBusProps.html)|Optional user-provided properties to override the default properties when creating a custom EventBus. Setting this value to `{}` will create a custom EventBus using all default properties. If neither this nor `existingEventBusInterface` is provided the construct will use the `default` EventBus. Providing both this and `existingEventBusInterface` results an error.|\n|eventRuleProps|[`events.RuleProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.RuleProps.html)|User provided eventRuleProps to override the defaults|\n\n## Pattern Properties\n\n| **Name**     | **Type**        | **Description** |\n|:-------------|:----------------|-----------------|\n|eventBus?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.IEventBus.html)|Returns the instance of events.IEventBus used by the construct|\n|eventsRule|[`events.Rule`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Rule.html)|Returns an instance of events.Rule created by the construct|\n|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html)|Returns an instance of lambda.Function created by the construct|\n\n## Default settings\n\nOut of the box implementation of the Construct without any override will set the following defaults:\n\n### Amazon EventBridge Rule\n\n* Grant least privilege permissions to EventBridge rule to trigger the Lambda Function\n\n### AWS Lambda Function\n\n* Configure limited privilege access IAM role for Lambda function\n* Enable reusing connections with Keep-Alive for NodeJs Lambda function\n* Enable X-Ray Tracing\n* Set Environment Variables\n* AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)\n\n## Architecture\n\n![Architecture Diagram](architecture.png)\n\n---\n\n\n\u00a9 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "CDK Constructs for deploying AWS Events Rule that inveokes AWS Lambda",
    "version": "2.74.0",
    "project_urls": {
        "Homepage": "https://github.com/awslabs/aws-solutions-constructs.git",
        "Source": "https://github.com/awslabs/aws-solutions-constructs.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79ef277709948276e2ecfd42122b065e3dbd2d64f69095c980464bae6092cceb",
                "md5": "db68746b03a4cc3af9bee859fac40bb6",
                "sha256": "18b1df2f31f37c1aa3878ccc2b4efe344ddded86f3c23c31065c5e2224fdb419"
            },
            "downloads": -1,
            "filename": "aws_solutions_constructs.aws_eventbridge_lambda-2.74.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db68746b03a4cc3af9bee859fac40bb6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 99799,
            "upload_time": "2024-10-22T18:07:35",
            "upload_time_iso_8601": "2024-10-22T18:07:35.445968Z",
            "url": "https://files.pythonhosted.org/packages/79/ef/277709948276e2ecfd42122b065e3dbd2d64f69095c980464bae6092cceb/aws_solutions_constructs.aws_eventbridge_lambda-2.74.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11be47cd8edb4467f5e409d5e5c2d97253c35f2532724baaf0cfa8b4800fa380",
                "md5": "dec6ffd0d3ae977f498dad7bb5b4aef6",
                "sha256": "13ca03338d0ff796b6459a9090b4e1964a689167b54c35d52808ac4e9bcfca8d"
            },
            "downloads": -1,
            "filename": "aws_solutions_constructs_aws_eventbridge_lambda-2.74.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dec6ffd0d3ae977f498dad7bb5b4aef6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 101015,
            "upload_time": "2024-10-22T18:09:21",
            "upload_time_iso_8601": "2024-10-22T18:09:21.500871Z",
            "url": "https://files.pythonhosted.org/packages/11/be/47cd8edb4467f5e409d5e5c2d97253c35f2532724baaf0cfa8b4800fa380/aws_solutions_constructs_aws_eventbridge_lambda-2.74.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 18:09:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "awslabs",
    "github_project": "aws-solutions-constructs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aws-solutions-constructs.aws-eventbridge-lambda"
}
        
Elapsed time: 0.73122s