# aws-events-rule-lambda module
<!--BEGIN STABILITY BANNER-->---
![Stability: Deprecated](https://img.shields.io/badge/STABILITY-DEPRECATED-red?style=for-the-badge)
> Some of our early constructs don’t meet the naming standards that evolved for the library. We are releasing completely feature compatible versions with corrected names. The underlying implementation code is the same regardless of whether you deploy the construct using the old or new name. We will support both names for all 1.x releases, but in 2.x we will only publish the correctly named constructs. This construct is being replaced by the functionally identical aws-eventbridge-lambda.
---
<!--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_events_rule_lambda`|
|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-events-rule-lambda`|
|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.eventsrulelambda`|
## Overview
This AWS Solutions Construct implements an AWS Events rule and an AWS Lambda function.
Here is a minimal deployable pattern definition:
Typescript
```python
// aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.
// This sample uses the CDK V1 syntax
import * as cdk from '@aws-cdk/core';
import * as lambda from '@aws-cdk/aws-lambda';
import * as events from '@aws-cdk/aws-events';
import { EventsRuleToLambdaProps, EventsRuleToLambda } from '@aws-solutions-constructs/aws-events-rule-lambda';
const constructProps: EventsRuleToLambdaProps = {
lambdaFunctionProps: {
code: lambda.Code.fromAsset(`lambda`),
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler'
},
eventRuleProps: {
schedule: events.Schedule.rate(cdk.Duration.minutes(5))
}
};
new EventsRuleToLambda(this, 'test-events-rule-lambda', constructProps);
```
Python
```python
# aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.
# This sample uses the CDK V1 syntax
from aws_solutions_constructs.aws_events_rule_lambda import EventsRuleToLambdaProps, EventsRuleToLambda
from aws_cdk import (
aws_lambda as _lambda,
aws_events as events,
core
)
EventsRuleToLambda(self, 'test_events_rule_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(core.Duration.minutes(5))
))
```
Java
```java
// aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.
// This sample uses the CDK V1 syntax
import software.constructs.Construct;
import software.amazon.awscdk.core.*;
import software.amazon.awscdk.services.events.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.lambda.Runtime;
import software.amazon.awsconstructs.services.eventsrulelambda.*;
new EventsRuleToLambda(this, "test-events-rule-lambda",
new EventsRuleToLambdaProps.Builder()
.lambdaFunctionProps(new FunctionProps.Builder()
.runtime(Runtime.NODEJS_14_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/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|
|existingEventBusInterface?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_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.|
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props for the Lambda function.|
|eventRuleProps|[`events.RuleProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_aws-events.IEventBus.html)|Returns the instance of events.IEventBus used by the construct|
|eventsRule|[`events.Rule`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.Rule.html)|Returns an instance of events.Rule created by the construct|
|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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 CloudWatch Events Rule
* Grant least privilege permissions to CloudWatch Events 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 2022 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-events-rule-lambda",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Amazon Web Services",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/90/7e/1ea010f5693248dee98cec5ddb1c6ad8793ecc27e11288b9865a68452880/aws-solutions-constructs.aws-events-rule-lambda-1.181.1.tar.gz",
"platform": null,
"description": "# aws-events-rule-lambda module\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![Stability: Deprecated](https://img.shields.io/badge/STABILITY-DEPRECATED-red?style=for-the-badge)\n\n> Some of our early constructs don\u2019t meet the naming standards that evolved for the library. We are releasing completely feature compatible versions with corrected names. The underlying implementation code is the same regardless of whether you deploy the construct using the old or new name. We will support both names for all 1.x releases, but in 2.x we will only publish the correctly named constructs. This construct is being replaced by the functionally identical aws-eventbridge-lambda.\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_events_rule_lambda`|\n|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-events-rule-lambda`|\n|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.eventsrulelambda`|\n\n## Overview\n\nThis AWS Solutions Construct implements an AWS Events rule and an AWS Lambda function.\n\nHere is a minimal deployable pattern definition:\n\nTypescript\n\n```python\n// aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.\n// This sample uses the CDK V1 syntax\nimport * as cdk from '@aws-cdk/core';\nimport * as lambda from '@aws-cdk/aws-lambda';\nimport * as events from '@aws-cdk/aws-events';\nimport { EventsRuleToLambdaProps, EventsRuleToLambda } from '@aws-solutions-constructs/aws-events-rule-lambda';\n\nconst constructProps: EventsRuleToLambdaProps = {\n lambdaFunctionProps: {\n code: lambda.Code.fromAsset(`lambda`),\n runtime: lambda.Runtime.NODEJS_14_X,\n handler: 'index.handler'\n },\n eventRuleProps: {\n schedule: events.Schedule.rate(cdk.Duration.minutes(5))\n }\n};\n\nnew EventsRuleToLambda(this, 'test-events-rule-lambda', constructProps);\n```\n\nPython\n\n```python\n# aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.\n# This sample uses the CDK V1 syntax\nfrom aws_solutions_constructs.aws_events_rule_lambda import EventsRuleToLambdaProps, EventsRuleToLambda\nfrom aws_cdk import (\n aws_lambda as _lambda,\n aws_events as events,\n core\n)\n\nEventsRuleToLambda(self, 'test_events_rule_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(core.Duration.minutes(5))\n ))\n```\n\nJava\n\n```java\n// aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.\n// This sample uses the CDK V1 syntax\nimport software.constructs.Construct;\n\nimport software.amazon.awscdk.core.*;\nimport software.amazon.awscdk.services.events.*;\nimport software.amazon.awscdk.services.lambda.*;\nimport software.amazon.awscdk.services.lambda.Runtime;\nimport software.amazon.awsconstructs.services.eventsrulelambda.*;\n\nnew EventsRuleToLambda(this, \"test-events-rule-lambda\",\n new EventsRuleToLambdaProps.Builder()\n .lambdaFunctionProps(new FunctionProps.Builder()\n .runtime(Runtime.NODEJS_14_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/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|\n|existingEventBusInterface?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_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|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props for the Lambda function.|\n|eventRuleProps|[`events.RuleProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_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 CloudWatch Events Rule\n\n* Grant least privilege permissions to CloudWatch Events 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 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "CDK Constructs for deploying AWS Events Rule that inveokes AWS Lambda",
"version": "1.181.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "a0b557b9ef16b0172da844ca0ed68f4a",
"sha256": "c3c7b98b2844bd65969e7eb3c33302eae979f9a6ac1542e0c6a2617c736404c0"
},
"downloads": -1,
"filename": "aws_solutions_constructs.aws_events_rule_lambda-1.181.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a0b557b9ef16b0172da844ca0ed68f4a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.7",
"size": 87714,
"upload_time": "2022-12-02T03:31:08",
"upload_time_iso_8601": "2022-12-02T03:31:08.794044Z",
"url": "https://files.pythonhosted.org/packages/04/3f/37d5e1f885d7e133ef0003801cf942ef9ebc23cfdbd79e84467d51dea023/aws_solutions_constructs.aws_events_rule_lambda-1.181.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "f36ef7af54495cc13bdc740c6b87100a",
"sha256": "4ec415d88bbc7bd873a85b2dcffeaec9423391d5d15649b7868d38e4fe9af738"
},
"downloads": -1,
"filename": "aws-solutions-constructs.aws-events-rule-lambda-1.181.1.tar.gz",
"has_sig": false,
"md5_digest": "f36ef7af54495cc13bdc740c6b87100a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.7",
"size": 88891,
"upload_time": "2022-12-02T03:33:33",
"upload_time_iso_8601": "2022-12-02T03:33:33.813492Z",
"url": "https://files.pythonhosted.org/packages/90/7e/1ea010f5693248dee98cec5ddb1c6ad8793ecc27e11288b9865a68452880/aws-solutions-constructs.aws-events-rule-lambda-1.181.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-02 03:33:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "awslabs",
"github_project": "aws-solutions-constructs.git",
"lcname": "aws-solutions-constructs.aws-events-rule-lambda"
}