Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stepfunctions-tasks): add enableNetworkIsolation property to SageMakerCreateTrainingJobProps #16792

Merged
merged 11 commits into from
Oct 18, 2021
4 changes: 4 additions & 0 deletions packages/@aws-cdk/aws-stepfunctions-tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,10 @@ disable this behavior.

Step Functions supports [AWS SageMaker](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html) through the service integration pattern.

If your training job or model uses resources from AWS Marketplace,
[network isolation is required](https://docs.aws.amazon.com/sagemaker/latest/dg/mkt-algo-model-internet-free.html).
To do so, set the `enableNetworkIsolation` property to `true` for `SageMakerCreateModel` or `SageMakerCreateTrainingJob`.

### Create Training Job

You can call the [`CreateTrainingJob`](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTrainingJob.html) API from a `Task` state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ export interface SageMakerCreateTrainingJobProps extends sfn.TaskStateBaseProps
*/
readonly algorithmSpecification: AlgorithmSpecification;

/**
* Isolates the training container. No inbound or outbound network calls can be made to or from the training container.
*
* @default false
*/
readonly enableNetworkIsolation?: boolean;

/**
* Algorithm-specific parameters that influence the quality of the model. Set hyperparameters before you start the learning process.
* For a list of hyperparameters provided by Amazon SageMaker
Expand Down Expand Up @@ -217,6 +224,7 @@ export class SageMakerCreateTrainingJob extends sfn.TaskStateBase implements iam
private renderParameters(): { [key: string]: any } {
return {
TrainingJobName: this.props.trainingJobName,
EnableNetworkIsolation: this.props.enableNetworkIsolation,
RoleArn: this._role!.roleArn,
...this.renderAlgorithmSpecification(this.algorithmSpecification),
...this.renderInputDataConfig(this.inputDataConfig),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ test('create complex training job', () => {
},
],
},
enableNetworkIsolation: true,
hyperparameters: {
lr: '0.1',
},
Expand Down Expand Up @@ -221,6 +222,7 @@ test('create complex training job', () => {
{ Name: 'mymetric', Regex: 'regex_pattern' },
],
},
EnableNetworkIsolation: true,
HyperParameters: {
lr: '0.1',
},
Expand Down