Skip to content

Commit

Permalink
fix(stepfunctions-tasks): sageMakerCreateTrainingJob does not correct…
Browse files Browse the repository at this point in the history
…ly 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:/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https:/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*
  • Loading branch information
xazhao authored Sep 3, 2024
1 parent ef38e06 commit 6d43146
Show file tree
Hide file tree
Showing 9 changed files with 710 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,251 @@
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"TrainTaskAnotherSagemakerRoleBD8363A2": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "sagemaker.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"Policies": [
{
"PolicyDocument": {
"Statement": [
{
"Action": [
"cloudwatch:PutMetricData",
"ecr:GetAuthorizationToken",
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:DescribeLogStreams",
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": "*"
}
],
"Version": "2012-10-17"
},
"PolicyName": "CreateTrainingJob"
}
]
}
},
"TrainTaskAnotherSagemakerRoleDefaultPolicy67E5C282": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:Abort*",
"s3:DeleteObject*",
"s3:PutObject",
"s3:PutObjectLegalHold",
"s3:PutObjectRetention",
"s3:PutObjectTagging",
"s3:PutObjectVersionTagging"
],
"Effect": "Allow",
"Resource": [
{
"Fn::GetAtt": [
"TrainingData3FDB6D34",
"Arn"
]
},
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"TrainingData3FDB6D34",
"Arn"
]
},
"/result/*"
]
]
}
]
},
{
"Action": [
"kms:Decrypt",
"kms:Encrypt",
"kms:GenerateDataKey*",
"kms:ReEncrypt*"
],
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"EncryptionKey1B843E66",
"Arn"
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "TrainTaskAnotherSagemakerRoleDefaultPolicy67E5C282",
"Roles": [
{
"Ref": "TrainTaskAnotherSagemakerRoleBD8363A2"
}
]
}
},
"StateMachineAnotherRoleB3F4936A": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "states.amazonaws.com"
}
}
],
"Version": "2012-10-17"
}
}
},
"StateMachineAnotherRoleDefaultPolicy5D4FD497": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"sagemaker:CreateTrainingJob",
"sagemaker:DescribeTrainingJob",
"sagemaker:StopTrainingJob"
],
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":sagemaker:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":training-job/mytrainingjob*"
]
]
}
},
{
"Action": "sagemaker:ListTags",
"Effect": "Allow",
"Resource": "*"
},
{
"Action": "iam:PassRole",
"Condition": {
"StringEquals": {
"iam:PassedToService": "sagemaker.amazonaws.com"
}
},
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"TrainTaskAnotherSagemakerRoleBD8363A2",
"Arn"
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "StateMachineAnotherRoleDefaultPolicy5D4FD497",
"Roles": [
{
"Ref": "StateMachineAnotherRoleB3F4936A"
}
]
}
},
"StateMachineAnother9B75AA58": {
"Type": "AWS::StepFunctions::StateMachine",
"Properties": {
"DefinitionString": {
"Fn::Join": [
"",
[
"{\"StartAt\":\"TrainTaskAnother\",\"States\":{\"TrainTaskAnother\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:",
{
"Ref": "AWS::Partition"
},
":states:::sagemaker:createTrainingJob\",\"Parameters\":{\"TrainingJobName\":\"mytrainingjob\",\"RoleArn\":\"",
{
"Fn::GetAtt": [
"TrainTaskAnotherSagemakerRoleBD8363A2",
"Arn"
]
},
"\",\"AlgorithmSpecification\":{\"TrainingInputMode\":\"FastFile\",\"AlgorithmName\":\"BlazingText\"},\"OutputDataConfig\":{\"S3OutputPath\":\"https://s3.",
{
"Ref": "AWS::Region"
},
".",
{
"Ref": "AWS::URLSuffix"
},
"/",
{
"Ref": "TrainingData3FDB6D34"
},
"/result/\"},\"ResourceConfig\":{\"InstanceCount\":1,\"InstanceType\":\"ml.m4.xlarge\",\"VolumeSizeInGB\":10},\"StoppingCondition\":{\"MaxRuntimeInSeconds\":3600}}}}}"
]
]
},
"RoleArn": {
"Fn::GetAtt": [
"StateMachineAnotherRoleB3F4936A",
"Arn"
]
}
},
"DependsOn": [
"StateMachineAnotherRoleDefaultPolicy5D4FD497",
"StateMachineAnotherRoleB3F4936A"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
},
"Outputs": {
"stateMachineArn": {
"Value": {
"Ref": "StateMachine2E01A3A5"
}
},
"stateMachineArn2": {
"Value": {
"Ref": "StateMachineAnother9B75AA58"
}
}
},
"Parameters": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6d43146

Please sign in to comment.