aws-amplify / aws-amplify/amplify-cli
Add the option to set a Lambda function's memory size and timeout from the CLI
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### Is this related to a new or existing Amplify category?
function
### Is this related to another service?
_No response_
### Describe the feature you'd like to request
Currently, the only way to increase/decrease the memory size allocated for a Lambda function is by directly editing the function's `cloudformation-template.json` file as described by [this page](https://docs.amplify.aws/guides/functions/configuring-lambda/q/platform/js/) on the Amplify website. This applies for the timeout for the Lambda function as well.
Seeing as how we can already update a Lambda function's environment variables/secret keys using the Amplify CLI, it would be very convenient to be able to update a Lambda function's memory size allocated/timeout form the CLI as well.
### Describe the solution you'd like
This feature should be able to be used like the following
```
amplify update function
? Select the Lambda function you want to update (Use arrow keys)
> my-lambda-function
...
...
? Which setting do you want to update? (Use arrow keys)
Resource access permissions
Scheduled recurring invocation
Lambda layers configuration
Environment variables configuration
Secret values configuration
> Runtime configuration
...
? What runtime configuration property would you like to configure?
> Update memory size
Update timeout
...
Enter the new memory size for my-lambda-function (current: 128): 256
```
Similarly for the timeout:
```
amplify update function
? Select the Lambda function you want to update (Use arrow keys)
> my-lambda-function
...
...
? Which setting do you want to update? (Use arrow keys)
Resource access permissions
Scheduled recurring invocation
Lambda layers configuration
Environment variables configuration
Secret values configuration
> Runtime configuration
...
? What runtime configuration property would you like to configure?
Update memory size
> Update timeout
...
Enter the new timeout for my-lambda-function in seconds (current: 15 seconds): 60
```
### Describe alternatives you've considered
The current solution as described at [this page](https://docs.amplify.aws/guides/functions/configuring-lambda/q/platform/js/) can be automated via some hand-rolled command line tool that would update the Lambda function's `cloudformation-template.json` based on what you enter. While this may be viable, it would be nicer to have it as an official feature within the Amplify CLI.
### Additional context
_No response_
### Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change
Contributor guide
Research direction
Start at the `amplify update function` CLI flow described in the issue and trace how runtime configuration settings are presented and persisted. Define the prompts for memory size and timeout, including current values and validation, then verify that the generated Lambda configuration reflects the selected values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- backend, cli, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100