awssolutionsconstructsawseventbridgelambda

package module
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

aws-eventbridge-lambda module



Reference Documentation: https://docs.aws.amazon.com/solutions/latest/constructs/
Language Package
Python Logo Python aws_solutions_constructs.aws_eventbridge_lambda
Typescript Logo Typescript @aws-solutions-constructs/aws-eventbridge-lambda
Java Logo Java software.amazon.awsconstructs.services.eventbridgelambda

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

Here is a minimal deployable pattern definition in Typescript:

const { EventbridgeToLambdaProps, EventbridgeToLambda } from '@aws-solutions-constructs/aws-eventbridge-lambda';

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

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

Initializer

new EventbridgeToLambda(scope: Construct, id: string, props: EventbridgeToLambdaProps);

Parameters

Pattern Construct Props

Name Type Description
existingLambdaObj? lambda.Function Existing instance of Lambda Function object, providing both this and lambdaFunctionProps will cause an error.
lambdaFunctionProps? lambda.FunctionProps User provided props to override the default props for the Lambda function.
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.
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 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


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

Documentation

Overview

CDK Constructs for deploying AWS Events Rule that inveokes AWS Lambda

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventbridgeToLambda_IsConstruct

func EventbridgeToLambda_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead

func NewEventbridgeToLambda_Override

func NewEventbridgeToLambda_Override(e EventbridgeToLambda, scope constructs.Construct, id *string, props *EventbridgeToLambdaProps)

Types

type EventbridgeToLambda

type EventbridgeToLambda interface {
	constructs.Construct
	EventBus() awsevents.IEventBus
	EventsRule() awsevents.Rule
	LambdaFunction() awslambda.Function
	Node() constructs.Node
	ToString() *string
}

func NewEventbridgeToLambda

func NewEventbridgeToLambda(scope constructs.Construct, id *string, props *EventbridgeToLambdaProps) EventbridgeToLambda

type EventbridgeToLambdaProps

type EventbridgeToLambdaProps struct {
	// User provided eventRuleProps to override the defaults.
	EventRuleProps *awsevents.RuleProps `json:"eventRuleProps"`
	// A new custom EventBus is created with provided props.
	EventBusProps *awsevents.EventBusProps `json:"eventBusProps"`
	// Existing instance of a custom EventBus.
	ExistingEventBusInterface awsevents.IEventBus `json:"existingEventBusInterface"`
	// Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.
	ExistingLambdaObj awslambda.Function `json:"existingLambdaObj"`
	// User provided props to override the default props for the Lambda function.
	LambdaFunctionProps *awslambda.FunctionProps `json:"lambdaFunctionProps"`
}

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL