Skip to main content

Configuration decorators

These CDK-free decorators record options for the published lambda-api-decorators==0.3.2 package. They return the original callable and are interpreted by lambda-api-decorators-cdk==0.4.4.

memory_size​

timeout​

environment​

layer​

runtime​

security_group​

vpc​

role​

description​

name​

from lambda_api_decorators import (
GET, description, environment, layer, memory_size, name, role,
runtime, security_group, timeout, vpc,
)

@GET("/configured")
@memory_size(1024)
@timeout(15)
@environment("stage")
@layer("shared")
@runtime("python3.12")
@security_group("api")
@vpc("private")
@role("api-role")
@description("Configured endpoint")
@name("configured-handler")
def configured(event, context):
return {"statusCode": 200, "body": "ok"}

Public signatures​

DecoratorSignatureEffect
memory_sizememory_size(arg)Overrides memory size.
timeouttimeout(arg)Records seconds; CDK receives Duration.seconds(arg).
environmentenvironment(*eargs, **kwargs)Selects environment registry entries; selected maps merge over common_environment.
runtimeruntime(arg)Selects a runtime alias.
rolerole(arg)Selects one execution-role alias.
descriptiondescription(arg)Sets Lambda description.
namename(arg)Sets Lambda function name.
layerlayer(*largs, **kwargs)Appends registered layers to common layers.
security_groupsecurity_group(*sgargs)Appends registered groups to common groups.
vpcvpc(arg)Selects a registered VPC and its subnet selection together.

The decorators do not accept CDK objects as a replacement for registry keys. Missing keys fail during CDK resolution with a KeyError naming the registry and key. The supported built-in runtime aliases are python3.10 through python3.14.