CDK Constructs for deploying AWS Events Rule that inveokes AWS Lambda
Project description
aws-events-rule-lambda module
---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.
Reference Documentation: | https://docs.aws.amazon.com/solutions/latest/constructs/ |
---|
Language | Package |
---|---|
Python | aws_solutions_constructs.aws_events_rule_lambda |
Typescript | @aws-solutions-constructs/aws-events-rule-lambda |
Java | software.amazon.awsconstructs.services.eventsrulelambda |
This AWS Solutions Construct implements an AWS Events rule and an AWS Lambda function.
Here is a minimal deployable pattern definition in Typescript:
import { EventsRuleToLambdaProps, EventsRuleToLambda } from '@aws-solutions-constructs/aws-events-rule-lambda';
const props: EventsRuleToLambdaProps = {
lambdaFunctionProps: {
code: lambda.Code.fromAsset(`${__dirname}/lambda`),
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler'
},
eventRuleProps: {
schedule: events.Schedule.rate(Duration.minutes(5))
}
};
new EventsRuleToLambda(this, 'test-events-rule-lambda', props);
Initializer
new EventsRuleToLambda(scope: Construct, id: string, props: EventsRuleToLambdaProps);
Parameters
- scope
Construct
- id
string
- props
EventsRuleToLambdaProps
Pattern Construct Props
Name | Type | Description |
---|---|---|
existingLambdaObj? | lambda.Function |
Existing instance of Lambda Function object, providing both this and lambdaFunctionProps will cause an error. |
existingEventBusInterface? | events.IEventBus |
Optional user-provided custom EventBus for construct to use. Providing both this and eventBusProps results an error. |
eventBusProps? | events.EventBusProps |
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 |
User provided props to override the default props for the Lambda function. |
eventRuleProps | events.RuleProps |
User provided eventRuleProps to override the defaults |
Pattern Properties
Name | Type | Description |
---|---|---|
eventBus? | events.IEventBus |
Returns the instance of events.IEventBus used by the construct |
eventsRule | events.Rule |
Returns an instance of events.Rule created by the construct |
lambdaFunction | lambda.Function |
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
© Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws-solutions-constructs.aws-events-rule-lambda-1.128.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbba19f31ce23df38d6b0df6158590d9462e5b9d0232d8ddd8ee8d83b0b60be4 |
|
MD5 | 68519a97bce7e8e1a9e4cb1debb99229 |
|
BLAKE2b-256 | 37c4543889294501ea2ca4fe1b36a5ece2fd0d6578341304defad6cdc99c427b |
Hashes for aws_solutions_constructs.aws_events_rule_lambda-1.128.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88fc59a6e7d98aa973dbcc099197f0290f2d6d4d0e1c79918a6671142ee0df11 |
|
MD5 | 702900cf54f896d6f434134f3662816f |
|
BLAKE2b-256 | aa6e22ae23e021675a2584a66d7a6362340b368b177834ec64c3260349685098 |