Fugue.AWS.Lambda.Function

This is the preferred interface for making Lambda Functions with Fugue. If you want to manage a Lambda Function with Fugue, the new function is the right place to start.

Module Members

external

(Function)

Create a reference to an externally managed Function.

Example usage:

topic: Lambda.Function.external("arn:aws:lambda:us-east-1:123456789012:example-function")

Type Signature

 fun (String) -> Function
Argument: arn

The ARN of an existing function.

Type: String

Returns:

A reference to the specified function.

Type: Function

new

(Function)

new Lambda Function (Constructor)

Call this constructor to create a new Fugue.Core.AWS.Lambda.Function value.

Example usage:

import Fugue.AWS as AWS
import Fugue.AWS.IAM as IAM
import Fugue.AWS.Lambda as Lambda

lambda-role: IAM.Role.new {
  roleName: 'lambda-role',
  assumeRolePolicyDocument: IAM.Policy.AssumeRole.lambda,
}

fn: Lambda.Function.new {
  functionName: 'lambda1',
  runtime: Lambda.Nodejs4_3,
  role: lambda-role,
  handler: 'exports.myHandler',
  code: Lambda.Code.fromZipFile {
    path: "myHandler.zip",
  },
  region: AWS.Us-east-2,
}

Type Signature

 fun { functionName: String,
       runtime: Runtime,
       handler: String,
       description: Optional<String>,
       timeout: Optional<Int>,
       memorySize: Optional<Int>,
       publish: Optional<Bool>,
       vpcConfig: Optional<VpcConfig>,
       region: Optional<Region>,
       code: Code,
       role: Role,
       permissions: Optional<List<Permission>>,
       tags: Optional<List<Tag>>,
       resourceId: Optional<String> } -> Function
Argument: functionName

The name you want to assign to the function you are uploading. The function names appear in the console and are returned in the ListFunctions API. Function names are used to specify functions to other AWS Lambda APIs, such as Invoke.

Type: String

Argument: runtime

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

Type: Runtime

Argument: handler

The function within your code that Lambda calls to begin execution. For Node.js, it is the module-name.export value in your function. For Java, it can be package.class-name::handler or package.class-name. Mutable.

Type: String

Argument: description

A short, user-defined function description. Lambda does not use this value. Assign a meaningful description as you see fit. Mutable.

Type: Optional<String>

Argument: timeout

The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds. Mutable.

Type: Optional<Int>

Argument: memorySize

The amount of memory, in MB, your Lambda function is given. Lambda uses this memory size to infer the amount of CPU and memory allocated to your function. Your function use case determines your CPU and memory requirements. For example, a database operation might need less memory compared to an image processing function. The default value is 128 MB. The value must be a multiple of 64 MB. Mutable.

Type: Optional<Int>

Argument: publish

This boolean parameter can be used to request AWS Lambda to create the Lambda function and publish a version as an atomic operation. Mutable.

Type: Optional<Bool>

Argument: vpcConfig

If your Lambda function accesses resources in a VPC, you provide this parameter identifying the list of EC2.SecurityGroups and EC2.Subnet. These must belong to the same EC2.VPC. You must provide at least one security group and one subnet. Note that the provided role must provide CreateNetworkInterface and DeleteNetworkInterface permissions lambda.amazonaws.com. See Fugue.AWS.Lambda.VpcConfig for functions to construct VpcConfig values. Mutable.

Type: Optional<VpcConfig>

Argument: region

The region in which to run the Lambda function.

Type: Optional<Region>

Argument: code

The code for the Lambda function. See Fugue.AWS.Lambda.Code for functions to construct Code values. Mutable.

Type: Code

Argument: role

An IAM.Role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources. Mutable.

Type: Role

Argument: permissions

A list of permissions for the Lambda function. See Fugue.AWS.Lambda.Permissions for functions to construct permission values. Mutable.

Type: Optional<List<Permission>>

Argument: tags

A list of tags for the Lambda function. Mutable.

Type: Optional<List<Tag>>

Argument: resourceId

Resource ID of the resource to import with Fugue Import. This field is only honored on fugue run. The resource ID is the ARN. Mutable. Example: arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords

Type: Optional<String>

Returns:

A Fugue.Core.AWS.Lambda.Function value.

Type: Function

region

(Function)

Retrieve the region for a Function value

Example usage:

fn: Lambda.Function.new {
  functionName: "example",
  runtime: Lambda.Nodejs4_3,
  role: lambda-role,
  handler: "exports.MyHandler",
  code: Lambda.CodeZipFile(Bytes.readFile("code.zip")),
  region: AWS.Us-west-2,
}

region: Lambda.Function.region(fn) # => AWS.Us-west-2

Type Signature

 fun (Function) -> Region
Argument: function

The Function from which to get the region.

Type: Function

Returns:

The region containing the Function.

Type: Region