(core): expose buildSsh options via DockerRunOptions to allow Lambda builds to use SSH
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
https://github.com/aws/aws-cdk/issues/12062 added a `build_ssh` constructor parameter to `ecr_assets.DockerImageAsset`, allowing for the `-ssh` flag to be passed to Docker builds, allowing the Docker Engine to forward SSH agent connections. This is useful for the reasons detailed in the original issue.
However, I have private assets I want to use both in my Docker images, and in my Lambda code.
I think the right place to add this is `aws_cdk.aws_lambda_python_alpha.BundlingOptions`, but we'd want this for all the languages that can pull dependencies, and it appears `aws_cdk.DockerRunOptions` is the appropriate ancestor to add this to.
### Use Case
This is useful if you have private assets stored somewhere which are required in the build (for example private git repositories referenced by cargo).
### Proposed Solution
I'd see this being a `buildSsh` flag in `aws_cdk.DockerRunOptions`, analogous to the `ecr_assets.DockerImageAsset` flag. So a Python Lambda build with SSH assets might look like:
```
aws_lambda_python_alpha.PythonFunction(
scope=self,
id="FunctionName",
runtime=aws_lambda.Runtime.PYTHON_3_11,
entry="lambdas/src/function_name",
bundling=aws_lambda_python_alpha.BundlingOptions(
build_ssh='default',
),
)
```
### Other Information
_No response_
### Acknowledgements
- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### AWS CDK Library version (aws-cdk-lib)
2.240.0
### AWS CDK CLI version
2.1120.0 (build acefbf8)
### Environment details (OS name and version, etc.)
Linux Mint 22.3
Contributor guide
Research direction
Start with aws_cdk.DockerRunOptions and the existing ecr_assets.DockerImageAsset build_ssh option, then trace how BundlingOptions for Lambda languages consume Docker settings. Done means exposing an equivalent buildSsh option consistently so Lambda bundling can forward SSH agent connections for private build assets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, typescript
- Domain
- build-system, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100