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. Medium

Address

Cost Optimization, Security

Compliance Standards

PCIDSS, HIPAA

Remediation

How to ensure EMR clusters are in VPC

Using AWS Console

  1. Navigate to the Amazon EMR console.
  2. Click on the “Create cluster” button to create a new cluster, or select an existing cluster from the cluster list.
  3. In the “Create Cluster” or “Edit Cluster” page, locate the “General configuration” section. (In the Cloudanix Console, navigate to “Misconfig” page and look for Affected Assets for “MR Clusters Should Be In VPC” Policy.)
  4. Under the “Network settings” section, ensure that the “Launch mode” is set to “VPC”.
  5. Select the desired VPC from the available options. If you haven’t created a VPC yet, you can create one using the Amazon VPC service before configuring your EMR cluster.
  6. Select the appropriate Subnet(s) within the selected VPC where you want the EMR cluster instances to be launched.
  7. Optionally, you can configure additional network settings such as the VPC security groups and EMR managed scaling rules.
  8. Review and configure the remaining settings for your EMR cluster, such as instance types, EC2 key pair, software configuration, etc.
  9. Once you have completed the configuration, click on the “Create cluster” or “Save” button to launch or update the cluster.

Triage and Remediation

Remediation

Using Console

For Redshift, the equivalent control is “Redshift clusters must be launched in a VPC (not EC2-Classic) and associated only with approved VPCs/subnets.”
Redshift now launches only into VPC by default in most regions, but older clusters might still be outside or in an incorrect VPC/network setup. You can’t “move” an existing Redshift cluster to a different network; you must recreate it in the desired VPC.
Below are console-based steps, assuming two scenarios:

1. Ensure new Redshift clusters are in a VPC

A. Create or verify a VPC and subnets

  1. In the AWS Management Console, go to VPC.
  2. If you already have a compliant VPC, note:
    • VPC ID
    • Subnet IDs (in at least two AZs if you want multi-AZ style resilience)
    • Route tables, and whether they allow required connectivity.
  3. If you need a new VPC:
    1. Click Your VPCs > Create VPC.
    2. Choose VPC only or VPC and more, give it a name and CIDR (e.g., 10.0.0.0/16).
    3. Create at least 2 private subnets for Redshift:
      • Go to Subnets > Create subnet, select your VPC and define CIDR blocks (e.g., 10.0.1.0/24, 10.0.2.0/24).
    4. Set up NAT gateway / routing if the cluster needs outbound internet access.
    5. Optionally create VPC endpoints (for S3 etc.) if you want private access.

B. Create a Redshift subnet group

  1. Go to Amazon Redshift console.
  2. In the left panel, choose Configurations > Subnet groups.
  3. Click Create cluster subnet group.
  4. Provide:
    • Name and Description
    • VPC: select the VPC you prepared.
    • Subnets: add the private subnets for Redshift.
  5. Click Create cluster subnet group.

C. Create or configure a security group for Redshift

  1. Go to VPC console → Security groups.
  2. Create security group:
    • Select the same VPC.
    • Add an inbound rule for Redshift:
      • Type: Redshift (TCP 5439) or a custom TCP rule for the cluster port.
      • Source: a specific CIDR or security group (e.g., application servers’ SG), not 0.0.0.0/0 unless justified.
  3. Save the security group ID for use when creating the cluster.

D. Create the Redshift cluster in the VPC

  1. Go to Amazon Redshift console.
  2. Click Create cluster.
  3. Under Cluster configuration, set usual options (identifier, node type, etc.).
  4. Under Network and security:
    • VPC: select your target VPC.
    • Subnet group: select the subnet group you created.
    • Publicly accessible:
      • Usually No (private cluster); set Yes only if absolutely necessary.
    • VPC security groups: select the security group you configured.
  5. Finish the wizard and create the cluster.
Result: all new clusters are properly in a VPC and use only the allowed network resources (VPC, subnets, SGs).

2. Remediate an existing Redshift cluster not in the correct VPC

You cannot directly move a Redshift cluster from EC2-Classic or another VPC. You must snapshot and recreate.

A. Take a snapshot of the existing cluster

  1. Go to Amazon Redshift console → Clusters.
  2. Select the non-compliant cluster.
  3. Choose Actions > Create snapshot.
  4. Enter a name and confirm.
  5. Wait until the snapshot status is available.

B. Restore the snapshot into a VPC

  1. In Redshift console, go to Snapshots.
  2. Select the snapshot you just created.
  3. Click Actions > Restore from snapshot (or Restore snapshot).
  4. In the restore wizard:
    • Cluster identifier: new name (e.g., mycluster-vpc).
    • Under Network and security:
      • VPC: select the compliant VPC.
      • Subnet group: choose the subnet group you created.
      • Publicly accessible: typically No.
      • VPC security group: choose the secure SG.
    • Adjust port if needed (default 5439).
  5. Complete restoration and wait for the new cluster to become available.

C. Update clients / applications to use the new cluster

  1. In the new cluster details, copy the Endpoint.
  2. Update:
    • Application configuration / connection strings.
    • ETL jobs, BI tools, Lambda functions, etc., to point to the new endpoint.
  3. Validate connectivity and data correctness.

D. Decommission the old non-compliant cluster

  1. Once fully validated, go to Clusters.
  2. Select the old cluster.
  3. Actions > Delete:
    • Optionally keep a final snapshot if you want.
  4. Confirm deletion.

By enforcing that all Redshift clusters are restored/created only in approved VPCs and subnet groups, you satisfy the “clusters must be in VPC” requirement for Redshift using the AWS console.
For Amazon Redshift, the equivalent of “EMR clusters should be in a VPC” is “Redshift clusters must be launched in a VPC (not EC2-Classic).”
You can’t move an existing non‑VPC Redshift cluster into a VPC; instead you snapshot it and restore into a VPC.
Below are AWS CLI–based steps.

1. Identify Redshift clusters not in a VPC

If this returns your cluster(s), they are not in a VPC and must be migrated.

2. Choose or create a VPC and subnets

List VPCs:
Pick a VPC ID (e.g., vpc-0123456789abcdef0).List subnets in that VPC:
Pick 2+ subnets in different AZs for production use.

3. Create a Redshift subnet group in that VPC


4. Create / choose security groups for Redshift

Create a security group in the same VPC:
Open Redshift port 5439 only to needed sources (example: office IP):

5. Snapshot the existing non‑VPC cluster

Wait until snapshot is ready:

6. Restore the cluster into the VPC

Restore from snapshot specifying the subnet group and security group(s):
Optionally adjust public accessibility:
Wait for the cluster to become available:

7. Update applications and clients

Get new endpoint:
Update all applications to use this new endpoint.

8. Decommission the old non‑VPC cluster

Once you’ve confirmed everything works:
(Or omit --skip-final-cluster-snapshot and provide --final-cluster-snapshot-identifier if you want another final snapshot.)
After these steps, your Redshift cluster runs inside a VPC and satisfies the “must be in VPC” requirement.
For Redshift, “cluster in VPC” effectively means: each Redshift cluster must be associated with a VPC subnet group (i.e., have a non‑null VpcId and ClusterSubnetGroupName). Old “EC2-Classic” style clusters are the issue.Below is how to (1) detect non‑VPC Redshift clusters and (2) migrate them into a VPC using Python/boto3.

1. Prereqs

You’ll also need:
  • A target VPC ID (e.g. vpc-1234567890abcdef0)
  • At least two private subnets in that VPC (for multi‑AZ best practice), e.g.:
    • subnet-aaa...
    • subnet-bbb...
  • A security group for Redshift, e.g. sg-1234... (with appropriate inbound rules from your app/BI tools and outbound allowed)

2. Detect Redshift clusters not in a VPC


3. Create / verify a Redshift subnet group for your VPC


4. Migrate each non‑VPC cluster into the VPC

You can’t “flip” an existing non‑VPC Redshift cluster into a VPC in‑place. The safe pattern:
  1. Take a snapshot of the existing cluster.
  2. Restore a new cluster from that snapshot into the VPC subnet group, with a VPC security group.
  3. Cut over DNS / application connections to the new endpoint.
  4. Delete the old non‑VPC cluster and old snapshot (once validated).

4.1 Snapshot the original cluster


4.2 Restore a new VPC-based cluster from the snapshot

You’ll map the old cluster to a new ID (e.g., append -vpc), in a VPC subnet group and security group.

5. Cutover and clean up

  1. Update application connection strings to use the new cluster’s endpoint (hostname + port + DB name).
  2. Validate queries / workloads on the new VPC cluster.
  3. When fully satisfied, delete the old cluster and snapshot.

6. Summary of remediation

  1. Detect Redshift clusters with no VpcId (non‑VPC).
  2. Create a Redshift subnet group for your target VPC.
  3. For each non‑VPC cluster:
    • Take a manual snapshot.
    • Restore a new cluster from that snapshot in the VPC (subnet group + VPC SG).
    • Switch clients to the new endpoint.
    • Delete old non‑VPC cluster and its snapshot once verified.
This ensures all Redshift clusters run in a VPC, satisfying the “cluster should be in VPC” control, using Python automation.
Moving an existing Redshift cluster from EC2-Classic to a VPC (by adding cluster_subnet_group_name / vpc_security_group_ids) forces replacement of the cluster; this can cause downtime and potential data loss if not migrated carefully.For verification, terraform plan should show the Redshift cluster either being created with cluster_subnet_group_name and vpc_security_group_ids set, or (for an existing non‑VPC cluster) a -/+ replacement where the new resource includes those VPC fields.

Additional Reading: