More Info:
This rule checks if the deployment group for EC2/On-Premises Compute Platform is configured with a minimum healthy hosts fleet percentage or host count greater than or equal to the input threshold.Risk Level
MediumAddress
ConfigurationCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- Essential 8
- 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
Remediation
Using Console
Using Console
In AWS, the “Minimum healthy hosts – Fleet percentage” setting is part of CodeDeploy, not CodeBuild. It controls what percentage of your fleet must remain healthy during deployments.Below are step‑by‑step instructions to remediate this using the AWS Console for a CodeDeploy deployment group.
1. Open CodeDeploy in the Console
- Sign in to the AWS Management Console.
- In the top search bar, type “CodeDeploy” and open CodeDeploy.
2. Select the Application and Deployment Group
- In the left navigation, choose Applications.
- Click the application that contains your EC2/On‑Premises deployment group.
- In the Application details page, select the Deployment groups tab.
- Click the specific deployment group you want to remediate.
3. Edit the Deployment Group
- On the deployment group details page, choose Edit (top right).
4. Set “Minimum healthy hosts” to a Proper Fleet Percentage
- Scroll to the Deployment configuration or Minimum healthy hosts section (the exact layout may vary slightly).
- Look for Minimum healthy hosts:
- Select Fleet percentage (instead of an absolute host count).
- Enter an appropriate percentage, for example:
- 50% (common default; ensures half the fleet stays healthy),
- or a value that matches your compliance / policy requirement (e.g., ≥ 75%).
- Confirm any related validation or warnings.
5. Save the Changes
- Scroll to the bottom of the page.
- Click Save (or Update deployment group).
6. Verify Compliance
- Back on the deployment group details page, confirm that:
- Minimum healthy hosts type is set to Fleet percentage.
- The percentage value matches your required setting.
- Optionally, trigger a test deployment to ensure deployments proceed without violating the minimum healthy host threshold.
Using CLI
Using CLI
This control applies to AWS CodeDeploy (for EC2/On-Prem), not CodeBuild. You remediate it by setting the minimumHealthyHosts parameter on the deployment group to use FLEET_PERCENT with an appropriate percentage (e.g., 50%).Below are the exact AWS CLI steps.
List deployment groups for an application:
You’ll see something like:or
You can also use JSON form:
Expected:This ensures that during deployments, CodeDeploy maintains at least 50% of your EC2 fleet in a healthy state.
1. Identify the application and deployment group
If you already know the application and deployment group names, skip to step 2.List CodeDeploy applications:2. Check current minimum healthy host settings
3. Update to use FLEET_PERCENT with a safe percentage
Choose the percentage you want to enforce (e.g., 50). Then run:4. Verify the change
Using Python
Using Python
This setting doesn’t live in CodeBuild itself; it’s a CodeDeploy deployment group property that controls how many EC2 hosts must stay in service during a deployment. To “remediate” it, you need to update the deployment group that CodeBuild/CodePipeline ultimately deploys to.Below are concise step‑by‑step instructions, including a Python (boto3) example.
Adjust:
This ensures the Minimum Healthy Hosts Fleet Percentage is enforced automatically as part of your build/deploy flow.
1. Decide the minimum healthy hosts policy
You must choose one of:type = "HOST_COUNT"andvalue = <integer>
e.g., require at least 2 healthy instances at all times
type = "FLEET_PERCENT"andvalue = <0‑100>
e.g., require at least 50% of the fleet to remain healthy
2. Console remediation (for quick verification)
- Go to AWS CodeDeploy console.
- Choose Applications → select your application.
- Choose Deployment groups → select your EC2/On‑Premises deployment group.
- Click Edit.
- Under Deployment configuration / Minimum healthy hosts, select:
- Percentage of fleet and set the percentage (e.g., 50).
- Save the deployment group.
3. Python (boto3) remediation
You can programmatically enforce a minimum healthy hosts fleet percentage usingupdate_deployment_group.3.1. Install and configure boto3 (if not already)
3.2. Update the deployment group
region_nameAPPLICATION_NAMEDEPLOYMENT_GROUP_NAMEpercent(e.g.,50or higher, per your compliance requirement)
4. Integrate with CodeBuild / pipelines
If CodeBuild is part of a CI/CD pipeline (e.g., CodePipeline) that deploys via CodeDeploy:- Run this script as:
- A one‑time remediation (manual run or separate job), or
- A CodeBuild step in your pipeline that ensures the deployment group always has the desired setting before deployment.
- Add a buildspec phase (e.g.,
pre_build) to run the Python script. - Ensure the CodeBuild role has
codedeploy:UpdateDeploymentGrouppermission.
buildspec.yml snippet:Using Terraform
Using Terraform
minimum_healthy_hosts setting as the CLI command (type = "FLEET_PERCENT", value = 75) and is applied in-place without forcing replacement of the deployment group; ensure the percentage suits your availability requirements.To verify, terraform plan should show an update to aws_codedeploy_deployment_group.EC2_DEPLOYMENT_GROUP.minimum_healthy_hosts[0].type and .value, with no create/destroy of the deployment group.
