Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Rule: EC2 Instances Should Be in a VPC

Ensure all EC2 instances are set up within a Virtual Private Cloud (VPC)

RuleEC2 instances should be in a VPC
FrameworkNIST 800-53 Revision 5
Severity
High

Rule Description

EC2 instances should be deployed within a Virtual Private Cloud (VPC) in compliance with the NIST 800-53 Revision 5 security standard. This rule ensures that the EC2 instances are protected and isolated within a secure network environment that adheres to the stringent security guidelines defined by NIST.

Remediation Steps

To remediate this rule and ensure compliance, follow these steps:

Step 1: Create a VPC

  1. 1.
    Log in to the AWS Management Console.
  2. 2.
    Navigate to the Amazon VPC service.
  3. 3.
    Click on "Create VPC."
  4. 4.
    Specify the desired VPC settings, such as VPC name, IPv4 CIDR block, and tenancy options.
  5. 5.
    Click on "Create VPC" to create the VPC.

Step 2: Configure Network Subnets

  1. 1.
    Inside the newly created VPC, select "Subnets" from the left-hand menu.
  2. 2.
    Click on "Create subnet."
  3. 3.
    Specify the subnet details, such as name, VPC, availability zone, and IPv4 CIDR block.
  4. 4.
    Click on "Create subnet" to create the subnet.
  5. 5.
    Repeat these steps to create additional subnets as needed.

Step 3: Set up Internet Gateway (IGW)

  1. 1.
    Under "Internet Gateways" in the VPC dashboard, click on "Create internet gateway."
  2. 2.
    Provide a name for the internet gateway and click on "Create internet gateway."
  3. 3.
    Select the newly created internet gateway and click on "Actions."
  4. 4.
    Choose "Attach VPC" and select the VPC created earlier.
  5. 5.
    Click on "Attach" to associate the internet gateway with the VPC.

Step 4: Configure Route Tables

  1. 1.
    In the VPC dashboard, select "Route tables" from the left-hand menu.
  2. 2.
    Click on "Create route table."
  3. 3.
    Provide a name for the route table and select the VPC.
  4. 4.
    Click on "Create route table" to create the route table.
  5. 5.
    Select the newly created route table and click on the "Routes" tab.
  6. 6.
    Click on "Edit routes" and add a new route with the destination of "0.0.0.0/0" and the target as the internet gateway created earlier.
  7. 7.
    Click on "Save routes."
  8. 8.
    Select the "Subnet associations" tab and associate the desired subnets with the route table.

Step 5: Launch EC2 Instances in the VPC

  1. 1.
    Navigate to the EC2 service in the AWS Management Console.
  2. 2.
    Click on "Launch Instances."
  3. 3.
    Select the desired AMI and instance type.
  4. 4.
    In the "Configure Instance Details" section, choose the VPC and subnet within the VPC.
  5. 5.
    Complete the instance configuration as needed, including security groups, storage, and tags.
  6. 6.
    Click on "Review and Launch," followed by "Launch" to create the EC2 instance.

Troubleshooting Steps

If any issues occur during the remediation process, consider the following troubleshooting steps:

  1. 1.
    Verify that the VPC creation process was completed successfully.
  2. 2.
    Double-check the subnet configurations, ensuring that they are associated with the correct VPC and availability zone.
  3. 3.
    Confirm that the internet gateway is properly attached to the VPC and that its routes are correctly set.
  4. 4.
    Confirm that the route table has the necessary routes and associations with the subnets.
  5. 5.
    Ensure that the EC2 instances are launched within the VPC and associated subnets.

Example Code (if applicable)

The provided steps do not require specific code snippets, as they can be accomplished through the AWS Management Console. However, if infrastructure-as-code (IaC) solutions such as AWS CloudFormation or AWS CDK are leveraged, the corresponding code can be crafted to automate the creation of VPCs, subnets, route tables, and EC2 instances.

Is your System Free of Underlying Vulnerabilities?
Find Out Now