Skip to main content

More Info:

Ensure that your Amazon Elastic MapReduce (EMR) clusters are provisioned using the AWS EC2-VPC platform instead of EC2-Classic platform (outdated from 2013.12.04) for better flexibility and control over security, better traffic routing and availability.

Risk Level

Medium

Address

Cost Optimisation, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • HIPAA
  • ISO 27001
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of EMR clusters not being in a VPC for AWS Redshift using the AWS console, follow these steps:
  1. Navigate to the Amazon EMR console:
    • Open the AWS Management Console.
    • Go to the Amazon EMR console by searching for “EMR” in the services search bar.
  2. Select the EMR cluster:
    • Select the EMR cluster that is not in a VPC.
  3. Update the cluster settings:
    • Click on the “Edit” button or navigate to the “Hardware” tab in the cluster details.
    • Scroll down to the “Network and Security” section.
  4. Select VPC and Subnet:
    • Under the “Network and Security” section, choose the VPC where you want to place the EMR cluster.
    • Select a subnet within the chosen VPC.
  5. Configure security groups:
    • Review and update the security groups associated with the EMR cluster to ensure proper network access controls.
  6. Save the changes:
    • Click on the “Save” or “Update” button to apply the changes to the EMR cluster.
  7. Verify the VPC configuration:
    • After saving the changes, verify that the EMR cluster is now running within the specified VPC by checking the cluster details.
By following these steps, you can remediate the misconfiguration of having EMR clusters not in a VPC for AWS Redshift using the AWS console.

To remediate the misconfiguration of EMR Clusters not being in a VPC for AWS Redshift using AWS CLI, follow these steps:
  1. Create a VPC (if not already created): Use the following AWS CLI command to create a VPC:
  2. Create Subnets within the VPC: Create at least two subnets in different Availability Zones within the VPC using the following command:
  3. Create an Internet Gateway (IGW) and attach it to the VPC:
  4. Create Route Tables and associate them with the subnets:
  5. Create Security Groups for EMR Clusters: Create a security group for EMR clusters that allows necessary inbound and outbound traffic using the following command:
  6. Launch EMR Cluster within the VPC: Launch the EMR cluster within the VPC and specify the security group and subnets created earlier using the AWS Management Console or AWS CLI.
  7. Verify the Configuration: Use the following command to describe the EMR cluster and verify that it is running within the VPC:
By following these steps, you can remediate the misconfiguration of EMR Clusters not being in a VPC for AWS Redshift using AWS CLI.
To remediate the misconfiguration of EMR clusters not being in a VPC for AWS Redshift using Python, you can follow these steps:
  1. Create a VPC:
    • Use the AWS SDK for Python (Boto3) to create a new Virtual Private Cloud (VPC) in your AWS account.
    • You can use the create_vpc method from the ec2 client in Boto3 to create a VPC.
  2. Create Subnets:
    • Create one or more subnets within the VPC. Make sure the subnets are in different availability zones for high availability.
    • Use the create_subnet method from the ec2 client in Boto3 to create subnets.
  3. Create an Internet Gateway (IGW):
    • Attach an Internet Gateway to the VPC to allow internet access for resources within the VPC.
    • Use the create_internet_gateway method from the ec2 client in Boto3 to create an Internet Gateway.
  4. Create Route Tables:
    • Create route tables for the public and private subnets within the VPC.
    • Use the create_route_table method from the ec2 client in Boto3 to create route tables.
  5. Associate Subnets with Route Tables:
    • Associate the subnets with their respective route tables to control the routing of network traffic.
    • Use the associate_route_table method from the ec2 client in Boto3 to associate subnets with route tables.
  6. Launch EMR Cluster in VPC:
    • When launching an EMR cluster using Boto3, specify the Ec2SubnetId parameter to launch the cluster within the VPC.
    • Set the Ec2SubnetId parameter to the ID of the subnet where you want to launch the EMR cluster.
Here is a sample Python code snippet to launch an EMR cluster within a VPC using Boto3:
Make sure to replace placeholder values like sg-12345678 with actual security group IDs and customize the code as per your specific requirements.
Substitute:
  • REPLACE_WITH_CLUSTER_NAME with your EMR cluster name.
  • REPLACE_WITH_EMR_RELEASE with a supported EMR release label.
  • REPLACE_WITH_VPC_CIDR / REPLACE_WITH_SUBNET_CIDR with your network ranges.
  • REPLACE_WITH_AZ with an AZ in your region.
  • Wire aws_iam_role.EMR_SERVICE_ROLE and aws_iam_role.EMR_EC2_INSTANCE_PROFILE_ROLE to your existing IAM roles or define them separately.
Changing the subnet_id for an existing aws_emr_cluster forces replacement of the cluster (cluster termination and recreation), which is an interruptive change.Verification: terraform plan should show ec2_attributes.subnet_id being set (or changed) from null/an EC2-Classic configuration to the ID of aws_subnet.EMR_SUBNET, with a replacement of the EMR cluster if it already exists.

Additional Reading: