Windows EC2 memory hog
Consume a configurable amount of memory (absolute or percentage) on one or more Windows EC2 instances (selected by ID or tag) for a configurable duration so you can test how Windows-hosted workloads b
Windows EC2 memory hog is an AWS chaos fault that allocates MEMORY_CONSUMPTION MB (or MEMORY_PERCENTAGE percent of total memory) on one or more Windows EC2 instances for a configurable duration. Targets are selected by EC2_INSTANCE_ID or EC2_INSTANCE_TAG. The fault dispatches a PowerShell allocation command via AWS Systems Manager Run Command and releases the memory at the end of the fault.
Use this fault to test how a Windows-hosted workload behaves under sustained memory pressure: whether the application sheds load when memory is tight, whether the working set spills to swap (paging file), and whether memory-based monitoring catches the pressure quickly.
Use cases
Run this fault when you want to answer concrete questions like:
Memory pressure handling: When free memory shrinks, does the application sustain throughput, or does paging cause throughput collapse?
Service recovery: Do Windows services (IIS, SQL Server Express, application services) recover cleanly when memory is freed?
Autoscaling: Does a memory-based scaling policy fire and add capacity?
Monitoring SLA: Does the alert on
Memory % Committed Bytes In Usefire within the SLA?Recovery time: When the chaos ends, how quickly does memory return to baseline?
Prerequisites
Kubernetes version: 1.21 or later for the chaos infrastructure cluster. Go to What's supported to confirm distribution support.
Target Windows EC2 instances: Each instance is in the
runningstate and registered with AWS Systems Manager.Selection criteria: Either
EC2_INSTANCE_IDis set orEC2_INSTANCE_TAGis set.AWS credentials available: Either an AWS credentials file uploaded as a File Secret in Harness Secret Manager (see Authentication below) or an IAM role for service accounts (IRSA) bound to the chaos infrastructure service account.
IAM permissions granted: The credentials or role include the permissions listed below.
Supported environments
Windows Server 2016 / 2019 / 2022 EC2
Supported
Linux EC2 instances
Not supported (use EC2 memory hog)
AWS regions
Supported in every commercial region; pass the region in REGION
Permissions required
The IAM principal that the chaos pod uses (the credentials mounted from the Harness Secret Manager file secret, the IRSA role on the chaos service account, or the role assumed via ASSUME_ROLE_ARN) needs the following AWS actions.
Go to common policy for all AWS faults to use a single superset IAM policy across every AWS fault.
Authentication
The fault supports three credential delivery models. Pick one based on how your chaos infrastructure is deployed.
Harness Secret Manager file secret
Chaos infrastructure runs outside EKS, or you want explicit static credentials
Upload the AWS credentials file as a File Secret in Harness Secret Manager and reference its identifier via AWS_AUTHENTICATION_SECRET
IAM Roles for Service Accounts (IRSA)
Chaos infrastructure runs in EKS and uses an OIDC-bound service account
No tunable changes; the chaos pod inherits the role automatically. Go to AWS IAM integration to set it up
Assume role
The fault needs to act in a different account or with elevated permissions
Set ASSUME_ROLE_ARN to the role ARN; the chaos pod assumes the role on top of its base credentials
When using the Harness Secret Manager method, the contents of the File Secret should be the AWS credentials file in the standard ~/.aws/credentials format:
Upload this file as a File Secret in Harness Secret Manager (Project Setup → Secrets → New File Secret), and pass the secret identifier in AWS_AUTHENTICATION_SECRET when configuring the fault.
Go to AWS named profile for chaos to switch between profiles inside a single credentials file.
Fault tunables
Configure the following fault parameters when you add Windows EC2 memory hog to an experiment in Chaos Studio. Defaults are shown for reference.
Required parameters
REGION
AWS region that hosts the target instances (for example us-east-1).
(required)
Targeting parameters
EC2_INSTANCE_ID
Comma-separated list of EC2 instance IDs to affect.
""
EC2_INSTANCE_TAG
Tag in Key:Value form matching candidate instances when EC2_INSTANCE_ID is empty.
""
INSTANCE_AFFECTED_PERC
Percentage of matching instances (by tag) to affect. 0 corresponds to one instance.
0
Chaos parameters
MEMORY_CONSUMPTION
Memory to allocate in MB. Set to 0 and use MEMORY_PERCENTAGE for percentage-based allocation.
0
MEMORY_PERCENTAGE
Percentage of total system memory to allocate. Used only when MEMORY_CONSUMPTION=0.
50
TOTAL_CHAOS_DURATION
Duration of the fault in seconds.
60
INSTALL_DEPENDENCIES
Install the stress tooling on the Windows host if missing.
true
SEQUENCE
Order in which multiple instances are stressed: parallel stresses all selected instances at once; serial stresses one at a time.
parallel
RAMP_TIME
Wait period in seconds before and after the fault. Go to ramp time to read how it is applied.
0
Authentication
ASSUME_ROLE_ARN
ARN of an IAM role to assume on top of the base credentials. Leave empty to use the base credentials directly.
""
AWS_AUTHENTICATION_SECRET
Identifier of the File Secret in Harness Secret Manager that contains the AWS credentials file. Not required when using IRSA.
""
Tunables that apply to every fault are documented in common tunables for all faults. AWS-specific shared tunables are documented in common AWS fault tunables.
Fault execution in brief
Resolves the target instance list from EC2_INSTANCE_ID (or by EC2_INSTANCE_TAG), dispatches a PowerShell memory-allocation command via AWS Systems Manager Run Command to each selected Windows instance, holds the allocation for TOTAL_CHAOS_DURATION seconds, then releases the memory.
Expected behavior during fault execution
Free memory on the targeted Windows instances drops by approximately
MEMORY_CONSUMPTIONMB (or to theMEMORY_PERCENTAGEtarget).If the working set exceeds available physical memory, Windows pages to the paging file; throughput collapses.
IIS and Windows services may experience increased response latency.
CloudWatch
MemoryUtilization(when the CloudWatch Agent is installed) rises.
Signals to watch
Attach resilience probes to assert each layer:
Memory utilization: Use a Prometheus probe on a memory-utilization metric (
Memory % Committed Bytes In Useexported via CloudWatch).Application latency: Use an HTTP probe and assert percentile latency SLOs.
Paging activity: Use a Prometheus probe on
Pages/secor equivalent to detect pressure.Service availability: Monitor that Windows services stay in the
Runningstate.
Verify the fault execution effect
While the experiment is running, confirm memory pressure is applied:
Inspect from the Windows host (via SSM Session Manager).
Available memory should drop by approximately
MEMORY_CONSUMPTIONduring the chaos window.Check CloudWatch (if the CW Agent is installed).
In CloudWatch,
mem_used_percent(or the equivalent) should rise on the affected instances.Inspect SSM command status.
Recovery and cleanup
End of duration: The chaos pod releases the memory on each host.
Abort the experiment: Stopping the experiment from Chaos Studio cancels the SSM command.
Manual recovery: If the fault exits before cleanup, kill the stress process on the host via SSM Run Command (PowerShell
Stop-Process).Workload recovery: Pages swapped out during the stress are read back into memory on demand; some latency may persist briefly after recovery.
Limitations
Windows-only.
SSM-managed hosts only.
Paging file behaviour: If the paging file is small or disabled, Windows may BSOD or kill processes when memory is exhausted.
Cross-region targeting: A single experiment targets one region (the value of
REGION).
Troubleshooting
Related faults
Windows EC2 CPU hog: Stress CPU on Windows instances instead of memory.
EC2 memory hog: Memory stress on Linux EC2 instances.
Windows EC2 process kill: Kill specific Windows processes on the instance.
Common AWS fault tunables: Shared environment variables for AWS faults.
Last updated
Was this helpful?