This documentation is for the developer preview release of the AWS CDK. Do not use this version of the AWS CDK in production. Subsequent releases of the AWS CDK will likely include breaking changes.

@aws-cdk/aws-lambda

AWS Lambda Construct Library

This construct library allows you to define AWS Lambda Functions.

import lambda = require('@aws-cdk/aws-lambda');

const fn = new lambda.Function(this, 'MyFunction', {
    runtime: lambda.Runtime.NodeJS810,
    handler: 'index.handler',
    code: lambda.Code.asset('./lambda-handler'),
});

Handler Code

The lambda.Code class includes static convenience methods for various types of runtime code.

  • lambda.Code.bucket(bucket, key[, objectVersion]) - specify an S3 object that contains the archive of your runtime code.
  • lambda.Code.inline(code) - inline the handle code as a string. This is limited to 4KB.
  • lambda.Code.asset(path) - specify a directory or a .zip file in the local filesystem which will be zipped and uploaded to S3 before deployment.

The following example shows how to define a Python function and deploy the code from the local directory my-lambda-handler to it:

new lambda.Function(this, 'MyLambda', {
  code: lambda.Code.asset(path.join(__dirname, 'my-lambda-handler')),
  handler: 'index.main',
  runtime: lambda.Runtime.Python36
});

When deploying a stack that contains this code, the directory will be zip archived and then uploaded to an S3 bucket, then the exact location of the S3 objects will be passed when the stack is deployed.

Layers

The lambda.LayerVersion class can be used to define Lambda layers and manage granting permissions to other AWS accounts or organizations.

const layer = new lambda.LayerVersion(stack, 'MyLayer', {
  code: lambda.Code.directory(path.join(__dirname, 'layer-code')),
  compatibleRuntimes: [lambda.Runtime.NodeJS810],
  license: 'Apache-2.0',
  description: 'A layer to test the L2 construct',
});

// To grant usage by other AWS accounts
layer.grantUsage('remote-account-grant', { accountId: awsAccountId });

// To grant usage to all accounts in some AWS Ogranization
// layer.grantUsage({ accountId: '*', organizationId });

new lambda.Function(stack, 'MyLayeredLambda', {
  code: new lambda.InlineCode('foo'),
  handler: 'index.handler',
  runtime: lambda.Runtime.NodeJS810,
  layers: [layer],
});

Event Sources

AWS Lambda supports a variety of event sources.

In most cases, it is possible to trigger a function as a result of an event by using one of the onXxx methods on the source construct. For example, the s3.Bucket construct has an onEvent method which can be used to trigger a Lambda when an event, such as PutObject occurs on an S3 bucket.

An alternative way to add event sources to a function is to use function.addEventSource(source). This method accepts an IEventSource object. The module @aws-cdk/aws-lambda-event-sources includes classes for the various event sources supported by AWS Lambda.

For example, the following code adds an SQS queue as an event source for a function:

import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
fn.addEventSource(new SqsEventSource(queue));

The following code adds an S3 bucket notification as an event source:

import { S3EventSource } from '@aws-cdk/aws-lambda-event-sources';
fn.addEventSource(new S3EventSource(bucket, {
  events: [ s3.EventType.ObjectCreated, s3.EventType.ObjectDeleted ],
  filters: [ { prefix: 'subdir/' } ] // optional
}));

See the documentation for the @aws-cdk/aws-lambda-event-sources module for more details.

Lambda with DLQ

import lambda = require('@aws-cdk/aws-lambda');

const fn = new lambda.Function(this, 'MyFunction', {
    runtime: lambda.Runtime.NodeJS810,
    handler: 'index.handler',
    code: lambda.Code.inline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
    deadLetterQueueEnabled: true
});

See the AWS documentation to learn more about AWS Lambdas and DLQs.

Lambda with X-Ray Tracing

import lambda = require('@aws-cdk/aws-lambda');

const fn = new lambda.Function(this, 'MyFunction', {
    runtime: lambda.Runtime.NodeJS810,
    handler: 'index.handler',
    code: lambda.Code.inline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
    tracing: lambda.Tracing.Active
});

See the AWS documentation to learn more about AWS Lambda’s X-Ray support.

Lambda with Reserved Concurrent Executions

import lambda = require('@aws-cdk/aws-lambda');

const fn = new lambda.Function(this, 'MyFunction', {
    runtime: lambda.Runtime.NodeJS810,
    handler: 'index.handler',
    code: lambda.Code.inline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
    reservedConcurrentExecutions: 100
});

See the AWS documentation managing concurrency.

Reference

View in Nuget

csproj:

<PackageReference Include="Amazon.CDK.AWS.Lambda" Version="0.28.0" />

dotnet:

dotnet add package Amazon.CDK.AWS.Lambda --version 0.28.0

packages.config:

<package id="Amazon.CDK.AWS.Lambda" version="0.28.0" />

View in Maven Central

Apache Buildr:

'software.amazon.awscdk:lambda:jar:0.28.0'

Apache Ivy:

<dependency groupId="software.amazon.awscdk" name="lambda" rev="0.28.0"/>

Apache Maven:

<dependency>
  <groupId>software.amazon.awscdk</groupId>
  <artifactId>lambda</artifactId>
  <version>0.28.0</version>
</dependency>

Gradle / Grails:

compile 'software.amazon.awscdk:lambda:0.28.0'

Groovy Grape:

@Grapes(
@Grab(group='software.amazon.awscdk', module='lambda', version='0.28.0')
)

View in NPM

npm:

$ npm i @aws-cdk/aws-lambda@0.28.0

package.json:

{
  "@aws-cdk/aws-lambda": "^0.28.0"
}

yarn:

$ yarn add @aws-cdk/aws-lambda@0.28.0

View in NPM

npm:

$ npm i @aws-cdk/aws-lambda@0.28.0

package.json:

{
  "@aws-cdk/aws-lambda": "^0.28.0"
}

yarn:

$ yarn add @aws-cdk/aws-lambda@0.28.0

Alias

class @aws-cdk/aws-lambda.Alias(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.Alias;
const { Alias } = require('@aws-cdk/aws-lambda');
import { Alias } from '@aws-cdk/aws-lambda';

A new alias to a particular version of a Lambda function.

Extends:

FunctionBase

Parameters:
export() → @aws-cdk/aws-lambda.FunctionImportProps

Implements @aws-cdk/aws-lambda.FunctionBase.export()

Export this Function (without the role)

Return type:FunctionImportProps
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Overrides @aws-cdk/aws-lambda.FunctionBase.metric()

Return the given named metric for this Function

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

canCreatePermissions

Implements @aws-cdk/aws-lambda.FunctionBase.canCreatePermissions()

Whether the addPermission() call adds any permissions

True for new Lambdas, false for imported Lambdas (they might live in different accounts).

Protected property

Type:boolean (readonly)
functionArn

Implements @aws-cdk/aws-lambda.FunctionBase.functionArn()

ARN of this alias

Used to be able to use Alias in place of a regular Lambda. Lambda accepts

ARNs everywhere it accepts function names.

Type:string (readonly)
functionName

Implements @aws-cdk/aws-lambda.FunctionBase.functionName()

ARN of this alias

Used to be able to use Alias in place of a regular Lambda. Lambda accepts

ARNs everywhere it accepts function names.

Type:string (readonly)
grantPrincipal

Implements @aws-cdk/aws-lambda.FunctionBase.grantPrincipal()

The principal this Lambda Function is running as

Type:@aws-cdk/aws-iam.IPrincipal (readonly)
role

Implements @aws-cdk/aws-lambda.FunctionBase.role()

Role associated with this alias

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
addEventSource(source)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Adds an event source to this function.

Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module.

The following example adds an SQS Queue as an event source:

import { SqsEventSource } from @aws-cdk/aws-lambda-event-sources’;

myFunction.addEventSource(new SqsEventSource(myQueue));

Parameters:source (IEventSource) – The event source to bind to this function
addPermission(id, permission)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Adds a permission to the Lambda resource policy.

Parameters:
  • id (string) – The id ƒor the permission construct
  • permission (Permission) –
addToRolePolicy(statement)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Allows this Lambda to be used as a destination for bucket notifications.

Use bucket.onEvent(lambda) to subscribe.

Parameters:
  • bucketArn (string) –
  • bucketId (string) –
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

asEventRuleTarget(ruleArn, ruleId) → @aws-cdk/aws-events.EventRuleTargetProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Returns a RuleTarget that can be used to trigger this Lambda as a

result from a CloudWatch event.

Parameters:
  • ruleArn (string) –
  • ruleId (string) –
Return type:

@aws-cdk/aws-events.EventRuleTargetProps

asStepFunctionsTaskResource(_callingTask) → @aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required for using this object as a Task resource

Parameters:_callingTask (@aws-cdk/aws-stepfunctions.Task) –
Return type:@aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps
grantInvoke(grantee) → @aws-cdk/aws-iam.Grant

Inherited from @aws-cdk/aws-lambda.FunctionBase

Grant the given identity permissions to invoke this Lambda

Parameters:grantee (@aws-cdk/aws-iam.IGrantable) –
Return type:@aws-cdk/aws-iam.Grant
logSubscriptionDestination(sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:sourceLogGroup (@aws-cdk/aws-logs.ILogGroup) –
Return type:@aws-cdk/aws-logs.LogSubscriptionDestination
metricDuration([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How long execution of this Lambda takes

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricErrors([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How many invocations of this Lambda fail

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricInvocations([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is invoked

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricThrottles([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is throttled

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
connections

Inherited from @aws-cdk/aws-lambda.FunctionBase

Access the Connections object

Will fail if not a VPC-enabled Lambda Function

Type:@aws-cdk/aws-ec2.Connections (readonly)
id

Inherited from @aws-cdk/aws-lambda.FunctionBase

Logical ID of this Function.

Type:string (readonly)
isBoundToVpc

Inherited from @aws-cdk/aws-lambda.FunctionBase

Whether or not this Lambda function was bound to a VPC

If this is is false, trying to access the connections object will fail.

Type:boolean (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

AliasProps (interface)

class @aws-cdk/aws-lambda.AliasProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.AliasProps;
// AliasProps is an interface
import { AliasProps } from '@aws-cdk/aws-lambda';

Properties for a new Lambda alias

aliasName

Name of this alias

Type:string (readonly)
version

Function version this alias refers to

Use lambda.addVersion() to obtain a new lambda version to refer to.

Type:Version (readonly)
additionalVersions

Additional versions with individual weights this alias points to

Individual additional version weights specified here should add up to

(less than) one. All remaining weight is routed to the default

version.

For example, the config is

version: “1”

additionalVersions: [{ version: “2”, weight: 0.05 }]

Then 5% of traffic will be routed to function version 2, while

the remaining 95% of traffic will be routed to function version 1.

Type:VersionWeight[] (optional) (readonly)
Default:No additional versions
description

Description for the alias

Type:string (optional) (readonly)
Default:No description

AssetCode

class @aws-cdk/aws-lambda.AssetCode(path[, packaging])

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.AssetCode;
const { AssetCode } = require('@aws-cdk/aws-lambda');
import { AssetCode } from '@aws-cdk/aws-lambda';

Lambda code from a local directory.

Extends:

Code

Parameters:
  • path (string) – The path to the asset file or directory.
  • packaging (@aws-cdk/assets.AssetPackaging (optional)) – The asset packaging format (optional, determined automatically)
bind(construct)

Overrides @aws-cdk/aws-lambda.Code.bind()

Called when the lambda or layer is initialized to allow this object to

bind to the stack, add resources and have fun.

Parameters:construct (@aws-cdk/cdk.Construct) –
isInline

Implements @aws-cdk/aws-lambda.Code.isInline()

Determines whether this Code is inline code or not.

Type:boolean (readonly)
packaging

The asset packaging.

Type:@aws-cdk/assets.AssetPackaging (readonly)
path

The path to the asset file or directory.

Type:string (readonly)

CfnAlias

class @aws-cdk/aws-lambda.CfnAlias(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnAlias;
const { CfnAlias } = require('@aws-cdk/aws-lambda');
import { CfnAlias } from '@aws-cdk/aws-lambda';

A CloudFormation AWS::Lambda::Alias

Extends:

@aws-cdk/cdk.CfnResource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.CfnResource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
aliasArn
Type:string (readonly)
propertyOverrides
Type:CfnAliasProps (readonly)
class AliasRoutingConfigurationProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnAlias.AliasRoutingConfigurationProperty;
// CfnAlias.AliasRoutingConfigurationProperty is an interface
import { CfnAlias.AliasRoutingConfigurationProperty } from '@aws-cdk/aws-lambda';
additionalVersionWeights

CfnAlias.AliasRoutingConfigurationProperty.AdditionalVersionWeights

Type:@aws-cdk/cdk.Token or (@aws-cdk/cdk.Token or VersionWeightProperty)[] (readonly)
class VersionWeightProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnAlias.VersionWeightProperty;
// CfnAlias.VersionWeightProperty is an interface
import { CfnAlias.VersionWeightProperty } from '@aws-cdk/aws-lambda';
functionVersion

CfnAlias.VersionWeightProperty.FunctionVersion

Type:string (readonly)
functionWeight

CfnAlias.VersionWeightProperty.FunctionWeight

Type:number or @aws-cdk/cdk.Token (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.CfnElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.CfnElement

Automatically detect references in this CfnElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.CfnElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.CfnElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.CfnElement

Return the path with respect to the stack

Type:string (readonly)
ref

Inherited from @aws-cdk/cdk.CfnRefElement

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
referenceToken

Inherited from @aws-cdk/cdk.CfnRefElement

Return a token that will CloudFormation { Ref } this stack element

Protected property

Type:@aws-cdk/cdk.Token (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.CfnResource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.CfnResource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.CfnResource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.CfnResource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
options

Inherited from @aws-cdk/cdk.CfnResource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.IResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.CfnResource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.CfnResource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.CfnResource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CfnAliasProps (interface)

class @aws-cdk/aws-lambda.CfnAliasProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnAliasProps;
// CfnAliasProps is an interface
import { CfnAliasProps } from '@aws-cdk/aws-lambda';

Properties for defining a AWS::Lambda::Alias

functionName

AWS::Lambda::Alias.FunctionName

Type:string (readonly)
functionVersion

AWS::Lambda::Alias.FunctionVersion

Type:string (readonly)
name

AWS::Lambda::Alias.Name

Type:string (readonly)
description

AWS::Lambda::Alias.Description

Type:string (optional) (readonly)
routingConfig

AWS::Lambda::Alias.RoutingConfig

Type:AliasRoutingConfigurationProperty or @aws-cdk/cdk.Token (optional) (readonly)

CfnEventSourceMapping

class @aws-cdk/aws-lambda.CfnEventSourceMapping(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnEventSourceMapping;
const { CfnEventSourceMapping } = require('@aws-cdk/aws-lambda');
import { CfnEventSourceMapping } from '@aws-cdk/aws-lambda';

A CloudFormation AWS::Lambda::EventSourceMapping

Extends:

@aws-cdk/cdk.CfnResource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.CfnResource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
eventSourceMappingName
Type:string (readonly)
propertyOverrides
Type:CfnEventSourceMappingProps (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.CfnElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.CfnElement

Automatically detect references in this CfnElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.CfnElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.CfnElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.CfnElement

Return the path with respect to the stack

Type:string (readonly)
ref

Inherited from @aws-cdk/cdk.CfnRefElement

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
referenceToken

Inherited from @aws-cdk/cdk.CfnRefElement

Return a token that will CloudFormation { Ref } this stack element

Protected property

Type:@aws-cdk/cdk.Token (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.CfnResource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.CfnResource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.CfnResource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.CfnResource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
options

Inherited from @aws-cdk/cdk.CfnResource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.IResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.CfnResource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.CfnResource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.CfnResource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CfnEventSourceMappingProps (interface)

class @aws-cdk/aws-lambda.CfnEventSourceMappingProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnEventSourceMappingProps;
// CfnEventSourceMappingProps is an interface
import { CfnEventSourceMappingProps } from '@aws-cdk/aws-lambda';

Properties for defining a AWS::Lambda::EventSourceMapping

eventSourceArn

AWS::Lambda::EventSourceMapping.EventSourceArn

Type:string (readonly)
functionName

AWS::Lambda::EventSourceMapping.FunctionName

Type:string (readonly)
batchSize

AWS::Lambda::EventSourceMapping.BatchSize

Type:number or @aws-cdk/cdk.Token (optional) (readonly)
enabled

AWS::Lambda::EventSourceMapping.Enabled

Type:boolean or @aws-cdk/cdk.Token (optional) (readonly)
startingPosition

AWS::Lambda::EventSourceMapping.StartingPosition

Type:string (optional) (readonly)

CfnFunction

class @aws-cdk/aws-lambda.CfnFunction(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnFunction;
const { CfnFunction } = require('@aws-cdk/aws-lambda');
import { CfnFunction } from '@aws-cdk/aws-lambda';

A CloudFormation AWS::Lambda::Function

Extends:

@aws-cdk/cdk.CfnResource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.CfnResource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
functionArn
Type:string (readonly)
functionName
Type:string (readonly)
propertyOverrides
Type:CfnFunctionProps (readonly)
tags

The TagManager handles setting, removing and formatting tags

Tags should be managed either passing them as properties during

initiation or by calling methods on this object. If both techniques are

used only the tags from the TagManager will be used. Tag (aspect)

will use the manager.

Type:@aws-cdk/cdk.TagManager (readonly)
class CodeProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnFunction.CodeProperty;
// CfnFunction.CodeProperty is an interface
import { CfnFunction.CodeProperty } from '@aws-cdk/aws-lambda';
s3Bucket

CfnFunction.CodeProperty.S3Bucket

Type:string (optional) (readonly)
s3Key

CfnFunction.CodeProperty.S3Key

Type:string (optional) (readonly)
s3ObjectVersion

CfnFunction.CodeProperty.S3ObjectVersion

Type:string (optional) (readonly)
zipFile

CfnFunction.CodeProperty.ZipFile

Type:string (optional) (readonly)
class DeadLetterConfigProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnFunction.DeadLetterConfigProperty;
// CfnFunction.DeadLetterConfigProperty is an interface
import { CfnFunction.DeadLetterConfigProperty } from '@aws-cdk/aws-lambda';
targetArn

CfnFunction.DeadLetterConfigProperty.TargetArn

Type:string (optional) (readonly)
class EnvironmentProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnFunction.EnvironmentProperty;
// CfnFunction.EnvironmentProperty is an interface
import { CfnFunction.EnvironmentProperty } from '@aws-cdk/aws-lambda';
variables

CfnFunction.EnvironmentProperty.Variables

Type:@aws-cdk/cdk.Token or string => string (optional) (readonly)
class TracingConfigProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnFunction.TracingConfigProperty;
// CfnFunction.TracingConfigProperty is an interface
import { CfnFunction.TracingConfigProperty } from '@aws-cdk/aws-lambda';
mode

CfnFunction.TracingConfigProperty.Mode

Type:string (optional) (readonly)
class VpcConfigProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnFunction.VpcConfigProperty;
// CfnFunction.VpcConfigProperty is an interface
import { CfnFunction.VpcConfigProperty } from '@aws-cdk/aws-lambda';
securityGroupIds

CfnFunction.VpcConfigProperty.SecurityGroupIds

Type:string[] (readonly)
subnetIds

CfnFunction.VpcConfigProperty.SubnetIds

Type:string[] (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.CfnElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.CfnElement

Automatically detect references in this CfnElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.CfnElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.CfnElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.CfnElement

Return the path with respect to the stack

Type:string (readonly)
ref

Inherited from @aws-cdk/cdk.CfnRefElement

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
referenceToken

Inherited from @aws-cdk/cdk.CfnRefElement

Return a token that will CloudFormation { Ref } this stack element

Protected property

Type:@aws-cdk/cdk.Token (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.CfnResource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.CfnResource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.CfnResource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.CfnResource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
options

Inherited from @aws-cdk/cdk.CfnResource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.IResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.CfnResource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.CfnResource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.CfnResource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CfnFunctionProps (interface)

class @aws-cdk/aws-lambda.CfnFunctionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnFunctionProps;
// CfnFunctionProps is an interface
import { CfnFunctionProps } from '@aws-cdk/aws-lambda';

Properties for defining a AWS::Lambda::Function

code

AWS::Lambda::Function.Code

Type:@aws-cdk/cdk.Token or CodeProperty (readonly)
handler

AWS::Lambda::Function.Handler

Type:string (readonly)
role

AWS::Lambda::Function.Role

Type:string (readonly)
runtime

AWS::Lambda::Function.Runtime

Type:string (readonly)
deadLetterConfig

AWS::Lambda::Function.DeadLetterConfig

Type:@aws-cdk/cdk.Token or DeadLetterConfigProperty (optional) (readonly)
description

AWS::Lambda::Function.Description

Type:string (optional) (readonly)
environment

AWS::Lambda::Function.Environment

Type:@aws-cdk/cdk.Token or EnvironmentProperty (optional) (readonly)
functionName

AWS::Lambda::Function.FunctionName

Type:string (optional) (readonly)
kmsKeyArn

AWS::Lambda::Function.KmsKeyArn

Type:string (optional) (readonly)
layers

AWS::Lambda::Function.Layers

Type:string[] (optional) (readonly)
memorySize

AWS::Lambda::Function.MemorySize

Type:number or @aws-cdk/cdk.Token (optional) (readonly)
reservedConcurrentExecutions

AWS::Lambda::Function.ReservedConcurrentExecutions

Type:number or @aws-cdk/cdk.Token (optional) (readonly)
tags

AWS::Lambda::Function.Tags

Type:@aws-cdk/cdk.CfnTag[] (optional) (readonly)
timeout

AWS::Lambda::Function.Timeout

Type:number or @aws-cdk/cdk.Token (optional) (readonly)
tracingConfig

AWS::Lambda::Function.TracingConfig

Type:@aws-cdk/cdk.Token or TracingConfigProperty (optional) (readonly)
vpcConfig

AWS::Lambda::Function.VpcConfig

Type:@aws-cdk/cdk.Token or VpcConfigProperty (optional) (readonly)

CfnLayerVersion

class @aws-cdk/aws-lambda.CfnLayerVersion(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnLayerVersion;
const { CfnLayerVersion } = require('@aws-cdk/aws-lambda');
import { CfnLayerVersion } from '@aws-cdk/aws-lambda';

A CloudFormation AWS::Lambda::LayerVersion

Extends:

@aws-cdk/cdk.CfnResource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.CfnResource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
layerVersionArn
Type:string (readonly)
propertyOverrides
Type:CfnLayerVersionProps (readonly)
class ContentProperty

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnLayerVersion.ContentProperty;
// CfnLayerVersion.ContentProperty is an interface
import { CfnLayerVersion.ContentProperty } from '@aws-cdk/aws-lambda';
s3Bucket

CfnLayerVersion.ContentProperty.S3Bucket

Type:string (readonly)
s3Key

CfnLayerVersion.ContentProperty.S3Key

Type:string (readonly)
s3ObjectVersion

CfnLayerVersion.ContentProperty.S3ObjectVersion

Type:string (optional) (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.CfnElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.CfnElement

Automatically detect references in this CfnElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.CfnElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.CfnElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.CfnElement

Return the path with respect to the stack

Type:string (readonly)
ref

Inherited from @aws-cdk/cdk.CfnRefElement

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
referenceToken

Inherited from @aws-cdk/cdk.CfnRefElement

Return a token that will CloudFormation { Ref } this stack element

Protected property

Type:@aws-cdk/cdk.Token (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.CfnResource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.CfnResource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.CfnResource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.CfnResource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
options

Inherited from @aws-cdk/cdk.CfnResource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.IResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.CfnResource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.CfnResource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.CfnResource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CfnLayerVersionPermission

class @aws-cdk/aws-lambda.CfnLayerVersionPermission(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnLayerVersionPermission;
const { CfnLayerVersionPermission } = require('@aws-cdk/aws-lambda');
import { CfnLayerVersionPermission } from '@aws-cdk/aws-lambda';

A CloudFormation AWS::Lambda::LayerVersionPermission

Extends:

@aws-cdk/cdk.CfnResource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.CfnResource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
layerVersionPermissionArn
Type:string (readonly)
propertyOverrides
Type:CfnLayerVersionPermissionProps (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.CfnElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.CfnElement

Automatically detect references in this CfnElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.CfnElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.CfnElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.CfnElement

Return the path with respect to the stack

Type:string (readonly)
ref

Inherited from @aws-cdk/cdk.CfnRefElement

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
referenceToken

Inherited from @aws-cdk/cdk.CfnRefElement

Return a token that will CloudFormation { Ref } this stack element

Protected property

Type:@aws-cdk/cdk.Token (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.CfnResource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.CfnResource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.CfnResource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.CfnResource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
options

Inherited from @aws-cdk/cdk.CfnResource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.IResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.CfnResource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.CfnResource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.CfnResource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CfnLayerVersionPermissionProps (interface)

class @aws-cdk/aws-lambda.CfnLayerVersionPermissionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnLayerVersionPermissionProps;
// CfnLayerVersionPermissionProps is an interface
import { CfnLayerVersionPermissionProps } from '@aws-cdk/aws-lambda';

Properties for defining a AWS::Lambda::LayerVersionPermission

action

AWS::Lambda::LayerVersionPermission.Action

Type:string (readonly)
layerVersionArn

AWS::Lambda::LayerVersionPermission.LayerVersionArn

Type:string (readonly)
principal

AWS::Lambda::LayerVersionPermission.Principal

Type:string (readonly)
organizationId

AWS::Lambda::LayerVersionPermission.OrganizationId

Type:string (optional) (readonly)

CfnLayerVersionProps (interface)

class @aws-cdk/aws-lambda.CfnLayerVersionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnLayerVersionProps;
// CfnLayerVersionProps is an interface
import { CfnLayerVersionProps } from '@aws-cdk/aws-lambda';

Properties for defining a AWS::Lambda::LayerVersion

content

AWS::Lambda::LayerVersion.Content

Type:@aws-cdk/cdk.Token or ContentProperty (readonly)
compatibleRuntimes

AWS::Lambda::LayerVersion.CompatibleRuntimes

Type:string[] (optional) (readonly)
description

AWS::Lambda::LayerVersion.Description

Type:string (optional) (readonly)
layerName

AWS::Lambda::LayerVersion.LayerName

Type:string (optional) (readonly)
licenseInfo

AWS::Lambda::LayerVersion.LicenseInfo

Type:string (optional) (readonly)

CfnPermission

class @aws-cdk/aws-lambda.CfnPermission(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnPermission;
const { CfnPermission } = require('@aws-cdk/aws-lambda');
import { CfnPermission } from '@aws-cdk/aws-lambda';

A CloudFormation AWS::Lambda::Permission

Extends:

@aws-cdk/cdk.CfnResource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.CfnResource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
propertyOverrides
Type:CfnPermissionProps (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.CfnElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.CfnElement

Automatically detect references in this CfnElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.CfnElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.CfnElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.CfnElement

Return the path with respect to the stack

Type:string (readonly)
ref

Inherited from @aws-cdk/cdk.CfnRefElement

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
referenceToken

Inherited from @aws-cdk/cdk.CfnRefElement

Return a token that will CloudFormation { Ref } this stack element

Protected property

Type:@aws-cdk/cdk.Token (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.CfnResource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.CfnResource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.CfnResource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.CfnResource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
options

Inherited from @aws-cdk/cdk.CfnResource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.IResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.CfnResource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.CfnResource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.CfnResource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CfnPermissionProps (interface)

class @aws-cdk/aws-lambda.CfnPermissionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnPermissionProps;
// CfnPermissionProps is an interface
import { CfnPermissionProps } from '@aws-cdk/aws-lambda';

Properties for defining a AWS::Lambda::Permission

action

AWS::Lambda::Permission.Action

Type:string (readonly)
functionName

AWS::Lambda::Permission.FunctionName

Type:string (readonly)
principal

AWS::Lambda::Permission.Principal

Type:string (readonly)
eventSourceToken

AWS::Lambda::Permission.EventSourceToken

Type:string (optional) (readonly)
sourceAccount

AWS::Lambda::Permission.SourceAccount

Type:string (optional) (readonly)
sourceArn

AWS::Lambda::Permission.SourceArn

Type:string (optional) (readonly)

CfnVersion

class @aws-cdk/aws-lambda.CfnVersion(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnVersion;
const { CfnVersion } = require('@aws-cdk/aws-lambda');
import { CfnVersion } from '@aws-cdk/aws-lambda';

A CloudFormation AWS::Lambda::Version

Extends:

@aws-cdk/cdk.CfnResource

Parameters:
renderProperties(properties) → string => any

Overrides @aws-cdk/cdk.CfnResource.renderProperties()

Protected method

Parameters:properties (any) –
Return type:string => any
resourceTypeName

The CloudFormation resource type name for this resource class.

Type:string (readonly) (static)
propertyOverrides
Type:CfnVersionProps (readonly)
version
Type:string (readonly)
versionArn
Type:string (readonly)
overrideLogicalId(newLogicalId)

Inherited from @aws-cdk/cdk.CfnElement

Overrides the auto-generated logical ID with a specific ID.

Parameters:newLogicalId (string) – The new logical ID to use for this stack element.
prepare()

Inherited from @aws-cdk/cdk.CfnElement

Automatically detect references in this CfnElement

Protected method

creationStackTrace

Inherited from @aws-cdk/cdk.CfnElement

Type:string[] (readonly)
logicalId

Inherited from @aws-cdk/cdk.CfnElement

The logical ID for this CloudFormation stack element. The logical ID of the element

is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Type:string (readonly)
stackPath

Inherited from @aws-cdk/cdk.CfnElement

Return the path with respect to the stack

Type:string (readonly)
ref

Inherited from @aws-cdk/cdk.CfnRefElement

Returns a token to a CloudFormation { Ref } that references this entity based on it’s logical ID.

Type:string (readonly)
referenceToken

Inherited from @aws-cdk/cdk.CfnRefElement

Return a token that will CloudFormation { Ref } this stack element

Protected property

Type:@aws-cdk/cdk.Token (readonly)
addDeletionOverride(path)

Inherited from @aws-cdk/cdk.CfnResource

Syntactic sugar for addOverride(path, undefined).

Parameters:path (string) – The path of the value to delete
addDependsOn(resource)

Inherited from @aws-cdk/cdk.CfnResource

Indicates that this resource depends on another resource and cannot be provisioned

unless the other resource has been successfully provisioned.

Parameters:resource (@aws-cdk/cdk.CfnResource) –
addOverride(path, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to the synthesized CloudFormation resource. To add a

property override, either use addPropertyOverride or prefix path with

“Properties.” (i.e. Properties.TopicName).

Parameters:
  • path (string) – The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
  • value (any) – The value. Could be primitive or complex.
addPropertyDeletionOverride(propertyPath)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override that deletes the value of a property from the resource definition.

Parameters:propertyPath (string) – The path to the property.
addPropertyOverride(propertyPath, value)

Inherited from @aws-cdk/cdk.CfnResource

Adds an override to a resource property.

Syntactic sugar for addOverride(“Properties.<…>”, value).

Parameters:
  • propertyPath (string) – The path of the property
  • value (any) – The value
getAtt(attributeName) → @aws-cdk/cdk.CfnReference

Inherited from @aws-cdk/cdk.CfnResource

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility

in case there is no generated attribute.

Parameters:attributeName (string) – The name of the attribute.
Return type:@aws-cdk/cdk.CfnReference
options

Inherited from @aws-cdk/cdk.CfnResource

Options for this resource, such as condition, update policy etc.

Type:@aws-cdk/cdk.IResourceOptions (readonly)
properties

Inherited from @aws-cdk/cdk.CfnResource

AWS resource properties.

This object is rendered via a call to “renderProperties(this.properties)”.

Protected property

Type:any (readonly)
resourceType

Inherited from @aws-cdk/cdk.CfnResource

AWS resource type.

Type:string (readonly)
untypedPropertyOverrides

Inherited from @aws-cdk/cdk.CfnResource

AWS resource property overrides.

During synthesis, the method “renderProperties(this.overrides)” is called

with this object, and merged on top of the output of

“renderProperties(this.properties)”.

Derived classes should expose a strongly-typed version of this object as

a public property called propertyOverrides.

Protected property

Type:any (readonly)
toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

CfnVersionProps (interface)

class @aws-cdk/aws-lambda.CfnVersionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.CfnVersionProps;
// CfnVersionProps is an interface
import { CfnVersionProps } from '@aws-cdk/aws-lambda';

Properties for defining a AWS::Lambda::Version

functionName

AWS::Lambda::Version.FunctionName

Type:string (readonly)
codeSha256

AWS::Lambda::Version.CodeSha256

Type:string (optional) (readonly)
description

AWS::Lambda::Version.Description

Type:string (optional) (readonly)

Code

class @aws-cdk/aws-lambda.Code

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.Code;
const { Code } = require('@aws-cdk/aws-lambda');
import { Code } from '@aws-cdk/aws-lambda';
Abstract:Yes
static asset(path) → @aws-cdk/aws-lambda.AssetCode

Loads the function code from a local disk asset.

Parameters:path (string) – Either a directory with the Lambda code bundle or a .zip file
Return type:AssetCode
static bucket(bucket, key[, objectVersion]) → @aws-cdk/aws-lambda.S3Code
Parameters:
  • bucket (@aws-cdk/aws-s3.IBucket) – The S3 bucket
  • key (string) – The object key
  • objectVersion (string (optional)) – Optional S3 object version
Returns:

LambdaS3Code associated with the specified S3 object.

Return type:

S3Code

static directory(directoryToZip) → @aws-cdk/aws-lambda.AssetCode
Parameters:directoryToZip (string) – The directory to zip
Returns:Zip archives the contents of a directory on disk and uses this as the lambda handler’s code.
Return type:AssetCode
static file(filePath) → @aws-cdk/aws-lambda.AssetCode
Parameters:filePath (string) – The file path
Returns:Uses a file on disk as a lambda handler’s code.
Return type:AssetCode
static inline(code) → @aws-cdk/aws-lambda.InlineCode
Parameters:code (string) – The actual handler code (limited to 4KiB)
Returns:LambdaInlineCode with inline code.
Return type:InlineCode
bind(_construct)

Called when the lambda or layer is initialized to allow this object to

bind to the stack, add resources and have fun.

Parameters:_construct (@aws-cdk/cdk.Construct) –
isInline

Determines whether this Code is inline code or not.

Type:boolean (readonly) (abstract)

EventSourceMapping

class @aws-cdk/aws-lambda.EventSourceMapping(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.EventSourceMapping;
const { EventSourceMapping } = require('@aws-cdk/aws-lambda');
import { EventSourceMapping } from '@aws-cdk/aws-lambda';

Defines a Lambda EventSourceMapping resource.

Usually, you won’t need to define the mapping yourself. This will usually be done by

event sources. For example, to add an SQS event source to a function:

import { SqsEventSource } from @aws-cdk/aws-lambda-event-sources’;

lambda.addEventSource(new SqsEventSource(sqs));

The SqsEventSource class will automatically create the mapping, and will also

modify the Lambda’s execution role so it can consume messages from the queue.

Extends:

@aws-cdk/cdk.Construct

Parameters:
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

EventSourceMappingProps (interface)

class @aws-cdk/aws-lambda.EventSourceMappingProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.EventSourceMappingProps;
// EventSourceMappingProps is an interface
import { EventSourceMappingProps } from '@aws-cdk/aws-lambda';
eventSourceArn

The Amazon Resource Name (ARN) of the event source. Any record added to

this stream can invoke the Lambda function.

Type:string (readonly)
target

The target AWS Lambda function.

Type:IFunction (readonly)
batchSize

The largest number of records that AWS Lambda will retrieve from your event

source at the time of invoking your function. Your function receives an

event with all the retrieved records.

Valid Range: Minimum value of 1. Maximum value of 10000.

Type:number (optional) (readonly)
Default:The default for Amazon Kinesis and Amazon DynamoDB is 100 records.

Both the default and maximum for Amazon SQS are 10 messages.

@aws-cdk/aws-lambda.enabled

Set to false to disable the event source upon creation.

Type:boolean (optional) (readonly)
Default:true
@aws-cdk/aws-lambda.startingPosition

The position in the DynamoDB or Kinesis stream where AWS Lambda should

start reading.

Type:StartingPosition (optional) (readonly)

Function

class @aws-cdk/aws-lambda.Function(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.Function;
const { Function } = require('@aws-cdk/aws-lambda');
import { Function } from '@aws-cdk/aws-lambda';

Deploys a file from from inside the construct library as a function.

The supplied file is subject to the 4096 bytes limit of being embedded in a

CloudFormation template.

The construct includes an associated role with the lambda.

This construct does not yet reproduce all features from the underlying resource

library.

Extends:

FunctionBase

Parameters:
static import(scope, id, props) → @aws-cdk/aws-lambda.IFunction

Creates a Lambda function object which represents a function not defined

within this stack.

Lambda.import(this, ‘MyImportedFunction’, { lambdaArn: new LambdaArn(‘arn:aws:…’) });
Parameters:
  • scope (@aws-cdk/cdk.Construct) –
  • id (string) – The name of the lambda construct
  • props (FunctionImportProps) – A reference to a Lambda function. Can be created manually (see example above) or obtained through a call to lambda.export().
Return type:

IFunction

static metricAll(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Return the given named metric for this Lambda

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

static metricAllConcurrentExecutions([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the number of concurrent executions across all Lambdas

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
static metricAllDuration([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the Duration executing all Lambdas

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
static metricAllErrors([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the number of Errors executing all Lambdas

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
static metricAllInvocations([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the number of invocations of all Lambdas

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
static metricAllThrottles([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the number of throttled invocations of all Lambdas

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
static metricAllUnreservedConcurrentExecutions([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the number of unreserved concurrent executions across all Lambdas

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
addEnvironment(key, value) → @aws-cdk/aws-lambda.Function

Adds an environment variable to this Lambda function.

If this is a ref to a Lambda function, this operation results in a no-op.

Parameters:
  • key (string) – The environment variable key.
  • value (any) – The environment variable’s value.
Return type:

Function

addLayer(layer) → @aws-cdk/aws-lambda.Function

Adds a Lambda Layer to this Lambda function.

Parameters:layer (ILayerVersion) – the layer to be added.
Return type:Function
addVersion(name[, codeSha256[, description]]) → @aws-cdk/aws-lambda.Version

Add a new version for this Lambda

If you want to deploy through CloudFormation and use aliases, you need to

add a new version (with a new name) to your Lambda every time you want

to deploy an update. An alias can then refer to the newly created Version.

All versions should have distinct names, and you should not delete versions

as long as your Alias needs to refer to them.

Parameters:
  • name (string) – A unique name for this version
  • codeSha256 (string (optional)) – The SHA-256 hash of the most recently deployed Lambda source code, or omit to skip validation.
  • description (string (optional)) – A description for this version.
Returns:

A new Version object.

Return type:

Version

export() → @aws-cdk/aws-lambda.FunctionImportProps

Implements @aws-cdk/aws-lambda.FunctionBase.export()

Export this Function (without the role)

Return type:FunctionImportProps
newVersion() → @aws-cdk/aws-lambda.Version

Add a new version for this Lambda, always with a different name.

This is similar to the {@link addVersion} method,

but useful when deploying this Lambda through CodePipeline with blue/green deployments.

When using {@link addVersion},

your Alias will not be updated until you change the name passed to {@link addVersion} in your CDK code.

When deploying through a Pipeline,

that might lead to a situation where a change to your Lambda application code will never be activated,

even though it traveled through the entire Pipeline,

because the Alias is still pointing to an old Version.

This method creates a new, unique Version every time the CDK code is executed,

and so prevents that from happening.

Return type:Version
canCreatePermissions

Implements @aws-cdk/aws-lambda.FunctionBase.canCreatePermissions()

Whether the addPermission() call adds any permissions

True for new Lambdas, false for imported Lambdas (they might live in different accounts).

Protected property

Type:boolean (readonly)
functionArn

Implements @aws-cdk/aws-lambda.FunctionBase.functionArn()

ARN of this function

Type:string (readonly)
functionName

Implements @aws-cdk/aws-lambda.FunctionBase.functionName()

Name of this function

Type:string (readonly)
grantPrincipal

Implements @aws-cdk/aws-lambda.FunctionBase.grantPrincipal()

The principal this Lambda Function is running as

Type:@aws-cdk/aws-iam.IPrincipal (readonly)
handler

The name of the handler configured for this lambda.

Type:string (readonly)
runtime

The runtime configured for this lambda.

Type:Runtime (readonly)
role

Implements @aws-cdk/aws-lambda.FunctionBase.role()

Execution role associated with this function

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
addEventSource(source)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Adds an event source to this function.

Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module.

The following example adds an SQS Queue as an event source:

import { SqsEventSource } from @aws-cdk/aws-lambda-event-sources’;

myFunction.addEventSource(new SqsEventSource(myQueue));

Parameters:source (IEventSource) – The event source to bind to this function
addPermission(id, permission)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Adds a permission to the Lambda resource policy.

Parameters:
  • id (string) – The id ƒor the permission construct
  • permission (Permission) –
addToRolePolicy(statement)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Allows this Lambda to be used as a destination for bucket notifications.

Use bucket.onEvent(lambda) to subscribe.

Parameters:
  • bucketArn (string) –
  • bucketId (string) –
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

asEventRuleTarget(ruleArn, ruleId) → @aws-cdk/aws-events.EventRuleTargetProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Returns a RuleTarget that can be used to trigger this Lambda as a

result from a CloudWatch event.

Parameters:
  • ruleArn (string) –
  • ruleId (string) –
Return type:

@aws-cdk/aws-events.EventRuleTargetProps

asStepFunctionsTaskResource(_callingTask) → @aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required for using this object as a Task resource

Parameters:_callingTask (@aws-cdk/aws-stepfunctions.Task) –
Return type:@aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps
grantInvoke(grantee) → @aws-cdk/aws-iam.Grant

Inherited from @aws-cdk/aws-lambda.FunctionBase

Grant the given identity permissions to invoke this Lambda

Parameters:grantee (@aws-cdk/aws-iam.IGrantable) –
Return type:@aws-cdk/aws-iam.Grant
logSubscriptionDestination(sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:sourceLogGroup (@aws-cdk/aws-logs.ILogGroup) –
Return type:@aws-cdk/aws-logs.LogSubscriptionDestination
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the given named metric for this Function

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

metricDuration([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How long execution of this Lambda takes

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricErrors([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How many invocations of this Lambda fail

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricInvocations([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is invoked

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricThrottles([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is throttled

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
connections

Inherited from @aws-cdk/aws-lambda.FunctionBase

Access the Connections object

Will fail if not a VPC-enabled Lambda Function

Type:@aws-cdk/aws-ec2.Connections (readonly)
id

Inherited from @aws-cdk/aws-lambda.FunctionBase

Logical ID of this Function.

Type:string (readonly)
isBoundToVpc

Inherited from @aws-cdk/aws-lambda.FunctionBase

Whether or not this Lambda function was bound to a VPC

If this is is false, trying to access the connections object will fail.

Type:boolean (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

FunctionBase

class @aws-cdk/aws-lambda.FunctionBase(scope, id)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.FunctionBase;
const { FunctionBase } = require('@aws-cdk/aws-lambda');
import { FunctionBase } from '@aws-cdk/aws-lambda';
Extends:

@aws-cdk/cdk.Construct

Implements:

IFunction

Abstract:

Yes

Parameters:
  • scope (@aws-cdk/cdk.Construct) – The scope in which to define this construct
  • id (string) – The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (/), then it will be replaced by double dash .
addEventSource(source)

Implements @aws-cdk/aws-lambda.IFunction.addEventSource()

Adds an event source to this function.

Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module.

The following example adds an SQS Queue as an event source:

import { SqsEventSource } from @aws-cdk/aws-lambda-event-sources’;

myFunction.addEventSource(new SqsEventSource(myQueue));

Parameters:source (IEventSource) – The event source to bind to this function
addPermission(id, permission)

Implements @aws-cdk/aws-lambda.IFunction.addPermission()

Adds a permission to the Lambda resource policy.

Parameters:
  • id (string) – The id ƒor the permission construct
  • permission (Permission) –
addToRolePolicy(statement)

Implements @aws-cdk/aws-lambda.IFunction.addToRolePolicy()

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Implements @aws-cdk/aws-s3-notifications.IBucketNotificationDestination.asBucketNotificationDestination()

Allows this Lambda to be used as a destination for bucket notifications.

Use bucket.onEvent(lambda) to subscribe.

Parameters:
  • bucketArn (string) –
  • bucketId (string) –
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

asEventRuleTarget(ruleArn, ruleId) → @aws-cdk/aws-events.EventRuleTargetProps

Implements @aws-cdk/aws-events.IEventRuleTarget.asEventRuleTarget()

Returns a RuleTarget that can be used to trigger this Lambda as a

result from a CloudWatch event.

Parameters:
  • ruleArn (string) –
  • ruleId (string) –
Return type:

@aws-cdk/aws-events.EventRuleTargetProps

asStepFunctionsTaskResource(_callingTask) → @aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps

Implements @aws-cdk/aws-stepfunctions.IStepFunctionsTaskResource.asStepFunctionsTaskResource()

Return the properties required for using this object as a Task resource

Parameters:_callingTask (@aws-cdk/aws-stepfunctions.Task) –
Return type:@aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps
export() → @aws-cdk/aws-lambda.FunctionImportProps

Implements @aws-cdk/aws-lambda.IFunction.export()

Export this Function (without the role)

Return type:FunctionImportProps
Abstract:Yes
grantInvoke(grantee) → @aws-cdk/aws-iam.Grant

Implements @aws-cdk/aws-lambda.IFunction.grantInvoke()

Grant the given identity permissions to invoke this Lambda

Parameters:grantee (@aws-cdk/aws-iam.IGrantable) –
Return type:@aws-cdk/aws-iam.Grant
logSubscriptionDestination(sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Implements @aws-cdk/aws-logs.ILogSubscriptionDestination.logSubscriptionDestination()

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:sourceLogGroup (@aws-cdk/aws-logs.ILogGroup) –
Return type:@aws-cdk/aws-logs.LogSubscriptionDestination
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-lambda.IFunction.metric()

Return the given named metric for this Function

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

metricDuration([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-lambda.IFunction.metricDuration()

How long execution of this Lambda takes

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricErrors([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-lambda.IFunction.metricErrors()

How many invocations of this Lambda fail

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricInvocations([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-lambda.IFunction.metricInvocations()

How often this Lambda is invoked

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricThrottles([props]) → @aws-cdk/aws-cloudwatch.Metric

Implements @aws-cdk/aws-lambda.IFunction.metricThrottles()

How often this Lambda is throttled

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
canCreatePermissions

Whether the addPermission() call adds any permissions

True for new Lambdas, false for imported Lambdas (they might live in different accounts).

Protected property

Type:boolean (readonly) (abstract)
connections

Implements @aws-cdk/aws-ec2.IConnectable.connections()

Access the Connections object

Will fail if not a VPC-enabled Lambda Function

Type:@aws-cdk/aws-ec2.Connections (readonly)
functionArn

Implements @aws-cdk/aws-lambda.IFunction.functionArn()

The ARN fo the function.

Type:string (readonly) (abstract)
functionName

Implements @aws-cdk/aws-lambda.IFunction.functionName()

The name of the function.

Type:string (readonly) (abstract)
grantPrincipal

Implements @aws-cdk/aws-iam.IGrantable.grantPrincipal()

The principal this Lambda Function is running as

Type:@aws-cdk/aws-iam.IPrincipal (readonly) (abstract)
id

Implements @aws-cdk/aws-lambda.IFunction.id()

Logical ID of this Function.

Type:string (readonly)
isBoundToVpc

Implements @aws-cdk/aws-lambda.IFunction.isBoundToVpc()

Whether or not this Lambda function was bound to a VPC

If this is is false, trying to access the connections object will fail.

Type:boolean (readonly)
role

Implements @aws-cdk/aws-lambda.IFunction.role()

The IAM role associated with this function.

Undefined if the function was imported without a role.

Type:@aws-cdk/aws-iam.IRole (optional) (readonly) (abstract)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

FunctionImportProps (interface)

class @aws-cdk/aws-lambda.FunctionImportProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.FunctionImportProps;
// FunctionImportProps is an interface
import { FunctionImportProps } from '@aws-cdk/aws-lambda';

Represents a Lambda function defined outside of this stack.

functionArn

The ARN of the Lambda function.

Format: arn:<partition>:lambda:<region>:<account-id>:function:<function-name>

Type:string (readonly)
role

The IAM execution role associated with this function.

If the role is not specified, any role-related operations will no-op.

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
securityGroupId

Id of the securityGroup for this Lambda, if in a VPC.

This needs to be given in order to support allowing connections

to this Lambda.

Type:string (optional) (readonly)

FunctionProps (interface)

class @aws-cdk/aws-lambda.FunctionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.FunctionProps;
// FunctionProps is an interface
import { FunctionProps } from '@aws-cdk/aws-lambda';
code

The source code of your Lambda function. You can point to a file in an

Amazon Simple Storage Service (Amazon S3) bucket or specify your source

code as inline text.

Type:Code (readonly)
handler

The name of the function (within your source code) that Lambda calls to

start running your code. For more information, see the Handler property

in the AWS Lambda Developer Guide.

NOTE: If you specify your source code as inline text by specifying the

ZipFile property within the Code property, specify index.function_name as

the handler.

Type:string (readonly)
runtime

The runtime environment for the Lambda function that you are uploading.

For valid values, see the Runtime property in the AWS Lambda Developer

Guide.

Type:Runtime (readonly)
allowAllOutbound

Whether to allow the Lambda to send all network traffic

If set to false, you must individually add traffic rules to allow the

Lambda to connect to network targets.

Type:boolean (optional) (readonly)
Default:true
deadLetterQueue

The SQS queue to use if DLQ is enabled.

Type:@aws-cdk/aws-sqs.IQueue (optional) (readonly)
Default:SQS queue with 14 day retention period if deadLetterQueueEnabled is true
deadLetterQueueEnabled

Enabled DLQ. If deadLetterQueue is undefined,

an SQS queue with default options will be defined for your Function.

Type:boolean (optional) (readonly)
Default:false unless deadLetterQueue is set, which implies DLQ is enabled
description

A description of the function.

Type:string (optional) (readonly)
environment

Key-value pairs that Lambda caches and makes available for your Lambda

functions. Use environment variables to apply configuration changes, such

as test and production environment configurations, without changing your

Lambda function source code.

Type:string => any (optional) (readonly)
events

Event sources for this function.

You can also add event sources using addEventSource.

Type:IEventSource[] (optional) (readonly)
functionName

A name for the function. If you don’t specify a name, AWS CloudFormation

generates a unique physical ID and uses that ID for the function’s name.

For more information, see Name Type.

Type:string (optional) (readonly)
initialPolicy

Initial policy statements to add to the created Lambda Role.

You can call addToRolePolicy to the created lambda to add statements post creation.

Type:@aws-cdk/aws-iam.PolicyStatement[] (optional) (readonly)
layers

A list of layers to add to the function’s execution environment. You can configure your Lambda function to pull in

additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies

that can be used by mulitple functions.

Type:ILayerVersion[] (optional) (readonly)
Default:no layers
logRetentionDays

The number of days log events are kept in CloudWatch Logs. When updating

this property, unsetting it doesn’t remove the log retention policy. To

remove the retention policy, set the value to Infinity.

Type:@aws-cdk/aws-logs.RetentionDays (optional) (readonly)
Default:logs never expire
memorySize

The amount of memory, in MB, that is allocated to your Lambda function.

Lambda uses this value to proportionally allocate the amount of CPU

power. For more information, see Resource Model in the AWS Lambda

Developer Guide.

Type:number (optional) (readonly)
Default:The default value is 128 MB
reservedConcurrentExecutions

The maximum of concurrent executions you want to reserve for the function.

Type:number (optional) (readonly)
Default:no specific limit - account limit
role

Lambda execution role.

This is the role that will be assumed by the function upon execution.

It controls the permissions that the function will have. The Role must

be assumable by the ‘lambda.amazonaws.com’ service principal.

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
Default:a unique role will be generated for this lambda function.

Both supplied and generated roles can always be changed by calling addToRolePolicy.

@aws-cdk/aws-lambda.securityGroup

What security group to associate with the Lambda’s network interfaces.

Only used if ‘vpc’ is supplied.

Type:@aws-cdk/aws-ec2.ISecurityGroup (optional) (readonly)
Default:If the function is placed within a VPC and a security group is

not specified, a dedicated security group will be created for this function.

@aws-cdk/aws-lambda.timeout

The function execution time (in seconds) after which Lambda terminates

the function. Because the execution time affects cost, set this value

based on the function’s expected execution time.

Type:number (optional) (readonly)
Default:3 seconds.
@aws-cdk/aws-lambda.tracing

Enable AWS X-Ray Tracing for Lambda Function.

Type:Tracing (optional) (readonly)
Default:undefined X-Ray tracing disabled
@aws-cdk/aws-lambda.vpc

VPC network to place Lambda network interfaces

Specify this if the Lambda function needs to access resources in a VPC.

Type:@aws-cdk/aws-ec2.IVpcNetwork (optional) (readonly)
@aws-cdk/aws-lambda.vpcSubnets

Where to place the network interfaces within the VPC.

Only used if ‘vpc’ is supplied. Note: internet access for Lambdas

requires a NAT gateway, so picking Public subnets is not allowed.

Type:@aws-cdk/aws-ec2.SubnetSelection (optional) (readonly)
Default:All private subnets

IEventSource (interface)

class @aws-cdk/aws-lambda.IEventSource

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.IEventSource;
// IEventSource is an interface
import { IEventSource } from '@aws-cdk/aws-lambda';

An abstract class which represents an AWS Lambda event source.

bind(target)

Called by lambda.addEventSource to allow the event source to bind to this

function.

Parameters:target (FunctionBase) – That lambda function to bind to.
Abstract:Yes

IFunction (interface)

class @aws-cdk/aws-lambda.IFunction

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.IFunction;
// IFunction is an interface
import { IFunction } from '@aws-cdk/aws-lambda';
Extends:@aws-cdk/cdk.IConstruct
Extends:@aws-cdk/aws-events.IEventRuleTarget
Extends:@aws-cdk/aws-logs.ILogSubscriptionDestination
Extends:@aws-cdk/aws-s3-notifications.IBucketNotificationDestination
Extends:@aws-cdk/aws-ec2.IConnectable
Extends:@aws-cdk/aws-stepfunctions.IStepFunctionsTaskResource
Extends:@aws-cdk/aws-iam.IGrantable
functionArn

The ARN fo the function.

Type:string (readonly)
functionName

The name of the function.

Type:string (readonly)
id

Logical ID of this Function.

Type:string (readonly)
isBoundToVpc

Whether or not this Lambda function was bound to a VPC

If this is is false, trying to access the connections object will fail.

Type:boolean (readonly)
role

The IAM role associated with this function.

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
addEventSource(source)
Parameters:source (IEventSource) –
Abstract:Yes
addPermission(id, permission)

Adds a permission to the Lambda resource policy.

Parameters:
  • id (string) – The id ƒor the permission construct
  • permission (Permission) –
Abstract:

Yes

addToRolePolicy(statement)
Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
Abstract:Yes
export() → @aws-cdk/aws-lambda.FunctionImportProps

Export this Function (without the role)

Return type:FunctionImportProps
Abstract:Yes
grantInvoke(identity) → @aws-cdk/aws-iam.Grant

Grant the given identity permissions to invoke this Lambda

Parameters:identity (@aws-cdk/aws-iam.IGrantable) –
Return type:@aws-cdk/aws-iam.Grant
Abstract:Yes
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Return the given named metric for this Lambda

Return the given named metric for this Function

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

Abstract:

Yes

metricDuration([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the Duration of this Lambda

How long execution of this Lambda takes

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricErrors([props]) → @aws-cdk/aws-cloudwatch.Metric

How many invocations of this Lambda fail

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricInvocations([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the number of invocations of this Lambda

How often this Lambda is invoked

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
metricThrottles([props]) → @aws-cdk/aws-cloudwatch.Metric

Metric for the number of throttled invocations of this Lambda

How often this Lambda is throttled

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
Abstract:Yes
connections

Inherited from @aws-cdk/aws-ec2.IConnectable

Type:@aws-cdk/aws-ec2.Connections (readonly)
asEventRuleTarget(ruleArn, ruleUniqueId) → @aws-cdk/aws-events.EventRuleTargetProps

Inherited from @aws-cdk/aws-events.IEventRuleTarget

Returns the rule target specification.

NOTE: Do not use the various inputXxx options. They can be set in a call to addTarget.

Parameters:
  • ruleArn (string) – The ARN of the CloudWatch Event Rule that would trigger this target.
  • ruleUniqueId (string) – A unique ID for this rule. Can be used to implement idempotency.
Return type:

@aws-cdk/aws-events.EventRuleTargetProps

Abstract:

Yes

grantPrincipal

Inherited from @aws-cdk/aws-iam.IGrantable

The principal to grant permissions to

Type:@aws-cdk/aws-iam.IPrincipal (readonly)
logSubscriptionDestination(sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Inherited from @aws-cdk/aws-logs.ILogSubscriptionDestination

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:sourceLogGroup (@aws-cdk/aws-logs.ILogGroup) –
Return type:@aws-cdk/aws-logs.LogSubscriptionDestination
Abstract:Yes
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Inherited from @aws-cdk/aws-s3-notifications.IBucketNotificationDestination

Registers this resource to receive notifications for the specified

bucket. This method will only be called once for each destination/bucket

pair and the result will be cached, so there is no need to implement

idempotency in each destination.

Parameters:
  • bucketArn (string) – The ARN of the bucket
  • bucketId (string) – A unique ID of this bucket in the stack
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Abstract:

Yes

asStepFunctionsTaskResource(callingTask) → @aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps

Inherited from @aws-cdk/aws-stepfunctions.IStepFunctionsTaskResource

Return the properties required for using this object as a Task resource

Parameters:callingTask (@aws-cdk/aws-stepfunctions.Task) –
Return type:@aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps
Abstract:Yes
node

Inherited from @aws-cdk/cdk.IConstruct

The construct node in the scope tree.

Type:@aws-cdk/cdk.ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)

ILayerVersion (interface)

class @aws-cdk/aws-lambda.ILayerVersion

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.ILayerVersion;
// ILayerVersion is an interface
import { ILayerVersion } from '@aws-cdk/aws-lambda';
Extends:@aws-cdk/cdk.IConstruct
layerVersionArn

The ARN of the Lambda Layer version that this Layer defines.

Type:string (readonly)
compatibleRuntimes

The runtimes compatible with this Layer.

Type:Runtime[] (optional) (readonly)
export() → @aws-cdk/aws-lambda.LayerVersionImportProps

Exports this layer for use in another Stack. The resulting object can be passed to the LayerVersion.import

function to obtain an ILayerVersion in the user stack.

Return type:LayerVersionImportProps
Abstract:Yes
grantUsage(id, grantee) → @aws-cdk/aws-lambda.ILayerVersion

Grants usage of this layer to specific entities. Usage within the same account where the layer is defined is always

allowed and does not require calling this method. Note that the principal that creates the Lambda function using

the layer (for example, a CloudFormation changeset execution role) also needs to have the

lambda:GetLayerVersion permission on the layer version.

Parameters:
  • id (string) – the ID of the grant in the construct tree.
  • grantee (LayerVersionUsageGrantee) – the identification of the grantee.
Return type:

ILayerVersion

Abstract:

Yes

node

Inherited from @aws-cdk/cdk.IConstruct

The construct node in the scope tree.

Type:@aws-cdk/cdk.ConstructNode (readonly)
dependencyRoots

Inherited from @aws-cdk/cdk.IDependable

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)

ImportedFunction

class @aws-cdk/aws-lambda.ImportedFunction(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.ImportedFunction;
const { ImportedFunction } = require('@aws-cdk/aws-lambda');
import { ImportedFunction } from '@aws-cdk/aws-lambda';
Extends:

FunctionBase

Parameters:
export() → @aws-cdk/aws-lambda.FunctionImportProps

Implements @aws-cdk/aws-lambda.FunctionBase.export()

Export this Function (without the role)

Return type:FunctionImportProps
canCreatePermissions

Implements @aws-cdk/aws-lambda.FunctionBase.canCreatePermissions()

Whether the addPermission() call adds any permissions

True for new Lambdas, false for imported Lambdas (they might live in different accounts).

Protected property

Type:boolean (readonly)
functionArn

Implements @aws-cdk/aws-lambda.FunctionBase.functionArn()

The ARN fo the function.

Type:string (readonly)
functionName

Implements @aws-cdk/aws-lambda.FunctionBase.functionName()

The name of the function.

Type:string (readonly)
grantPrincipal

Implements @aws-cdk/aws-lambda.FunctionBase.grantPrincipal()

The principal this Lambda Function is running as

Type:@aws-cdk/aws-iam.IPrincipal (readonly)
props
Type:FunctionImportProps (readonly)
role

Implements @aws-cdk/aws-lambda.FunctionBase.role()

The IAM role associated with this function.

Undefined if the function was imported without a role.

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
addEventSource(source)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Adds an event source to this function.

Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module.

The following example adds an SQS Queue as an event source:

import { SqsEventSource } from @aws-cdk/aws-lambda-event-sources’;

myFunction.addEventSource(new SqsEventSource(myQueue));

Parameters:source (IEventSource) – The event source to bind to this function
addPermission(id, permission)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Adds a permission to the Lambda resource policy.

Parameters:
  • id (string) – The id ƒor the permission construct
  • permission (Permission) –
addToRolePolicy(statement)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Allows this Lambda to be used as a destination for bucket notifications.

Use bucket.onEvent(lambda) to subscribe.

Parameters:
  • bucketArn (string) –
  • bucketId (string) –
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

asEventRuleTarget(ruleArn, ruleId) → @aws-cdk/aws-events.EventRuleTargetProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Returns a RuleTarget that can be used to trigger this Lambda as a

result from a CloudWatch event.

Parameters:
  • ruleArn (string) –
  • ruleId (string) –
Return type:

@aws-cdk/aws-events.EventRuleTargetProps

asStepFunctionsTaskResource(_callingTask) → @aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required for using this object as a Task resource

Parameters:_callingTask (@aws-cdk/aws-stepfunctions.Task) –
Return type:@aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps
grantInvoke(grantee) → @aws-cdk/aws-iam.Grant

Inherited from @aws-cdk/aws-lambda.FunctionBase

Grant the given identity permissions to invoke this Lambda

Parameters:grantee (@aws-cdk/aws-iam.IGrantable) –
Return type:@aws-cdk/aws-iam.Grant
logSubscriptionDestination(sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:sourceLogGroup (@aws-cdk/aws-logs.ILogGroup) –
Return type:@aws-cdk/aws-logs.LogSubscriptionDestination
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the given named metric for this Function

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

metricDuration([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How long execution of this Lambda takes

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricErrors([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How many invocations of this Lambda fail

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricInvocations([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is invoked

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricThrottles([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is throttled

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
connections

Inherited from @aws-cdk/aws-lambda.FunctionBase

Access the Connections object

Will fail if not a VPC-enabled Lambda Function

Type:@aws-cdk/aws-ec2.Connections (readonly)
id

Inherited from @aws-cdk/aws-lambda.FunctionBase

Logical ID of this Function.

Type:string (readonly)
isBoundToVpc

Inherited from @aws-cdk/aws-lambda.FunctionBase

Whether or not this Lambda function was bound to a VPC

If this is is false, trying to access the connections object will fail.

Type:boolean (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

InlineCode

class @aws-cdk/aws-lambda.InlineCode(code)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.InlineCode;
const { InlineCode } = require('@aws-cdk/aws-lambda');
import { InlineCode } from '@aws-cdk/aws-lambda';

Lambda code from an inline string (limited to 4KiB).

Extends:Code
Parameters:code (string) –
bind(construct)

Overrides @aws-cdk/aws-lambda.Code.bind()

Called when the lambda or layer is initialized to allow this object to

bind to the stack, add resources and have fun.

Parameters:construct (@aws-cdk/cdk.Construct) –
isInline

Implements @aws-cdk/aws-lambda.Code.isInline()

Determines whether this Code is inline code or not.

Type:boolean (readonly)
code
Type:string

LambdaRuntimeProps (interface)

class @aws-cdk/aws-lambda.LambdaRuntimeProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LambdaRuntimeProps;
// LambdaRuntimeProps is an interface
import { LambdaRuntimeProps } from '@aws-cdk/aws-lambda';
supportsInlineCode

Whether the ZipFile (aka inline code) property can be used with this runtime.

Type:boolean (optional) (readonly)
Default:false

LayerVersion

class @aws-cdk/aws-lambda.LayerVersion(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LayerVersion;
const { LayerVersion } = require('@aws-cdk/aws-lambda');
import { LayerVersion } from '@aws-cdk/aws-lambda';

Defines a new Lambda Layer version.

Extends:

LayerVersionBase

Parameters:
static import(scope, id, props) → @aws-cdk/aws-lambda.ILayerVersion

Imports a Layer that has been defined externally.

Parameters:
  • scope (@aws-cdk/cdk.Construct) – the parent Construct that will use the imported layer.
  • id (string) – the id of the imported layer in the construct tree.
  • props (LayerVersionImportProps) – the properties of the imported layer.
Return type:

ILayerVersion

layerVersionArn

Implements @aws-cdk/aws-lambda.LayerVersionBase.layerVersionArn()

The ARN of the Lambda Layer version that this Layer defines.

Type:string (readonly)
compatibleRuntimes

Implements @aws-cdk/aws-lambda.LayerVersionBase.compatibleRuntimes()

The runtimes compatible with this Layer.

Type:Runtime[] (optional) (readonly)
export() → @aws-cdk/aws-lambda.LayerVersionImportProps

Inherited from @aws-cdk/aws-lambda.LayerVersionBase

Exports this layer for use in another Stack. The resulting object can be passed to the LayerVersion.import

function to obtain an ILayerVersion in the user stack.

Return type:LayerVersionImportProps
grantUsage(id, grantee) → @aws-cdk/aws-lambda.ILayerVersion

Inherited from @aws-cdk/aws-lambda.LayerVersionBase

Grants usage of this layer to specific entities. Usage within the same account where the layer is defined is always

allowed and does not require calling this method. Note that the principal that creates the Lambda function using

the layer (for example, a CloudFormation changeset execution role) also needs to have the

lambda:GetLayerVersion permission on the layer version.

Parameters:
Return type:

ILayerVersion

prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

LayerVersionBase

class @aws-cdk/aws-lambda.LayerVersionBase(scope, id)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LayerVersionBase;
const { LayerVersionBase } = require('@aws-cdk/aws-lambda');
import { LayerVersionBase } from '@aws-cdk/aws-lambda';

A reference to a Lambda Layer version.

Extends:

@aws-cdk/cdk.Construct

Implements:

ILayerVersion

Abstract:

Yes

Parameters:
  • scope (@aws-cdk/cdk.Construct) – The scope in which to define this construct
  • id (string) – The scoped construct ID. Must be unique amongst siblings. If the ID includes a path separator (/), then it will be replaced by double dash .
export() → @aws-cdk/aws-lambda.LayerVersionImportProps

Implements @aws-cdk/aws-lambda.ILayerVersion.export()

Exports this layer for use in another Stack. The resulting object can be passed to the LayerVersion.import

function to obtain an ILayerVersion in the user stack.

Return type:LayerVersionImportProps
grantUsage(id, grantee) → @aws-cdk/aws-lambda.ILayerVersion

Implements @aws-cdk/aws-lambda.ILayerVersion.grantUsage()

Grants usage of this layer to specific entities. Usage within the same account where the layer is defined is always

allowed and does not require calling this method. Note that the principal that creates the Lambda function using

the layer (for example, a CloudFormation changeset execution role) also needs to have the

lambda:GetLayerVersion permission on the layer version.

Parameters:
Return type:

ILayerVersion

layerVersionArn

Implements @aws-cdk/aws-lambda.ILayerVersion.layerVersionArn()

The ARN of the Lambda Layer version that this Layer defines.

Type:string (readonly) (abstract)
compatibleRuntimes

Implements @aws-cdk/aws-lambda.ILayerVersion.compatibleRuntimes()

The runtimes compatible with this Layer.

Type:Runtime[] (optional) (readonly) (abstract)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

LayerVersionImportProps (interface)

class @aws-cdk/aws-lambda.LayerVersionImportProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LayerVersionImportProps;
// LayerVersionImportProps is an interface
import { LayerVersionImportProps } from '@aws-cdk/aws-lambda';

Properties necessary to import a LayerVersion.

layerVersionArn

The ARN of the LayerVersion.

Type:string (readonly)
compatibleRuntimes

The list of compatible runtimes with this Layer.

Type:Runtime[] (optional) (readonly)

LayerVersionProps (interface)

class @aws-cdk/aws-lambda.LayerVersionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LayerVersionProps;
// LayerVersionProps is an interface
import { LayerVersionProps } from '@aws-cdk/aws-lambda';
code

The content of this Layer. Using inline (per code.isInline) code is not permitted.

Type:Code (readonly)
compatibleRuntimes

The runtimes that this layer is compatible with.

Type:Runtime[] (optional) (readonly)
Default:All runtimes are supported
description

The description the this Lambda Layer.

Type:string (optional) (readonly)
license

The SPDX licence identifier or URL to the license file for this layer.

Type:string (optional) (readonly)
Default:no license information will be recorded.
name

The name of the layer.

Type:string (optional) (readonly)
Default:a name will be generated.

LayerVersionUsageGrantee (interface)

class @aws-cdk/aws-lambda.LayerVersionUsageGrantee

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LayerVersionUsageGrantee;
// LayerVersionUsageGrantee is an interface
import { LayerVersionUsageGrantee } from '@aws-cdk/aws-lambda';

Identification of an account (or organization) that is allowed to access a Lambda Layer Version.

accountId

The AWS Account id of the account that is authorized to use a Lambda Layer Version. The wild-card '*' can be

used to grant access to “any” account (or any account in an organization when organizationId is specified).

Type:string (readonly)
organizationId

The ID of the AWS Organization to hwich the grant is restricted.

Can only be specified if accountId is '*'

Type:string (optional) (readonly)

LogRetention

class @aws-cdk/aws-lambda.LogRetention(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LogRetention;
const { LogRetention } = require('@aws-cdk/aws-lambda');
import { LogRetention } from '@aws-cdk/aws-lambda';

Creates a custom resource to control the retention policy of a CloudWatch Logs

log group. The log group is created if it doesn’t already exist. The policy

is removed when retentionDays is undefined or equal to Infinity.

Extends:

@aws-cdk/cdk.Construct

Parameters:
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

LogRetentionProps (interface)

class @aws-cdk/aws-lambda.LogRetentionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.LogRetentionProps;
// LogRetentionProps is an interface
import { LogRetentionProps } from '@aws-cdk/aws-lambda';

Construction properties for a LogRetention.

logGroupName

The log group name.

Type:string (readonly)
retentionDays

The number of days log events are kept in CloudWatch Logs.

Type:@aws-cdk/aws-logs.RetentionDays (readonly)

Permission (interface)

class @aws-cdk/aws-lambda.Permission

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.Permission;
// Permission is an interface
import { Permission } from '@aws-cdk/aws-lambda';

Represents a permission statement that can be added to a Lambda’s resource policy

via the addToResourcePolicy method.

principal

The entity for which you are granting permission to invoke the Lambda

function. This entity can be any valid AWS service principal, such as

s3.amazonaws.com or sns.amazonaws.com, or, if you are granting

cross-account permission, an AWS account ID. For example, you might want

to allow a custom application in another AWS account to push events to

Lambda by invoking your function.

The principal can be either an AccountPrincipal or a ServicePrincipal.

Type:@aws-cdk/aws-iam.IPrincipal (readonly)
action

The Lambda actions that you want to allow in this statement. For example,

you can specify lambda:CreateFunction to specify a certain action, or use

a wildcard (lambda:*) to grant permission to all Lambda actions. For a

list of actions, see Actions and Condition Context Keys for AWS Lambda in

the IAM User Guide.

Type:string (optional) (readonly)
Default:‘lambda:InvokeFunction’
eventSourceToken

A unique token that must be supplied by the principal invoking the

function.

Type:string (optional) (readonly)
Default:The caller would not need to present a token.
sourceAccount

The AWS account ID (without hyphens) of the source owner. For example, if

you specify an S3 bucket in the SourceArn property, this value is the

bucket owner’s account ID. You can use this property to ensure that all

source principals are owned by a specific account.

Type:string (optional) (readonly)
sourceArn

The ARN of a resource that is invoking your function. When granting

Amazon Simple Storage Service (Amazon S3) permission to invoke your

function, specify this property with the bucket ARN as its value. This

ensures that events generated only from the specified bucket, not just

any bucket from any AWS account that creates a mapping to your function,

can invoke the function.

Type:string (optional) (readonly)

Runtime

class @aws-cdk/aws-lambda.Runtime(name[, family[, props]])

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.Runtime;
const { Runtime } = require('@aws-cdk/aws-lambda');
import { Runtime } from '@aws-cdk/aws-lambda';

Lambda function runtime environment.

If you need to use a runtime name that doesn’t exist as a static member, you

can instantiate a Runtime object, e.g: new Runtime(‘nodejs99.99’).

Parameters:
toString() → string
Return type:string
All

A list of all the know ``Runtime``s.

Type:Runtime[] (readonly) (static)
DotNetCore1
Type:Runtime (readonly) (static)
DotNetCore2
Type:Runtime (readonly) (static)
DotNetCore21
Type:Runtime (readonly) (static)
Go1x
Type:Runtime (readonly) (static)
Java8
Type:Runtime (readonly) (static)
NodeJS
Type:Runtime (readonly) (static)
NodeJS43
Type:Runtime (readonly) (static)
NodeJS610
Type:Runtime (readonly) (static)
NodeJS810
Type:Runtime (readonly) (static)
Provided
Type:Runtime (readonly) (static)
Python27
Type:Runtime (readonly) (static)
Python36
Type:Runtime (readonly) (static)
Python37
Type:Runtime (readonly) (static)
Ruby25
Type:Runtime (readonly) (static)
name

The name of this runtime, as expected by the Lambda resource.

Type:string (readonly)
supportsInlineCode

Whether the ZipFile (aka inline code) property can be used with this

runtime.

Type:boolean (readonly)
family

The runtime family.

Type:RuntimeFamily (optional) (readonly)

RuntimeFamily (enum)

class @aws-cdk/aws-lambda.RuntimeFamily

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.RuntimeFamily;
const { RuntimeFamily } = require('@aws-cdk/aws-lambda');
import { RuntimeFamily } from '@aws-cdk/aws-lambda';
NodeJS
Java
Python
DotNetCore
Go
Ruby
Other

S3Code

class @aws-cdk/aws-lambda.S3Code(bucket, key[, objectVersion])

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.S3Code;
const { S3Code } = require('@aws-cdk/aws-lambda');
import { S3Code } from '@aws-cdk/aws-lambda';

Lambda code from an S3 archive.

Extends:

Code

Parameters:
isInline

Implements @aws-cdk/aws-lambda.Code.isInline()

Determines whether this Code is inline code or not.

Type:boolean (readonly)
key
Type:string
objectVersion
Type:string (optional)
bind(_construct)

Inherited from @aws-cdk/aws-lambda.Code

Called when the lambda or layer is initialized to allow this object to

bind to the stack, add resources and have fun.

Parameters:_construct (@aws-cdk/cdk.Construct) –

SingletonFunction

class @aws-cdk/aws-lambda.SingletonFunction(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.SingletonFunction;
const { SingletonFunction } = require('@aws-cdk/aws-lambda');
import { SingletonFunction } from '@aws-cdk/aws-lambda';

A Lambda that will only ever be added to a stack once.

The lambda is identified using the value of ‘uuid’. Run ‘uuidgen’

for every SingletonLambda you create.

Extends:

FunctionBase

Parameters:
addPermission(name, permission)

Overrides @aws-cdk/aws-lambda.FunctionBase.addPermission()

Adds a permission to the Lambda resource policy.

Parameters:
export() → @aws-cdk/aws-lambda.FunctionImportProps

Implements @aws-cdk/aws-lambda.FunctionBase.export()

Export this Function (without the role)

Return type:FunctionImportProps
canCreatePermissions

Implements @aws-cdk/aws-lambda.FunctionBase.canCreatePermissions()

Whether the addPermission() call adds any permissions

True for new Lambdas, false for imported Lambdas (they might live in different accounts).

Protected property

Type:boolean (readonly)
functionArn

Implements @aws-cdk/aws-lambda.FunctionBase.functionArn()

The ARN fo the function.

Type:string (readonly)
functionName

Implements @aws-cdk/aws-lambda.FunctionBase.functionName()

The name of the function.

Type:string (readonly)
grantPrincipal

Implements @aws-cdk/aws-lambda.FunctionBase.grantPrincipal()

The principal this Lambda Function is running as

Type:@aws-cdk/aws-iam.IPrincipal (readonly)
role

Implements @aws-cdk/aws-lambda.FunctionBase.role()

The IAM role associated with this function.

Undefined if the function was imported without a role.

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
addEventSource(source)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Adds an event source to this function.

Event sources are implemented in the @aws-cdk/aws-lambda-event-sources module.

The following example adds an SQS Queue as an event source:

import { SqsEventSource } from @aws-cdk/aws-lambda-event-sources’;

myFunction.addEventSource(new SqsEventSource(myQueue));

Parameters:source (IEventSource) – The event source to bind to this function
addToRolePolicy(statement)

Inherited from @aws-cdk/aws-lambda.FunctionBase

Parameters:statement (@aws-cdk/aws-iam.PolicyStatement) –
asBucketNotificationDestination(bucketArn, bucketId) → @aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Allows this Lambda to be used as a destination for bucket notifications.

Use bucket.onEvent(lambda) to subscribe.

Parameters:
  • bucketArn (string) –
  • bucketId (string) –
Return type:

@aws-cdk/aws-s3-notifications.BucketNotificationDestinationProps

asEventRuleTarget(ruleArn, ruleId) → @aws-cdk/aws-events.EventRuleTargetProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Returns a RuleTarget that can be used to trigger this Lambda as a

result from a CloudWatch event.

Parameters:
  • ruleArn (string) –
  • ruleId (string) –
Return type:

@aws-cdk/aws-events.EventRuleTargetProps

asStepFunctionsTaskResource(_callingTask) → @aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required for using this object as a Task resource

Parameters:_callingTask (@aws-cdk/aws-stepfunctions.Task) –
Return type:@aws-cdk/aws-stepfunctions.StepFunctionsTaskResourceProps
grantInvoke(grantee) → @aws-cdk/aws-iam.Grant

Inherited from @aws-cdk/aws-lambda.FunctionBase

Grant the given identity permissions to invoke this Lambda

Parameters:grantee (@aws-cdk/aws-iam.IGrantable) –
Return type:@aws-cdk/aws-iam.Grant
logSubscriptionDestination(sourceLogGroup) → @aws-cdk/aws-logs.LogSubscriptionDestination

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the properties required to send subscription events to this destination.

If necessary, the destination can use the properties of the SubscriptionFilter

object itself to configure its permissions to allow the subscription to write

to it.

The destination may reconfigure its own permissions in response to this

function call.

Parameters:sourceLogGroup (@aws-cdk/aws-logs.ILogGroup) –
Return type:@aws-cdk/aws-logs.LogSubscriptionDestination
metric(metricName[, props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

Return the given named metric for this Function

Parameters:
Return type:

@aws-cdk/aws-cloudwatch.Metric

metricDuration([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How long execution of this Lambda takes

Average over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricErrors([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How many invocations of this Lambda fail

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricInvocations([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is invoked

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
metricThrottles([props]) → @aws-cdk/aws-cloudwatch.Metric

Inherited from @aws-cdk/aws-lambda.FunctionBase

How often this Lambda is throttled

Sum over 5 minutes

Parameters:props (@aws-cdk/aws-cloudwatch.MetricCustomization (optional)) –
Return type:@aws-cdk/aws-cloudwatch.Metric
connections

Inherited from @aws-cdk/aws-lambda.FunctionBase

Access the Connections object

Will fail if not a VPC-enabled Lambda Function

Type:@aws-cdk/aws-ec2.Connections (readonly)
id

Inherited from @aws-cdk/aws-lambda.FunctionBase

Logical ID of this Function.

Type:string (readonly)
isBoundToVpc

Inherited from @aws-cdk/aws-lambda.FunctionBase

Whether or not this Lambda function was bound to a VPC

If this is is false, trying to access the connections object will fail.

Type:boolean (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

SingletonFunctionProps (interface)

class @aws-cdk/aws-lambda.SingletonFunctionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.SingletonFunctionProps;
// SingletonFunctionProps is an interface
import { SingletonFunctionProps } from '@aws-cdk/aws-lambda';

Properties for a newly created singleton Lambda

Extends:FunctionProps
uuid

A unique identifier to identify this lambda

The identifier should be unique across all custom resource providers.

We recommend generating a UUID per provider.

Type:string (readonly)
lambdaPurpose

A descriptive name for the purpose of this Lambda.

If the Lambda does not have a physical name, this string will be

reflected its generated name. The combination of lambdaPurpose

and uuid must be unique.

Type:string (optional) (readonly)
Default:SingletonLambda
code

Inherited from @aws-cdk/aws-lambda.FunctionProps

The source code of your Lambda function. You can point to a file in an

Amazon Simple Storage Service (Amazon S3) bucket or specify your source

code as inline text.

Type:Code (readonly)
handler

Inherited from @aws-cdk/aws-lambda.FunctionProps

The name of the function (within your source code) that Lambda calls to

start running your code. For more information, see the Handler property

in the AWS Lambda Developer Guide.

NOTE: If you specify your source code as inline text by specifying the

ZipFile property within the Code property, specify index.function_name as

the handler.

Type:string (readonly)
runtime

Inherited from @aws-cdk/aws-lambda.FunctionProps

The runtime environment for the Lambda function that you are uploading.

For valid values, see the Runtime property in the AWS Lambda Developer

Guide.

Type:Runtime (readonly)
allowAllOutbound

Inherited from @aws-cdk/aws-lambda.FunctionProps

Whether to allow the Lambda to send all network traffic

If set to false, you must individually add traffic rules to allow the

Lambda to connect to network targets.

Type:boolean (optional) (readonly)
Default:true
deadLetterQueue

Inherited from @aws-cdk/aws-lambda.FunctionProps

The SQS queue to use if DLQ is enabled.

Type:@aws-cdk/aws-sqs.IQueue (optional) (readonly)
Default:SQS queue with 14 day retention period if deadLetterQueueEnabled is true
deadLetterQueueEnabled

Inherited from @aws-cdk/aws-lambda.FunctionProps

Enabled DLQ. If deadLetterQueue is undefined,

an SQS queue with default options will be defined for your Function.

Type:boolean (optional) (readonly)
Default:false unless deadLetterQueue is set, which implies DLQ is enabled
description

Inherited from @aws-cdk/aws-lambda.FunctionProps

A description of the function.

Type:string (optional) (readonly)
environment

Inherited from @aws-cdk/aws-lambda.FunctionProps

Key-value pairs that Lambda caches and makes available for your Lambda

functions. Use environment variables to apply configuration changes, such

as test and production environment configurations, without changing your

Lambda function source code.

Type:string => any (optional) (readonly)
events

Inherited from @aws-cdk/aws-lambda.FunctionProps

Event sources for this function.

You can also add event sources using addEventSource.

Type:IEventSource[] (optional) (readonly)
functionName

Inherited from @aws-cdk/aws-lambda.FunctionProps

A name for the function. If you don’t specify a name, AWS CloudFormation

generates a unique physical ID and uses that ID for the function’s name.

For more information, see Name Type.

Type:string (optional) (readonly)
initialPolicy

Inherited from @aws-cdk/aws-lambda.FunctionProps

Initial policy statements to add to the created Lambda Role.

You can call addToRolePolicy to the created lambda to add statements post creation.

Type:@aws-cdk/aws-iam.PolicyStatement[] (optional) (readonly)
layers

Inherited from @aws-cdk/aws-lambda.FunctionProps

A list of layers to add to the function’s execution environment. You can configure your Lambda function to pull in

additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies

that can be used by mulitple functions.

Type:ILayerVersion[] (optional) (readonly)
Default:no layers
logRetentionDays

Inherited from @aws-cdk/aws-lambda.FunctionProps

The number of days log events are kept in CloudWatch Logs. When updating

this property, unsetting it doesn’t remove the log retention policy. To

remove the retention policy, set the value to Infinity.

Type:@aws-cdk/aws-logs.RetentionDays (optional) (readonly)
Default:logs never expire
memorySize

Inherited from @aws-cdk/aws-lambda.FunctionProps

The amount of memory, in MB, that is allocated to your Lambda function.

Lambda uses this value to proportionally allocate the amount of CPU

power. For more information, see Resource Model in the AWS Lambda

Developer Guide.

Type:number (optional) (readonly)
Default:The default value is 128 MB
reservedConcurrentExecutions

Inherited from @aws-cdk/aws-lambda.FunctionProps

The maximum of concurrent executions you want to reserve for the function.

Type:number (optional) (readonly)
Default:no specific limit - account limit
role

Inherited from @aws-cdk/aws-lambda.FunctionProps

Lambda execution role.

This is the role that will be assumed by the function upon execution.

It controls the permissions that the function will have. The Role must

be assumable by the ‘lambda.amazonaws.com’ service principal.

Type:@aws-cdk/aws-iam.IRole (optional) (readonly)
Default:a unique role will be generated for this lambda function.

Both supplied and generated roles can always be changed by calling addToRolePolicy.

@aws-cdk/aws-lambda.securityGroup

Inherited from @aws-cdk/aws-lambda.FunctionProps

What security group to associate with the Lambda’s network interfaces.

Only used if ‘vpc’ is supplied.

Type:@aws-cdk/aws-ec2.ISecurityGroup (optional) (readonly)
Default:If the function is placed within a VPC and a security group is

not specified, a dedicated security group will be created for this function.

@aws-cdk/aws-lambda.timeout

Inherited from @aws-cdk/aws-lambda.FunctionProps

The function execution time (in seconds) after which Lambda terminates

the function. Because the execution time affects cost, set this value

based on the function’s expected execution time.

Type:number (optional) (readonly)
Default:3 seconds.
@aws-cdk/aws-lambda.tracing

Inherited from @aws-cdk/aws-lambda.FunctionProps

Enable AWS X-Ray Tracing for Lambda Function.

Type:Tracing (optional) (readonly)
Default:undefined X-Ray tracing disabled
@aws-cdk/aws-lambda.vpc

Inherited from @aws-cdk/aws-lambda.FunctionProps

VPC network to place Lambda network interfaces

Specify this if the Lambda function needs to access resources in a VPC.

Type:@aws-cdk/aws-ec2.IVpcNetwork (optional) (readonly)
@aws-cdk/aws-lambda.vpcSubnets

Inherited from @aws-cdk/aws-lambda.FunctionProps

Where to place the network interfaces within the VPC.

Only used if ‘vpc’ is supplied. Note: internet access for Lambdas

requires a NAT gateway, so picking Public subnets is not allowed.

Type:@aws-cdk/aws-ec2.SubnetSelection (optional) (readonly)
Default:All private subnets

SingletonLayerVersion

class @aws-cdk/aws-lambda.SingletonLayerVersion(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.SingletonLayerVersion;
const { SingletonLayerVersion } = require('@aws-cdk/aws-lambda');
import { SingletonLayerVersion } from '@aws-cdk/aws-lambda';

A Singleton Lambda Layer Version. The construct gurantees exactly one LayerVersion will be created in a given Stack

for the provided uuid. It is recommended to use uuidgen to create a new uuid each time a new singleton

layer is created.

Extends:

@aws-cdk/cdk.Construct

Implements:

ILayerVersion

Parameters:
export() → @aws-cdk/aws-lambda.LayerVersionImportProps

Implements @aws-cdk/aws-lambda.ILayerVersion.export()

Exports this layer for use in another Stack. The resulting object can be passed to the LayerVersion.import

function to obtain an ILayerVersion in the user stack.

Return type:LayerVersionImportProps
grantUsage(id, grantee) → @aws-cdk/aws-lambda.ILayerVersion

Implements @aws-cdk/aws-lambda.ILayerVersion.grantUsage()

Grants usage of this layer to specific entities. Usage within the same account where the layer is defined is always

allowed and does not require calling this method. Note that the principal that creates the Lambda function using

the layer (for example, a CloudFormation changeset execution role) also needs to have the

lambda:GetLayerVersion permission on the layer version.

Parameters:
Return type:

ILayerVersion

layerVersionArn

Implements @aws-cdk/aws-lambda.ILayerVersion.layerVersionArn()

The ARN of the Lambda Layer version that this Layer defines.

Type:string (readonly)
compatibleRuntimes

Implements @aws-cdk/aws-lambda.ILayerVersion.compatibleRuntimes()

The runtimes compatible with this Layer.

Type:Runtime[] (optional) (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

SingletonLayerVersionProps (interface)

class @aws-cdk/aws-lambda.SingletonLayerVersionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.SingletonLayerVersionProps;
// SingletonLayerVersionProps is an interface
import { SingletonLayerVersionProps } from '@aws-cdk/aws-lambda';

Properties of a Singleton Lambda Layer Version.

Extends:LayerVersionProps
uuid

A unique identifier to identify this lambda layer version.

The identifier should be unique across all layer providers.

We recommend generating a UUID per provider.

Type:string (readonly)
code

Inherited from @aws-cdk/aws-lambda.LayerVersionProps

The content of this Layer. Using inline (per code.isInline) code is not permitted.

Type:Code (readonly)
compatibleRuntimes

Inherited from @aws-cdk/aws-lambda.LayerVersionProps

The runtimes that this layer is compatible with.

Type:Runtime[] (optional) (readonly)
Default:All runtimes are supported
description

Inherited from @aws-cdk/aws-lambda.LayerVersionProps

The description the this Lambda Layer.

Type:string (optional) (readonly)
license

Inherited from @aws-cdk/aws-lambda.LayerVersionProps

The SPDX licence identifier or URL to the license file for this layer.

Type:string (optional) (readonly)
Default:no license information will be recorded.
name

Inherited from @aws-cdk/aws-lambda.LayerVersionProps

The name of the layer.

Type:string (optional) (readonly)
Default:a name will be generated.

StartingPosition (enum)

class @aws-cdk/aws-lambda.StartingPosition

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.StartingPosition;
const { StartingPosition } = require('@aws-cdk/aws-lambda');
import { StartingPosition } from '@aws-cdk/aws-lambda';

The position in the DynamoDB or Kinesis stream where AWS Lambda should start

reading.

TrimHorizon

Start reading at the last untrimmed record in the shard in the system,

which is the oldest data record in the shard.

Latest

Start reading just after the most recent record in the shard, so that you

always read the most recent data in the shard

Tracing (enum)

class @aws-cdk/aws-lambda.Tracing

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.Tracing;
const { Tracing } = require('@aws-cdk/aws-lambda');
import { Tracing } from '@aws-cdk/aws-lambda';

X-Ray Tracing Modes (https://docs.aws.amazon.com/lambda/latest/dg/API_TracingConfig.html)

Active

Lambda will respect any tracing header it receives from an upstream service.

If no tracing header is received, Lambda will call X-Ray for a tracing decision.

PassThrough

Lambda will only trace the request from an upstream service

if it contains a tracing header with “sampled=1”

Disabled

Lambda will not trace any request.

Version

class @aws-cdk/aws-lambda.Version(scope, id, props)

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.Version;
const { Version } = require('@aws-cdk/aws-lambda');
import { Version } from '@aws-cdk/aws-lambda';

A single newly-deployed version of a Lambda function.

This object exists to–at deploy time–query the “then-current” version of

the Lambda function that it refers to. This Version object can then be

used in Alias to refer to a particular deployment of a Lambda.

This means that for every new update you deploy to your Lambda (using the

CDK and Aliases), you must always create a new Version object. In

particular, it must have a different name, so that a new resource is

created.

If you want to ensure that you’re associating the right version with

the right deployment, specify the codeSha256 property while

creating the `Version.

Extends:

@aws-cdk/cdk.Construct

Parameters:
functionVersion

The most recently deployed version of this function.

Type:string (readonly)
lambda

Lambda object this version is associated with

Type:IFunction (readonly)
prepare()

Inherited from @aws-cdk/cdk.Construct

Perform final modifications before synthesis

This method can be implemented by derived constructs in order to perform

final changes before synthesis. prepare() will be called after child

constructs have been prepared.

This is an advanced framework feature. Only use this if you

understand the implications.

Protected method

toString() → string

Inherited from @aws-cdk/cdk.Construct

Returns a string representation of this construct.

Return type:string
validate() → string[]

Inherited from @aws-cdk/cdk.Construct

Validate the current construct.

This method can be implemented by derived constructs in order to perform

validation logic. It is called on all constructs before synthesis.

Protected method

Returns:An array of validation error messages, or an empty array if there the construct is valid.
Return type:string[]
dependencyRoots

Inherited from @aws-cdk/cdk.Construct

The set of constructs that form the root of this dependable

All resources under all returned constructs are included in the ordering

dependency.

Type:@aws-cdk/cdk.IConstruct[] (readonly)
node

Inherited from @aws-cdk/cdk.Construct

Construct node.

Type:@aws-cdk/cdk.ConstructNode (readonly)

VersionProps (interface)

class @aws-cdk/aws-lambda.VersionProps

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.VersionProps;
// VersionProps is an interface
import { VersionProps } from '@aws-cdk/aws-lambda';

Properties for a new Lambda version

lambda

Function to get the value of

Type:IFunction (readonly)
codeSha256

SHA256 of the version of the Lambda source code

Specify to validate that you’re deploying the right version.

Type:string (optional) (readonly)
Default:No validation is performed
description

Description of the version

Type:string (optional) (readonly)
Default:Description of the Lambda

VersionWeight (interface)

class @aws-cdk/aws-lambda.VersionWeight

Language-specific names:

using Amazon.CDK.AWS.Lambda;
import software.amazon.awscdk.services.lambda.VersionWeight;
// VersionWeight is an interface
import { VersionWeight } from '@aws-cdk/aws-lambda';

A version/weight pair for routing traffic to Lambda functions

version

The version to route traffic to

Type:Version (readonly)
weight

How much weight to assign to this version (0..1)

Type:number (readonly)