Package: aws-solutions-constructs.aws-events-rule-lambda
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/LanguagePackagePythonaws_solutions_constructs.aws_events_rule_lambdaTypescript@aws-solutions-constructs/aws-events-rule-lambdaJavasoftware.amazon.awsconstructs.services.eventsrulelambdaOverviewThis AWS Solutions Construct implements an AWS Events rule and an AWS Lambda function.Here is a minimal deployable pattern definition:Typescript//aws-events-rule-lambdahasbeendeprecatedforCDKV2infavorofaws-eventbridge-lambda.//ThissampleusestheCDKV1syntaximport*ascdkfrom'@aws-cdk/core';import*aslambdafrom'@aws-cdk/aws-lambda';import*aseventsfrom'@aws-cdk/aws-events';import{EventsRuleToLambdaProps,EventsRuleToLambda}from'@aws-solutions-constructs/aws-events-rule-lambda';constconstructProps: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))}};newEventsRuleToLambda(this,'test-events-rule-lambda',constructProps);Python# aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.# This sample uses the CDK V1 syntaxfromaws_solutions_constructs.aws_events_rule_lambdaimportEventsRuleToLambdaProps,EventsRuleToLambdafromaws_cdkimport(aws_lambdaas_lambda,aws_eventsasevents,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// aws-events-rule-lambda has been deprecated for CDK V2 in favor of aws-eventbridge-lambda.// This sample uses the CDK V1 syntaximportsoftware.constructs.Construct;importsoftware.amazon.awscdk.core.*;importsoftware.amazon.awscdk.services.events.*;importsoftware.amazon.awscdk.services.lambda.*;importsoftware.amazon.awscdk.services.lambda.Runtime;importsoftware.amazon.awsconstructs.services.eventsrulelambda.*;newEventsRuleToLambda(this,"test-events-rule-lambda",newEventsRuleToLambdaProps.Builder().lambdaFunctionProps(newFunctionProps.Builder().runtime(Runtime.NODEJS_14_X).code(Code.fromAsset("lambda")).handler("index.handler").build()).eventRuleProps(newRuleProps.Builder().schedule(Schedule.rate(Duration.minutes(5))).build()).build());Pattern Construct PropsNameTypeDescriptionexistingLambdaObj?lambda.FunctionExisting instance of Lambda Function object, providing both this andlambdaFunctionPropswill cause an error.existingEventBusInterface?events.IEventBusOptional user-provided custom EventBus for construct to use. Providing both this andeventBusPropsresults an error.eventBusProps?events.EventBusPropsOptional 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 norexistingEventBusInterfaceis provided the construct will use thedefaultEventBus. Providing both this andexistingEventBusInterfaceresults an error.lambdaFunctionProps?lambda.FunctionPropsUser provided props to override the default props for the Lambda function.eventRulePropsevents.RulePropsUser provided eventRuleProps to override the defaultsPattern PropertiesNameTypeDescriptioneventBus?events.IEventBusReturns the instance of events.IEventBus used by the constructeventsRuleevents.RuleReturns an instance of events.Rule created by the constructlambdaFunctionlambda.FunctionReturns an instance of lambda.Function created by the constructDefault settingsOut of the box implementation of the Construct without any override will set the following defaults:Amazon CloudWatch Events RuleGrant least privilege permissions to CloudWatch Events to trigger the Lambda FunctionAWS Lambda FunctionConfigure limited privilege access IAM role for Lambda functionEnable reusing connections with Keep-Alive for NodeJs Lambda functionEnable X-Ray TracingSet Environment VariablesAWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)Architecture© Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.