Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "AWSTemplateFormatVersion": "2010-09-09",
- "Description": "EMR Cluster for sqoop job",
- "Parameters": {
- "EMRClusterName": {
- "Description": "Name of the cluster",
- "Type": "String",
- "Default": "emrcluster"
- },
- "KeyName": {
- "Description": "Must be an existing Keyname",
- "Type": "String",
- "Default": "p-3"
- },
- "MasterInstacneType": {
- "Description": "Instance type to be used for the master instance.",
- "Type": "String",
- "Default": "m1.medium"
- },
- "CoreInstanceType": {
- "Description": "Instance type to be used for core instances.",
- "Type": "String",
- "Default": "m1.medium"
- },
- "NumberOfCoreInstances": {
- "Description": "Must be a valid number",
- "Type": "Number",
- "Default": 1
- },
- "SubnetID": {
- "Description": "Must be Valid public subnet ID",
- "Default": "subnet-2ee08274",
- "Type": "String"
- },
- "LogUri": {
- "Description": "Must be a valid S3 URL",
- "Default": "s3://aws-logs-552968783313-us-east-1/elasticmapreduce/",
- "Type": "String"
- },
- "ReleaseLabel": {
- "Description": "Must be a valid EMR release version",
- "Default": "emr-5.12.1",
- "Type": "String"
- }
- },
- "Mappings": {},
- "Conditions": {},
- "Resources": {
- "EMRCluster": {
- "DependsOn": [
- "EMRClusterServiceRole",
- "EMRClusterinstanceProfileRole",
- "EMRClusterinstanceProfile"
- ],
- "Type": "AWS::EMR::Cluster",
- "Properties": {
- "Applications": [
- {
- "Name": "Sqoop"
- }
- ],
- "Configurations": [],
- "Instances": {
- "Ec2KeyName": {
- "Ref": "KeyName"
- },
- "Ec2SubnetId": {
- "Ref": "SubnetID"
- },
- "MasterInstanceGroup": {
- "InstanceCount": 1,
- "InstanceType": {
- "Ref": "MasterInstacneType"
- },
- "Market": "ON_DEMAND",
- "Name": "Master"
- },
- "CoreInstanceGroup": {
- "InstanceCount": {
- "Ref": "NumberOfCoreInstances"
- },
- "InstanceType": {
- "Ref": "CoreInstanceType"
- },
- "Market": "ON_DEMAND",
- "Name": "Core",
- "AutoScalingPolicy": {
- "Constraints": {
- "MinCapacity": 1,
- "MaxCapacity": 3
- },
- "Rules": [
- {
- "Action": {
- "SimpleScalingPolicyConfiguration": {
- "ScalingAdjustment": 1,
- "CoolDown": 300,
- "AdjustmentType": "CHANGE_IN_CAPACITY"
- }
- },
- "Description": "",
- "Trigger": {
- "CloudWatchAlarmDefinition": {
- "MetricName": "YARNMemoryAvailablePercentage",
- "ComparisonOperator": "LESS_THAN",
- "Statistic": "AVERAGE",
- "Period": 300,
- "EvaluationPeriods": 1,
- "Unit": "PERCENT",
- "Namespace": "AWS/ElasticMapReduce",
- "Threshold": 15,
- "Dimensions": [
- {
- "Value": "${emr.clusterId}",
- "Key": "JobFlowId"
- }
- ]
- }
- },
- "Name": "Default-scale-out-1"
- },
- {
- "Action": {
- "SimpleScalingPolicyConfiguration": {
- "ScalingAdjustment": 1,
- "CoolDown": 300,
- "AdjustmentType": "CHANGE_IN_CAPACITY"
- }
- },
- "Description": "",
- "Trigger": {
- "CloudWatchAlarmDefinition": {
- "MetricName": "ContainerPendingRatio",
- "ComparisonOperator": "GREATER_THAN",
- "Statistic": "AVERAGE",
- "Period": 300,
- "EvaluationPeriods": 1,
- "Unit": "COUNT",
- "Namespace": "AWS/ElasticMapReduce",
- "Threshold": 0.75,
- "Dimensions": [
- {
- "Value": "${emr.clusterId}",
- "Key": "JobFlowId"
- }
- ]
- }
- },
- "Name": "Default-scale-out-2"
- },
- {
- "Action": {
- "SimpleScalingPolicyConfiguration": {
- "ScalingAdjustment": -1,
- "CoolDown": 300,
- "AdjustmentType": "CHANGE_IN_CAPACITY"
- }
- },
- "Description": "",
- "Trigger": {
- "CloudWatchAlarmDefinition": {
- "MetricName": "YARNMemoryAvailablePercentage",
- "ComparisonOperator": "GREATER_THAN",
- "Statistic": "AVERAGE",
- "Period": 300,
- "EvaluationPeriods": 1,
- "Unit": "PERCENT",
- "Namespace": "AWS/ElasticMapReduce",
- "Threshold": 75,
- "Dimensions": [
- {
- "Value": "${emr.clusterId}",
- "Key": "JobFlowId"
- }
- ]
- }
- },
- "Name": "Default-scale-in"
- }
- ]
- }
- },
- "TerminationProtected": false
- },
- "VisibleToAllUsers": true,
- "JobFlowRole": {
- "Ref": "EMRClusterinstanceProfile"
- },
- "ReleaseLabel": {
- "Ref": "ReleaseLabel"
- },
- "LogUri": {
- "Ref": "LogUri"
- },
- "Name": {
- "Ref": "EMRClusterName"
- },
- "AutoScalingRole": "EMR_AutoScaling_DefaultRole",
- "ServiceRole": {
- "Ref": "EMRClusterServiceRole"
- }
- },
- "Metadata": {
- "AWS::CloudFormation::Designer": {
- "id": "9752a730-1233-4688-bbfa-0d372d8b4b7b"
- }
- }
- },
- "EMRClusterServiceRole": {
- "Type": "AWS::IAM::Role",
- "Properties": {
- "AssumeRolePolicyDocument": {
- "Version": "2012-10-17",
- "Statement": [
- {
- "Effect": "Allow",
- "Principal": {
- "Service": [
- "elasticmapreduce.amazonaws.com"
- ]
- },
- "Action": [
- "sts:AssumeRole"
- ]
- }
- ]
- },
- "ManagedPolicyArns": [
- "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceRole"
- ],
- "Path": "/"
- },
- "Metadata": {
- "AWS::CloudFormation::Designer": {
- "id": "e5d7db8d-9b40-4c5c-bf75-052f7a77080f"
- }
- }
- },
- "EMRClusterinstanceProfileRole": {
- "Type": "AWS::IAM::Role",
- "Properties": {
- "AssumeRolePolicyDocument": {
- "Version": "2012-10-17",
- "Statement": [
- {
- "Effect": "Allow",
- "Principal": {
- "Service": [
- "ec2.amazonaws.com"
- ]
- },
- "Action": [
- "sts:AssumeRole"
- ]
- }
- ]
- },
- "ManagedPolicyArns": [
- "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforEC2Role"
- ],
- "Path": "/"
- },
- "Metadata": {
- "AWS::CloudFormation::Designer": {
- "id": "b5c0eafa-3a18-4c65-a36f-3f0906c147c3"
- }
- }
- },
- "EMRClusterinstanceProfile": {
- "Type": "AWS::IAM::InstanceProfile",
- "Properties": {
- "Path": "/",
- "Roles": [
- {
- "Ref": "EMRClusterinstanceProfileRole"
- }
- ]
- },
- "Metadata": {
- "AWS::CloudFormation::Designer": {
- "id": "87c2277a-7e40-4492-b3f6-24883ca5988e"
- }
- }
- },
- "EMRS4SIT2": {
- "Type": "AWS::EMR::Step",
- "Properties": {
- "ActionOnFailure": "CONTINUE",
- "HadoopJarStep": {
- "Args": [
- "sqoop",
- "import, --driver, org.postgresql.Driver, --connect, jdbc:postgresql://pipeline.fhuwis2ii.us-east-1.rds.amazonaws.com/pipeline, --username, pipeline, --password, pipe_line, --table, actor, --target-dir, s3://pridesys-sqoop/tables/actor, --compress"
- ],
- "Jar": "command-runner.jar"
- },
- "Name": "table1Step",
- "JobFlowId": {
- "Ref": "EMRCluster"
- }
- },
- "Metadata": {
- "AWS::CloudFormation::Designer": {
- "id": "65a4c828-b7c6-424b-950b-d68c6d92e382"
- }
- }
- }
- },
- "Outputs": {},
- "Metadata": {
- "AWS::CloudFormation::Designer": {
- "b5c0eafa-3a18-4c65-a36f-3f0906c147c3": {
- "size": {
- "width": 60,
- "height": 60
- },
- "position": {
- "x": 60,
- "y": 90
- },
- "z": 1,
- "embeds": []
- },
- "87c2277a-7e40-4492-b3f6-24883ca5988e": {
- "size": {
- "width": 60,
- "height": 60
- },
- "position": {
- "x": 180,
- "y": 90
- },
- "z": 1,
- "embeds": [],
- "isassociatedwith": [
- "b5c0eafa-3a18-4c65-a36f-3f0906c147c3"
- ]
- },
- "e5d7db8d-9b40-4c5c-bf75-052f7a77080f": {
- "size": {
- "width": 60,
- "height": 60
- },
- "position": {
- "x": 60,
- "y": 210
- },
- "z": 1,
- "embeds": []
- },
- "9752a730-1233-4688-bbfa-0d372d8b4b7b": {
- "size": {
- "width": 60,
- "height": 60
- },
- "position": {
- "x": 180,
- "y": 210
- },
- "z": 1,
- "embeds": [],
- "dependson": [
- "b5c0eafa-3a18-4c65-a36f-3f0906c147c3"
- ]
- },
- "65a4c828-b7c6-424b-950b-d68c6d92e382": {
- "size": {
- "width": 60,
- "height": 60
- },
- "position": {
- "x": -60.83920716362772,
- "y": 189.01408632115496
- },
- "z": 0,
- "embeds": [],
- "isassociatedwith": [
- "9752a730-1233-4688-bbfa-0d372d8b4b7b"
- ]
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment