# This defines the EMR Setup for data processing # It setups all Roles, EC2 parameters, Cluster Setup, VPC, etc. # THIS CODE IS NOT FOR PRODUCTIVE USE. TEST/TRANING CODE ONLY # (c) by David Surey - Amazon Web Services EMEA SARL # 10/2019 - suredavi@amazon.de # Create an ec2keypair into the processing account. # Set via variable. resource "aws_key_pair" "ec2key" { provider = aws.processing key_name = var.ec2key public_key = var.ec2pubkeystring } # Setup the EMR Cluster. Pass attributes for the Nodes and Spark setup resource "aws_emr_cluster" "cluster" { provider = aws.processing name = "emr-crossaccount-cluster" release_label = "emr-5.27.0" applications = ["Spark"] ec2_attributes { subnet_id = aws_subnet.main.id emr_managed_master_security_group = aws_security_group.allow_access.id emr_managed_slave_security_group = aws_security_group.allow_access.id instance_profile = aws_iam_instance_profile.emr_profile.arn key_name = aws_key_pair.ec2key.key_name } master_instance_group { instance_type = "m5.xlarge" } core_instance_group { instance_type = "m5.xlarge" instance_count = 1 } security_configuration = aws_emr_security_configuration.emr_security.name service_role = aws_iam_role.emr_service_role.arn configurations_json = <