Skip to content
v2.273.0

IVersion Interface ​

Properties ​

architectureArchitecturearchitectureArchitecturearchitectureArchitectureArchitectureArchitectureArchitectureArchitecturerequired#
The system architectures compatible with this lambda function.
connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#
The network connections associated with this resource.
edgeArnstringedge_arnstredgeArnStringEdgeArnstringEdgeArn*stringrequired#
The ARN of the version for Lambda@Edge.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

functionArnstringfunction_arnstrfunctionArnStringFunctionArnstringFunctionArn*stringrequired#
The ARN of the function.
functionNamestringfunction_namestrfunctionNameStringFunctionNamestringFunctionName*stringrequired#
The name of the function.
functionRefFunctionReferencefunction_refFunctionReferencefunctionRefFunctionReferenceFunctionRefFunctionReferenceFunctionRefFunctionReferencerequired#
A reference to a Function resource.
grantPrincipalIPrincipalgrant_principalIPrincipalgrantPrincipalIPrincipalGrantPrincipalIPrincipalGrantPrincipalIPrincipalrequired#
The principal to grant permissions to.
isBoundToVpcbooleanis_bound_to_vpcboolisBoundToVpcBooleanIsBoundToVpcboolIsBoundToVpc*boolrequired#
Whether or not this Lambda function was bound to a VPC.

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

lambdaIFunctionlambdaIFunctionlambdaIFunctionLambdaIFunctionLambdaIFunctionrequired#
The underlying AWS Lambda function.
latestVersionIVersionlatest_versionIVersionlatestVersionIVersionLatestVersionIVersionLatestVersionIVersionrequired#
The `$LATEST` version of this function.
notes

Note that this is reference to a non-specific AWS Lambda version, which means the function this version refers to can return different results in different invocations.

To obtain a reference to an explicit version which references the current function configuration, use lambdaFunction.currentVersion instead.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
permissionsNodeNodepermissions_nodeNodepermissionsNodeNodePermissionsNodeNodePermissionsNodeNoderequired#
The construct node where permissions are attached.
resourceArnsForGrantInvokestring[]resource_arns_for_grant_invoketyping.List[str]resourceArnsForGrantInvokeList<String>ResourceArnsForGrantInvokestring[]ResourceArnsForGrantInvoke*[]*stringrequired#
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().

This property is for cdk modules to consume only. You should not need to use this property. Instead, use grantInvoke() directly.

roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole#
The IAM role associated with this function.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
tenancyConfigTenancyConfigtenancy_configTenancyConfigtenancyConfigTenancyConfigTenancyConfigTenancyConfigTenancyConfigTenancyConfig#
The tenancy configuration for this function.
versionstringversionstrversionStringVersionstringVersion*stringrequired#
The most recently deployed version of this function.
versionRefVersionReferenceversion_refVersionReferenceversionRefVersionReferenceVersionRefVersionReferenceVersionRefVersionReferencerequired#
A reference to a Version resource.

Methods ​

addAlias(aliasName: string, options?: AliasOptions): Aliasdef add_alias(self, alias_name: str, options: typing.Optional[AliasOptions] = None) -> Aliaspublic Alias addAlias(String aliasName, AliasOptions options)public Alias AddAlias(string aliasName, AliasOptions? options = null)func AddAlias(AliasName *string, Options AliasOptions) Aliasdeprecated#
Calling `addAlias` on a `Version` object will cause the Alias to be replaced on every function update. Call `function.addAlias()` or `new Alias()` instead.
2 parameters

Parameters

  • aliasNamealias_namealiasNamealiasNameAliasName — The name of the alias.
  • optionsoptionsoptionsoptionsOptions — Alias options.
addEventSource(source: IEventSource): voiddef add_event_source(self, source: IEventSource) -> Nonepublic void addEventSource(IEventSource source)public void AddEventSource(IEventSource source)func AddEventSource(Source IEventSource)#
Adds an event source to this function.
notes

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

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

import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
myFunction.addEventSource(new SqsEventSource(myQueue));
addEventSourceMapping(id: string, options: EventSourceMappingOptions): EventSourceMappingdef add_event_source_mapping(self, id: str, options: EventSourceMappingOptions) -> EventSourceMappingpublic EventSourceMapping addEventSourceMapping(String id, EventSourceMappingOptions options)public EventSourceMapping AddEventSourceMapping(string id, EventSourceMappingOptions options)func AddEventSourceMapping(Id *string, Options EventSourceMappingOptions) EventSourceMapping#
Adds an event source that maps to this AWS Lambda function.
2 parameters

Parameters

  • ididididId — construct ID.
  • optionsoptionsoptionsoptionsOptions — mapping options.
addFunctionUrl(options?: FunctionUrlOptions): FunctionUrldef add_function_url(self, options: typing.Optional[FunctionUrlOptions] = None) -> FunctionUrlpublic FunctionUrl addFunctionUrl(FunctionUrlOptions options)public FunctionUrl AddFunctionUrl(FunctionUrlOptions? options = null)func AddFunctionUrl(Options FunctionUrlOptions) FunctionUrl#
Adds a url to this lambda function.
addPermission(id: string, permission: Permission): voiddef add_permission(self, id: str, permission: Permission) -> Nonepublic void addPermission(String id, Permission permission)public void AddPermission(string id, Permission permission)func AddPermission(Id *string, Permission Permission)#
Adds a permission to the Lambda resource policy.
2 parameters

Parameters

  • ididididId — The id for the permission construct.
  • permissionpermissionpermissionpermissionPermission — The permission to grant to this Lambda function.
addToRolePolicy(statement: PolicyStatement): voiddef add_to_role_policy(self, statement: PolicyStatement) -> Nonepublic void addToRolePolicy(PolicyStatement statement)public void AddToRolePolicy(PolicyStatement statement)func AddToRolePolicy(Statement PolicyStatement)#
Adds a statement to the IAM role assumed by the instance.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

configureAsyncInvoke(options: EventInvokeConfigOptions): voiddef configure_async_invoke(self, options: EventInvokeConfigOptions) -> Nonepublic void configureAsyncInvoke(EventInvokeConfigOptions options)public void ConfigureAsyncInvoke(EventInvokeConfigOptions options)func ConfigureAsyncInvoke(Options EventInvokeConfigOptions)#
Configures options for asynchronous invocation.
grantInvoke(identity: IGrantable): Grantdef grant_invoke(self, identity: IGrantable) -> Grantpublic Grant grantInvoke(IGrantable identity)public Grant GrantInvoke(IGrantable identity)func GrantInvoke(Identity IGrantable) Grant#
Grant the given identity permissions to invoke this Lambda.
grantInvokeCompositePrincipal(compositePrincipal: CompositePrincipal): Grant[]def grant_invoke_composite_principal(self, composite_principal: CompositePrincipal) -> typing.List[Grant]public List<Grant> grantInvokeCompositePrincipal(CompositePrincipal compositePrincipal)public Grant[] GrantInvokeCompositePrincipal(CompositePrincipal compositePrincipal)func GrantInvokeCompositePrincipal(CompositePrincipal CompositePrincipal) *[]Grant#
Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.
grantInvokeLatestVersion(identity: IGrantable): Grantdef grant_invoke_latest_version(self, identity: IGrantable) -> Grantpublic Grant grantInvokeLatestVersion(IGrantable identity)public Grant GrantInvokeLatestVersion(IGrantable identity)func GrantInvokeLatestVersion(Identity IGrantable) Grant#
Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.
grantInvokeUrl(identity: IGrantable): Grantdef grant_invoke_url(self, identity: IGrantable) -> Grantpublic Grant grantInvokeUrl(IGrantable identity)public Grant GrantInvokeUrl(IGrantable identity)func GrantInvokeUrl(Identity IGrantable) Grant#
Grant the given identity permissions to invoke this Lambda Function URL.
grantInvokeVersion(identity: IGrantable, version: IVersion): Grantdef grant_invoke_version(self, identity: IGrantable, version: IVersion) -> Grantpublic Grant grantInvokeVersion(IGrantable identity, IVersion version)public Grant GrantInvokeVersion(IGrantable identity, IVersion version)func GrantInvokeVersion(Identity IGrantable, Version IVersion) Grant#
Grant the given identity permissions to invoke the given version of this Lambda.
metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#
Return the given named metric for this Lambda Return the given named metric for this Function.
metricDuration(props?: MetricOptions): Metricdef metric_duration(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricDuration(MetricOptions props)public Metric MetricDuration(MetricOptions? props = null)func MetricDuration(Props MetricOptions) Metric#
Metric for the Duration of this Lambda How long execution of this Lambda takes.

Average over 5 minutes

metricErrors(props?: MetricOptions): Metricdef metric_errors(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricErrors(MetricOptions props)public Metric MetricErrors(MetricOptions? props = null)func MetricErrors(Props MetricOptions) Metric#
How many invocations of this Lambda fail.

Sum over 5 minutes

metricInvocations(props?: MetricOptions): Metricdef metric_invocations(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocations(MetricOptions props)public Metric MetricInvocations(MetricOptions? props = null)func MetricInvocations(Props MetricOptions) Metric#
Metric for the number of invocations of this Lambda How often this Lambda is invoked.

Sum over 5 minutes

metricThrottles(props?: MetricOptions): Metricdef metric_throttles(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricThrottles(MetricOptions props)public Metric MetricThrottles(MetricOptions? props = null)func MetricThrottles(Props MetricOptions) Metric#
Metric for the number of throttled invocations of this Lambda How often this Lambda is throttled.

Sum over 5 minutes

with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining