SageMaker Training Job missing TrainingImageConfig property for private Docker registry
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 71
Description
### Describe the feature
Description:
The CDK's [SageMakerCreateTrainingJob](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.SageMakerCreateTrainingJob.html#algorithmspecification) construct doesn't support the `TrainingImageConfig` property which is required when using training images from private Docker repositories.
### Use Case
Current Behavior:
When attempting to create a SageMaker training job using a private Docker image, the following configuration is required:
```
"AlgorithmSpecification": {
"TrainingImage": "${image_uri}",
"TrainingInputMode": "File",
"TrainingImageConfig": {
"TrainingRepositoryAccessMode": "Vpc"
}
}
```
However, the CDK only allows:
```
algorithmSpecification: {
trainingImage: tasks.DockerImage.fromRegistry(imageURL),
trainingInputMode: tasks.InputMode.FILE
}
```
This results in the error:
```
TrainingImageConfig with TrainingRepositoryAccessMode set to VPC must be provided when using a training image from a private Docker registry. Please provide TrainingImageConfig and TrainingRepositoryAccessMode set to VPC when using a training image from a private Docker registry.
```
### Proposed Solution
use sfn.CustomState to define the complete JSON structure manually:
```
new sfn.CustomState(this, 'TrainingJob', {
stateJson: {
Type: 'Task',
Resource: 'arn:aws:states:::sagemaker:createTrainingJob.sync',
Parameters: {
AlgorithmSpecification: {
TrainingImage: repository.repositoryUri,
TrainingInputMode: "File",
TrainingImageConfig: {
TrainingRepositoryAccessMode: "Vpc"
}
}
}
}
});
```
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
-
### Environment details (OS name and version, etc.)
-
Contributor guide
Research direction
Start at the SageMakerCreateTrainingJob construct's algorithmSpecification entry point and compare the generated AlgorithmSpecification with the private-registry example in the issue. The work is done when callers can provide TrainingImageConfig with TrainingRepositoryAccessMode set to Vpc and the resulting training-job definition includes it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, typescript
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100