Skip to content

Commit 6d43146

Browse files
authored
fix(stepfunctions-tasks): sageMakerCreateTrainingJob does not correctly support empty inputDataConfig (#31210)
### Issue # (if applicable) Closes #31132. ### Reason for this change `inputDataConfig` is not a required property in the API: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html#sagemaker-CreateTrainingJob-request-InputDataConfig However in `SageMakerCreateTrainingJob`, it's marked as required. We should make it align with the API. ### Description of changes Make the property optional. ### Description of how you validated changes unit test and integration test ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ef38e06 commit 6d43146

File tree

9 files changed

+710
-12
lines changed

9 files changed

+710
-12
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.assets.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.template.json

+238
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,251 @@
332332
],
333333
"UpdateReplacePolicy": "Delete",
334334
"DeletionPolicy": "Delete"
335+
},
336+
"TrainTaskAnotherSagemakerRoleBD8363A2": {
337+
"Type": "AWS::IAM::Role",
338+
"Properties": {
339+
"AssumeRolePolicyDocument": {
340+
"Statement": [
341+
{
342+
"Action": "sts:AssumeRole",
343+
"Effect": "Allow",
344+
"Principal": {
345+
"Service": "sagemaker.amazonaws.com"
346+
}
347+
}
348+
],
349+
"Version": "2012-10-17"
350+
},
351+
"Policies": [
352+
{
353+
"PolicyDocument": {
354+
"Statement": [
355+
{
356+
"Action": [
357+
"cloudwatch:PutMetricData",
358+
"ecr:GetAuthorizationToken",
359+
"logs:CreateLogGroup",
360+
"logs:CreateLogStream",
361+
"logs:DescribeLogStreams",
362+
"logs:PutLogEvents"
363+
],
364+
"Effect": "Allow",
365+
"Resource": "*"
366+
}
367+
],
368+
"Version": "2012-10-17"
369+
},
370+
"PolicyName": "CreateTrainingJob"
371+
}
372+
]
373+
}
374+
},
375+
"TrainTaskAnotherSagemakerRoleDefaultPolicy67E5C282": {
376+
"Type": "AWS::IAM::Policy",
377+
"Properties": {
378+
"PolicyDocument": {
379+
"Statement": [
380+
{
381+
"Action": [
382+
"s3:Abort*",
383+
"s3:DeleteObject*",
384+
"s3:PutObject",
385+
"s3:PutObjectLegalHold",
386+
"s3:PutObjectRetention",
387+
"s3:PutObjectTagging",
388+
"s3:PutObjectVersionTagging"
389+
],
390+
"Effect": "Allow",
391+
"Resource": [
392+
{
393+
"Fn::GetAtt": [
394+
"TrainingData3FDB6D34",
395+
"Arn"
396+
]
397+
},
398+
{
399+
"Fn::Join": [
400+
"",
401+
[
402+
{
403+
"Fn::GetAtt": [
404+
"TrainingData3FDB6D34",
405+
"Arn"
406+
]
407+
},
408+
"/result/*"
409+
]
410+
]
411+
}
412+
]
413+
},
414+
{
415+
"Action": [
416+
"kms:Decrypt",
417+
"kms:Encrypt",
418+
"kms:GenerateDataKey*",
419+
"kms:ReEncrypt*"
420+
],
421+
"Effect": "Allow",
422+
"Resource": {
423+
"Fn::GetAtt": [
424+
"EncryptionKey1B843E66",
425+
"Arn"
426+
]
427+
}
428+
}
429+
],
430+
"Version": "2012-10-17"
431+
},
432+
"PolicyName": "TrainTaskAnotherSagemakerRoleDefaultPolicy67E5C282",
433+
"Roles": [
434+
{
435+
"Ref": "TrainTaskAnotherSagemakerRoleBD8363A2"
436+
}
437+
]
438+
}
439+
},
440+
"StateMachineAnotherRoleB3F4936A": {
441+
"Type": "AWS::IAM::Role",
442+
"Properties": {
443+
"AssumeRolePolicyDocument": {
444+
"Statement": [
445+
{
446+
"Action": "sts:AssumeRole",
447+
"Effect": "Allow",
448+
"Principal": {
449+
"Service": "states.amazonaws.com"
450+
}
451+
}
452+
],
453+
"Version": "2012-10-17"
454+
}
455+
}
456+
},
457+
"StateMachineAnotherRoleDefaultPolicy5D4FD497": {
458+
"Type": "AWS::IAM::Policy",
459+
"Properties": {
460+
"PolicyDocument": {
461+
"Statement": [
462+
{
463+
"Action": [
464+
"sagemaker:CreateTrainingJob",
465+
"sagemaker:DescribeTrainingJob",
466+
"sagemaker:StopTrainingJob"
467+
],
468+
"Effect": "Allow",
469+
"Resource": {
470+
"Fn::Join": [
471+
"",
472+
[
473+
"arn:",
474+
{
475+
"Ref": "AWS::Partition"
476+
},
477+
":sagemaker:",
478+
{
479+
"Ref": "AWS::Region"
480+
},
481+
":",
482+
{
483+
"Ref": "AWS::AccountId"
484+
},
485+
":training-job/mytrainingjob*"
486+
]
487+
]
488+
}
489+
},
490+
{
491+
"Action": "sagemaker:ListTags",
492+
"Effect": "Allow",
493+
"Resource": "*"
494+
},
495+
{
496+
"Action": "iam:PassRole",
497+
"Condition": {
498+
"StringEquals": {
499+
"iam:PassedToService": "sagemaker.amazonaws.com"
500+
}
501+
},
502+
"Effect": "Allow",
503+
"Resource": {
504+
"Fn::GetAtt": [
505+
"TrainTaskAnotherSagemakerRoleBD8363A2",
506+
"Arn"
507+
]
508+
}
509+
}
510+
],
511+
"Version": "2012-10-17"
512+
},
513+
"PolicyName": "StateMachineAnotherRoleDefaultPolicy5D4FD497",
514+
"Roles": [
515+
{
516+
"Ref": "StateMachineAnotherRoleB3F4936A"
517+
}
518+
]
519+
}
520+
},
521+
"StateMachineAnother9B75AA58": {
522+
"Type": "AWS::StepFunctions::StateMachine",
523+
"Properties": {
524+
"DefinitionString": {
525+
"Fn::Join": [
526+
"",
527+
[
528+
"{\"StartAt\":\"TrainTaskAnother\",\"States\":{\"TrainTaskAnother\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:",
529+
{
530+
"Ref": "AWS::Partition"
531+
},
532+
":states:::sagemaker:createTrainingJob\",\"Parameters\":{\"TrainingJobName\":\"mytrainingjob\",\"RoleArn\":\"",
533+
{
534+
"Fn::GetAtt": [
535+
"TrainTaskAnotherSagemakerRoleBD8363A2",
536+
"Arn"
537+
]
538+
},
539+
"\",\"AlgorithmSpecification\":{\"TrainingInputMode\":\"FastFile\",\"AlgorithmName\":\"BlazingText\"},\"OutputDataConfig\":{\"S3OutputPath\":\"https://s3.",
540+
{
541+
"Ref": "AWS::Region"
542+
},
543+
".",
544+
{
545+
"Ref": "AWS::URLSuffix"
546+
},
547+
"/",
548+
{
549+
"Ref": "TrainingData3FDB6D34"
550+
},
551+
"/result/\"},\"ResourceConfig\":{\"InstanceCount\":1,\"InstanceType\":\"ml.m4.xlarge\",\"VolumeSizeInGB\":10},\"StoppingCondition\":{\"MaxRuntimeInSeconds\":3600}}}}}"
552+
]
553+
]
554+
},
555+
"RoleArn": {
556+
"Fn::GetAtt": [
557+
"StateMachineAnotherRoleB3F4936A",
558+
"Arn"
559+
]
560+
}
561+
},
562+
"DependsOn": [
563+
"StateMachineAnotherRoleDefaultPolicy5D4FD497",
564+
"StateMachineAnotherRoleB3F4936A"
565+
],
566+
"UpdateReplacePolicy": "Delete",
567+
"DeletionPolicy": "Delete"
335568
}
336569
},
337570
"Outputs": {
338571
"stateMachineArn": {
339572
"Value": {
340573
"Ref": "StateMachine2E01A3A5"
341574
}
575+
},
576+
"stateMachineArn2": {
577+
"Value": {
578+
"Ref": "StateMachineAnother9B75AA58"
579+
}
342580
}
343581
},
344582
"Parameters": {

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/manifest.json

+39-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)