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
| Decorator | Signature | Effect |
|---|---|---|
memory_size | memory_size(arg) | Overrides memory size. |
timeout | timeout(arg) | Records seconds; CDK receives Duration.seconds(arg). |
environment | environment(*eargs, **kwargs) | Selects environment registry entries; selected maps merge over common_environment. |
runtime | runtime(arg) | Selects a runtime alias. |
role | role(arg) | Selects one execution-role alias. |
description | description(arg) | Sets Lambda description. |
name | name(arg) | Sets Lambda function name. |
layer | layer(*largs, **kwargs) | Appends registered layers to common layers. |
security_group | security_group(*sgargs) | Appends registered groups to common groups. |
vpc | vpc(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.