lambda: override cmd in DockerImageFunctionProps
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Add a `command` prop to `DockerImageFunctionProps` to override the value specified in https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AssetImageCodeProps.html#cmd .
### Use Case
I have a Docker image with multiple Lambda handlers. I would like to create the `DockerImageCode` once so it will build the image just once and then when creating each `DockerImageFunction`, I can specify the function to execute with `command`.
### Proposed Solution
The synthesized CloudFormation for the AWS::Lambda::Function will include the value from the `command` prop as `Command` in `ImageConfig`. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-imageconfig.html#cfn-lambda-function-imageconfig-command
### Other Information
It is possible to override `CMD` from the dockerfile using https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AssetImageCodeProps.html#cmd , but that will result in multiple Docker images.
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.143.0
### Environment details (OS name and version, etc.)
MacOS 14.4.1 intel
Contributor guide
Research direction
Start from the DockerImageFunctionProps and existing AssetImageCodeProps cmd handling, then trace how the function's ImageConfig is synthesized. Verify that the requested command reaches AWS::Lambda::Function ImageConfig as Command without requiring separate image builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100