Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the “Autoscaling Hop Limit Should Be Checked” misconfiguration for AWS EC2 using the AWS console, follow these steps:
  1. Login to AWS Console: Go to the AWS Management Console (https://aws.amazon.com/console/) and login with your credentials.
  2. Navigate to EC2 Dashboard: Click on the “Services” dropdown menu at the top left corner and select “EC2” under the Compute section.
  3. Select Auto Scaling Groups: In the EC2 Dashboard, locate and click on “Auto Scaling Groups” from the navigation pane on the left.
  4. Select the Auto Scaling Group: Identify the Auto Scaling Group that you want to remediate and click on its name to select it.
  5. Edit Auto Scaling Group: In the Auto Scaling Group details page, click on the “Edit” button to modify the group settings.
  6. Configure Auto Scaling Group: Scroll down to find the “Advanced Details” section and look for the “Instance Protection” settings.
  7. Enable Instance Protection: In the “Instance Protection” settings, you should find an option related to “Autoscaling Hop Limit”. Enable this option by checking the box or setting an appropriate value based on your requirements.
  8. Save Changes: Once you have enabled the Autoscaling Hop Limit or set the appropriate value, scroll to the bottom of the page and click on the “Save” button to apply the changes.
  9. Verify Configuration: After saving the changes, it is recommended to verify that the Autoscaling Hop Limit setting has been successfully applied. You can do this by checking the configuration details of the Auto Scaling Group.
By following these steps, you can remediate the “Autoscaling Hop Limit Should Be Checked” misconfiguration for AWS EC2 using the AWS console.

To remediate the misconfiguration of Autoscaling Hop Limit not being checked for AWS EC2 using AWS CLI, follow these steps:
  1. Open your terminal or command prompt.
  2. Run the following AWS CLI command to describe the Auto Scaling groups in your AWS account:
  1. Identify the Auto Scaling group that you want to update with the Autoscaling Hop Limit.
  2. Run the following AWS CLI command to update the Auto Scaling group with the Autoscaling Hop Limit:
Replace <your-auto-scaling-group-name> with the actual name of your Auto Scaling group.
  1. Verify that the Autoscaling Hop Limit has been successfully updated by running the following AWS CLI command:
Replace <your-auto-scaling-group-name> with the actual name of your Auto Scaling group.
  1. Ensure that the output of the above command shows “ELB” as the HealthCheckType, which indicates that the Autoscaling Hop Limit has been successfully updated.
By following these steps, you can remediate the misconfiguration of Autoscaling Hop Limit not being checked for AWS EC2 using AWS CLI.
To remediate the “Autoscaling Hop Limit Should Be Checked” misconfiguration for AWS EC2 using Python, you can use the AWS SDK for Python (Boto3) to update the Auto Scaling Group settings. Here are the step-by-step instructions:
  1. Install Boto3:
  1. Use the following Python script to update the Auto Scaling Group settings to check the “Autoscaling Hop Limit”:
  1. Replace 'YOUR_AUTO_SCALING_GROUP_NAME' with the name of your Auto Scaling Group.
  2. Run the Python script to update the Auto Scaling Group settings. This will enable the “Autoscaling Hop Limit” check for the specified Auto Scaling Group.
By following these steps, you can remediate the “Autoscaling Hop Limit Should Be Checked” misconfiguration for AWS EC2 using Python and Boto3.
Changing metadata_options on aws_launch_configuration forces replacement of the launch configuration; with create_before_destroy = true, Terraform will create the new configuration and then switch the Auto Scaling Group to it (instances may then be replaced according to your ASG settings).For verification, terraform plan should show a new aws_launch_configuration being created (and the old one destroyed) and the aws_autoscaling_group updated to reference the new launch configuration, with http_put_response_hop_limit = 1 and http_tokens = "required" in the plan.