Skip to content

Lambda

Bases: DuploResourceV2

Manage Duplo Lambdas

Duplo Lambdas are serverless functions that run in response to events.

Commands

apply

Apply a service.

Parameters:

--file, -f, --cli-input
A file to read the input from
FileType('r') action: YamlAction
--wait, -w
Wait for the operation to complete

create

Create a new tenant.

CLI Usage

duploctl lambda create -f 'lambda.yaml'
Contents of the lambda.yaml file
FunctionName: duploctl-img
PackageType: Image
Description: duploctl test lambda
Timeout: 10
MemorySize: 128
Tags: {}
Environment:
  Variables: {}
Code:
  ImageUri: public.ecr.aws/lambda/python:3.12
Layers: []
ImageConfig: {}

Returns:

Name Type Description
message dict

A success message.

Parameters:

--file, -f, --cli-input
A file to read the input from
FileType('r') action: YamlAction

delete

Delete a lambda.

CLI Usage
duploctl lambda delete <name>

Returns:

Name Type Description
message dict

A success message.

Parameters:

name positional
The resource name
str

find

Find a Lambda function by name.

CLI Usage
duploctl lambda find <name>

Args: name: The name of the lambda to find. Returns: The lambda object. Raises: DuploError: If the lambda could not be found.

Parameters:

name positional
The resource name
str

list

List Lambdas.

List all of the tenants in the current tenant.

CLI Usage
duploctl lambda list

Returns:

Name Type Description
list list

A list of all lambdas in the current subscription.

update_env

Update the environment variables of a lambda. If lambda has no environment variables set, use -strat replace to set new values.

Basic CLI Use
duploctl lambda update_env <lambda-name> --setvar env-key1 env-val1 --setvar env-key2 env-val2 --setvar env-key3 env-val3 -strat merge

Parameters:

name positional
The resource name
str
--setvar, -V <key> <value> repeatable
a key and value to set as an environment variable
str nargs: 2
--strategy, -strat
The merge strategy to use. Valid options are "merge" or "replace". Default is merge.
str default: merge
merge replace
--deletevar, -D repeatable
a key to delete from the environment variables
str

update_image

Update the image of a lambda.

CLI Usage
duploctl lambda update_image <name> <image>

Returns:

Name Type Description
message dict

The updated lambda object

Parameters:

name positional
The resource name
str
image positional
The image to use
str

update_s3

Update the s3 bucket and key of a lambda.

CLI Usage
duploctl lambda update_s3 <name> <bucket> <key>

Parameters:

name positional
The resource name
str
bucket positional
The s3 bucket to use
str
key positional
The s3 key to use
str

Methods

name_from_body