Lambda¶
This document contains information about the Lambda service supported in Handel. This Handel service provisions an Lambda function. You can reference this function in other services as an event consumer, which will invoke the function when events occur.
Service Limitations¶
The following Lambda features are not currently supported in this service:
- Encrypting environment variables with KMS keys
Parameters¶
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
type | string | Yes | This must always be lambda for this service type. | |
path_to_code | string | Yes | The location of your code to upload to Lambda. This can be a directory (which will be zipped up) or a single file (such as a deployable Java WAR file or pre-existing zip file) | |
handler | string | Yes | The handler function in your code that is the entry-point to the Lambda. | |
runtime | string | Yes | The Lambda runtime that will execute your code | |
description | string | No | Handel-created function | The configuration description of your function |
memory | number | No | 128 | The amount of memory to allocate for your function |
timeout | number | No | 3 | The timeout in seconds for your function. Max 300 |
vpc | boolean | No | false | If true, the lambda will be deployed inside your VPC. Inside your VPC, it will be able to communicate with resources like RDS databases and ElastiCache clusters. |
environment_variables | EnvironmentVariables | No | Any environment variables you want to inject into your code. | |
tags | Resource Tags | No | Any tags you want to apply to your Lambda |
EnvironmentVariables¶
The EnvironmentVariables element is defined by the following schema:
environment_variables:
<YOUR_ENV_NAME>: <your_env_value>
<YOUR_ENV_NAME> is a string that will be the name of the injected environment variable. <your_env_value> is its value. You may specify an arbitrary number of environment variables in this section.
Example Handel File¶
version: 1
name: my-lambda
environments:
dev:
webapp:
type: lambda
path_to_code: .
handler: index.handler
runtime: nodejs6.10
environment_variables:
MY_ENV: myEnvValue
tags:
mytag: mytagvalue
Running a scheduled Lambda¶
To run a scheduled Lambda, you can use this service in conjunction with the CloudWatch Events service. See the Scheduled Lambda on the CloudWatch Events service for details on how to do this.
Depending on this service¶
The Lambda service outputs the following environment variables:
Environment Variable | Description |
---|---|
<SERVICE_NAME>_FUNCTION_NAME | The name of the created Lambda function |
<SERVICE_NAME>_FUCNTION_ARN | The ARN of the created Lambda function |
See Environment Variable Names for information about how the service name is included in the environment variable name.
Events produced by this service¶
The Lambda service does not currently produce events for other Handel services to consume.
Events consumed by this service¶
The Lambda service can consume events from the following service types:
- Alexa Skill Kit
- CloudWatch Events
- DynamoDB
- IoT
- S3
- SNS