- Newest
- Most votes
- Most comments
Hello.
As far as I know, there are no settings to limit MemoryMax.
The setting itself should be able to be disabled using the following command that you executed.
If you want to disable the settings for a member account managed by AWS Organizations, you must specify the "--account-id" option.
https://docs.aws.amazon.com/cli/latest/reference/inspector2/update-configuration.html
aws inspector2 update-configuration \
--ec2-configuration '{
"scanMode":"EC2_SSM_AGENT_BASED",
"activateVMScanner":false
}'
aws inspector2 update-configuration \
--ec2-configuration '{
"scanMode":"EC2_HYBRID",
"activateVMScanner":false
}'
By the way, is the API execution history recorded in CloudTrail after running the AWS CLI?
How do I turn off Enhanced EC2 Scanning (Inspector VM Scanner)? Console has no option, API ignores activateVMScanner=false
Hi Karl,
Short answers first, then the mechanics.
- Yes, it's reversible —
activateVMScanner: falseis the documented control and it is a valid parameter. Your call is almost certainly landing on a configuration record that isn't the one governing your instances. That's an authority/scope problem, not a bad request, which is exactly why you get a 200 with no state change. - No published plan on
MemoryMaxthat I can find. But you don't have to wait for one: there are documented resource controls the other answer missed, and AWS documents an update-safe override mechanism you can use to add a memory cap yourself today.
Your activatedAt staying at its original value is the tell. That isn't "the write was rejected", it's "the record you're reading was never touched".
Why UpdateConfiguration returns 200 and changes nothing
The update-configuration CLI reference spells out a propagation model that is easy to miss:
If you don't specify an
accountId, this operation updates the delegated administrator's configuration and propagates it to member accounts that have not been individually configured. If you specify anaccountId, this operation updates that member account's configuration. Only the delegated administrator can specify anaccountId; member accounts cannot call this operation.
Three distinct failure modes fall out of that, and they produce your exact symptom:
a) You're the delegated admin, but the target account is individually configured. Your no---account-id call updates your config and propagates only to accounts that have never been individually configured. Any account with its own config keeps the VM scanner on, untouched.
b) The account is managed by AWS Organizations policies. This one overrides everything else. From Deactivating Amazon Inspector:
If your account's Amazon Inspector enablement is managed by AWS Organizations policies, you cannot deactivate policy-managed scan types through the Amazon Inspector console or API. To deactivate Amazon Inspector scan types, you must modify the organization policy [...] Member accounts and delegated administrators cannot disable policy-managed scan types through the Amazon Inspector console or API.
Note that this locks out the delegated administrator too. If this is your situation, no amount of update-configuration will ever work, and the fix lives in the Organizations console.
c) Scan mode is admin-owned. Per Scanning Amazon EC2 instances: "Standalone accounts or Amazon Inspector delegated administrators can change the scan mode. When you set the scan mode as the Amazon Inspector delegated administrator that scan mode is set for all member accounts in your organization." Since scanMode is a required member of Ec2Configuration, a member account can't submit a valid partial update — you can't send activateVMScanner without also asserting a scanMode you may not be allowed to set.
Find out which one you're in
# Is there a delegated admin, and is it you? aws inspector2 get-delegated-admin-account aws inspector2 describe-organization-configuration # What does this specific account actually have enabled? aws inspector2 batch-get-account-status --account-ids <your-account-id>
Then re-run the disable with the scope made explicit. As delegated admin, target the account directly instead of relying on propagation:
aws inspector2 update-configuration \ --account-id <target-account-id> \ --ec2-configuration '{"scanMode":"EC2_SSM_AGENT_BASED","activateVMScanner":false}'
If the account was individually configured and you want it back under admin control, there's a dedicated parameter for that — it's newer and not widely known:
aws inspector2 update-configuration \ --account-id <target-account-id> \ --update-configuration-inheritance '{"ec2Configuration":"INHERIT_FROM_ADMIN"}'
--update-configuration-inheritance must be sent without --ec2-configuration, and requires --account-id.
The field you haven't reported yet
VMScannerState has three members, not two: activated, activatedAt, and status — valid values SUCCESS | PENDING | FAILED (API_VMScannerState). You've quoted activated and activatedAt but not status. Please post it:
aws inspector2 get-configuration --query 'ec2Configuration.vmScannerState'
PENDING means a transition is queued and you're reading it too early. FAILED means a deactivation was attempted and broke, which is a different conversation and probably a Support case. SUCCESS alongside the original activatedAt confirms the write never reached this record, i.e. one of (a)/(b)/(c).
One mundane thing to rule out while you're there: Inspector configuration is per-Region. Confirm the --region on your CLI call matches the Region of the console page and the instances. A 200 from the wrong Region looks identical to a 200 that did nothing.
On CloudTrail
The other answer's CloudTrail question is worth following, but widen it. Don't just confirm your own UpdateConfiguration was recorded — look for subsequent UpdateConfiguration events from the delegated admin or from Organizations policy enforcement re-applying the config after yours. If something is putting the setting back, that's where you'll see it.
Where I disagree with the other answer on memory
As far as I know, there are no settings to limit MemoryMax.
Correct that Inspector exposes no memory cap. But Advanced configuration documents four resource controls plus scan-scope controls, and two of them bear directly on your peaks:
--scan-timeout— by default the scanner does not time out. On your CI host at 1.7 GB that unbounded runtime is a large part of the problem.--cpu-limit— hard CPU cap, default 65%, Linux cgroups.--nice-priority— default 3.--max-scan-depth— directory levels traversed per scan location; the sample config ships5.--target-directory— extra paths. Worth auditing: if anything added non-default paths on the CI host, that's your 1.7 GB.
Set these in the config file rather than as flags, since the SSM association controls invocation and your flags won't survive it. The scanner reads a TOML file by default at /opt/aws/inspector/etc/config on Linux/macOS:
scan-timeout = 300 log-level = "INFO" [sbom] max-scan-depth = 3
Adding the memory cap yourself
AWS explicitly endorses systemctl edit as the update-safe override path for this unit family, in the same doc:
Do not edit the unit files in
/usr/lib/systemd/system/directly. Package updates overwrite those files. Usesystemctl editinstead, which creates a persistent override that survives updates.
The docs show that for inspector-vm-scanner.timer. Applying it to the .service unit is standard systemd drop-in behaviour rather than something AWS documents explicitly — flagging that distinction honestly — but it's the same mechanism and it survives package updates for the same reason:
sudo systemctl edit inspector-vm-scanner.service
[Service] MemoryHigh=192M MemoryMax=256M
sudo systemctl daemon-reload
The important part isn't the number, it's who dies. Right now the scanner grows unbounded, the kernel OOM killer picks a victim by badness score, and on your t3a.micro it chose to take out systemd-networkd mid-DHCP-renewal — which is why you lost the address and the box became unusable. With MemoryMax on the scanner's own cgroup, the kill is contained to the scanner: the unit dies, the host keeps its network, and the failure is a missing scan instead of a dead instance. MemoryHigh throttles and reclaims before the hard cap, so you'll often get a slow scan rather than a killed one.
Given your measured 194–330 MB on minimal hosts, MemoryMax=256M will kill scans on some of them. That's the trade you want on a 1 GiB host, but size it against your own numbers rather than mine.
What I'd actually do right now, in order
1. Exclusion tags on the small instances. This is the supported, documented way to take specific instances out of scope without fighting the account configuration, and it works regardless of who owns the config. Tag the instance with key InspectorEc2Exclusion (case-insensitive, value optional).
One catch that is easy to overlook, and it undoes the fix if you do, from scanning-ec2.html: "When you tag an instance for exclusion from Amazon Inspector scans, Amazon Inspector marks the instance as excluded and won't create findings for it. However, the Amazon Inspector SSM plugin will continue to be invoked. To prevent the plugin from being invoked, you must allow access to tags in instance metadata." So enable instance metadata tag access, or the agent keeps running and you've fixed the billing but not the OOM. Excluded instances are also not charged.
2. The systemd memory cap above, as the fleet-wide safety net so no host can be taken down by the scanner again.
3. Stop the periodic runs locally where you need immediate relief — documented under "Enable or disable automatic execution":
sudo systemctl disable --now inspector-vm-scanner.timer
Treat this as temporary. The InspectorVmScannerDistributor-do-not-delete SSM association exists specifically to install and update the scanner, and the docs state Inspector recreates deleted SSM resources at the next scan interval. Whether it also re-enables a disabled timer isn't documented and I haven't tested it — so verify it's still disabled after a few association intervals before you rely on it.
4. Then pursue the account-level disable via the scope-corrected commands above, or the Organizations policy if you're in case (b).
On the documentation gap
You're right to call this out, and it is a real gap rather than something you missed. The uninstall page asserts "If you disable Enhanced EC2 Scanning, Inspector automatically uninstalls Inspector VM Scanner on all Inspector-managed instances" but no page documents where that disable lives. Meanwhile the two enablement pages don't even agree on the console path — Enabling Inspector VM Scanner says Account management > EC2 scanning > Edit, while Scanning Amazon EC2 instances says Settings > Scan Settings > Start Upgrade. "Start Upgrade" reads like a one-way door, and combined with a console that offers no off switch, I'd expect a lot of people to hit this.
Both of those are worth raising: use the Provide feedback link on those doc pages for the gap, and your AWS account team or a Support case for the MemoryMax ask, since a scanner with no memory bound that can OOM a 1 GiB instance into losing its network is a legitimate service-quality report, not a feature request. Your measured RSS figures across host classes and the SSM-plugin comparison at ~33 MB are exactly the evidence that makes that land.
Please post back your vmScannerState.status and whether get-delegated-admin-account returns an admin. Those two answers will tell us immediately which of the three scopes you're stuck in.
answered 2 months ago
Relevant content
asked 5 years ago
asked 2 years ago
asked 2 years ago
