aws / aws/chalice

Lambda Specific Configuration does not work with CDK

Open
#1,998 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

I am using Chalice with CDK to create a REST API and a scheduled lambda function (for a batch job).

I want to specify the configuration for the scheduled lambda function.

```py
@app.schedule(Cron(0, 16, "L", "*", "?", "*"))
def foo(event, context):
print("hello world")
```

In the CDK file, the following configuration is used.

```py
class ChaliceApp(cdk.Stack):
def __init__(self, scope, id, **kwargs):
super().__init__(scope, id, **kwargs)
self.dynamodb_table = self._create_ddb_table()
self.chalice = Chalice(
self,
"ChaliceApp",
source_dir=RUNTIME_SOURCE_DIR,
stage_config={
"environment_variables": {
"APP_TABLE_NAME": self.dynamodb_table.table_name
},
"lambda_functions": {
"foo": {
"lambda_timeout": 600,
"lambda_memory_size": 256,
"environment_variables": {"HELLO": "world"},
}
},
},
)
self.dynamodb_table.grant_read_write_data(self.chalice.get_role("DefaultRole"))
```

However, after deploying the application with `cdk deploy`, the scheduled lambda function is created with the default timeout (60 sec) and memory size (128 MB).

I think the [Lambda Specific Configuration](https://aws.github.io/chalice/topics/configfile.html#lambda-specific-configuration) does not work with CDK.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.