Fugue.AWS.Lambda.VpcConfig

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

Table of Contents

Module Members

new

(Function)

new Lambda VpcConfig (Constructor)

Call this constructor to create a new Fugue.Core.AWS.Lambda.VpcConfig value. Providing a VpcConfig allows a function to access resources within a vpc.

Example usage:

import Fugue.AWS as AWS
import Fugue.AWS.EC2 as EC2
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,
  managedPolicies: [
    IAM.ManagedPolicy.external("arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"),
  ],
}

vpc1: EC2.Vpc.new {
  region: AWS.Us-east-2,
  cidrBlock: "10.0.0.0/16",
}

snA: EC2.Subnet.new {
  vpc: vpc1,
  cidrBlock: "10.0.1.0/24",
  availabilityZone: AWS.A,
}

sg1: EC2.SecurityGroup.new {
  vpc: vpc1,
  description: "Lambda source",
}

vpcConfig: Lambda.VpcConfig.new {
  subnets: [snA],
  securityGroups: [sg1],
}

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

Type Signature

 fun { subnets: List<Subnet>,
       securityGroups: List<SecurityGroup> } -> VpcConfig
Argument: subnets

A list of one or more EC2.Subnets in your VPC.

Type: List<Subnet>

Argument: securityGroups

A list of one or more EC2.SecurityGroups in your VPC.

Type: List<SecurityGroup>

Returns:

A Fugue.Core.AWS.Lambda.VpcConfig value.

Type: VpcConfig

region

(Function)

Retrieve the region for a VpcConfig value

Example usage:

sn1: EC2.Subnet.new {
  vpc:  ECS.Vpc.new {
    region: AWS.Us-west-2,
    cidrBlock: "10.0.0.0/16",
  },
  cidrBlock: "10.0.1.0/24",
}

sg1: EC2.SecurityGroup.new {
  vpc: sn1.(EC2.Subnet).vpc,
  description: "example"
}

vpcConfig: Lambda.VpcConfig.new {
  subnets: [sn1],
  securityGroups: [sg1]
}
region1: Lambda.VpcConfig.region(vpcConfig) # => AWS.Us-west-2

Type Signature

 fun (VpcConfig) -> Region
Argument: vpcConfig

The VpcConfig from which to get the region.

Type: VpcConfig

Returns:

The region containing the VpcConfig.

Type: Region