Skip to content

Commit

Permalink
feat(stepfunctions-tasks): EMR createCluster command support OnDemand…
Browse files Browse the repository at this point in the history
…Specification (#27791)

This PR supports OnDemandSpecification in instance fleets for EMR createCluster.

Closes #27761.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
go-to-k committed Dec 21, 2023
1 parent 4ab5bb2 commit 73a5e74
Show file tree
Hide file tree
Showing 13 changed files with 1,266 additions and 15 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.

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

@@ -0,0 +1,275 @@
{
"Resources": {
"EmrCreateClusterServiceRole5251910D": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "elasticmapreduce.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AmazonEMRServicePolicy_v2"
]
]
}
]
}
},
"EmrCreateClusterServiceRoleDefaultPolicyA8B4FA32": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "iam:PassRole",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"EmrCreateClusterInstanceRoleC80466F5",
"Arn"
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "EmrCreateClusterServiceRoleDefaultPolicyA8B4FA32",
"Roles": [
{
"Ref": "EmrCreateClusterServiceRole5251910D"
}
]
}
},
"EmrCreateClusterInstanceRoleC80466F5": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
}
}
],
"Version": "2012-10-17"
}
}
},
"EmrCreateClusterInstanceProfileC1729180": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"InstanceProfileName": {
"Ref": "EmrCreateClusterInstanceRoleC80466F5"
},
"Roles": [
{
"Ref": "EmrCreateClusterInstanceRoleC80466F5"
}
]
}
},
"SMRole49C19C48": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "states.amazonaws.com"
}
}
],
"Version": "2012-10-17"
}
}
},
"SMRoleDefaultPolicy34CA15C7": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"elasticmapreduce:AddTags",
"elasticmapreduce:DescribeCluster",
"elasticmapreduce:RunJobFlow",
"elasticmapreduce:TerminateJobFlows"
],
"Effect": "Allow",
"Resource": "*"
},
{
"Action": "iam:PassRole",
"Effect": "Allow",
"Resource": [
{
"Fn::GetAtt": [
"EmrCreateClusterInstanceRoleC80466F5",
"Arn"
]
},
{
"Fn::GetAtt": [
"EmrCreateClusterServiceRole5251910D",
"Arn"
]
}
]
},
{
"Action": "elasticmapreduce:AddTags",
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":elasticmapreduce:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":cluster/*"
]
]
}
},
{
"Action": [
"events:DescribeRule",
"events:PutRule",
"events:PutTargets"
],
"Effect": "Allow",
"Resource": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":events:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":rule/StepFunctionsGetEventForEMRRunJobFlowRule"
]
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "SMRoleDefaultPolicy34CA15C7",
"Roles": [
{
"Ref": "SMRole49C19C48"
}
]
}
},
"SM934E715A": {
"Type": "AWS::StepFunctions::StateMachine",
"Properties": {
"DefinitionString": {
"Fn::Join": [
"",
[
"{\"StartAt\":\"EmrCreateCluster\",\"States\":{\"EmrCreateCluster\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:",
{
"Ref": "AWS::Partition"
},
":states:::elasticmapreduce:createCluster.sync\",\"Parameters\":{\"Instances\":{\"InstanceFleets\":[{\"InstanceFleetType\":\"MASTER\",\"InstanceTypeConfigs\":[{\"InstanceType\":\"m5.xlarge\",\"WeightedCapacity\":1}],\"LaunchSpecifications\":{\"OnDemandSpecification\":{\"AllocationStrategy\":\"lowest-price\"}},\"Name\":\"Master\",\"TargetOnDemandCapacity\":1}],\"KeepJobFlowAliveWhenNoSteps\":true},\"JobFlowRole\":\"",
{
"Ref": "EmrCreateClusterInstanceRoleC80466F5"
},
"\",\"Name\":\"Cluster\",\"ServiceRole\":\"",
{
"Ref": "EmrCreateClusterServiceRole5251910D"
},
"\",\"ReleaseLabel\":\"emr-5.36.1\",\"Tags\":[{\"Key\":\"Key\",\"Value\":\"Value\"},{\"Key\":\"for-use-with-amazon-emr-managed-policies\",\"Value\":\"true\"}],\"VisibleToAllUsers\":true}}}}"
]
]
},
"RoleArn": {
"Fn::GetAtt": [
"SMRole49C19C48",
"Arn"
]
}
},
"DependsOn": [
"SMRoleDefaultPolicy34CA15C7",
"SMRole49C19C48"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

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.

0 comments on commit 73a5e74

Please sign in to comment.