

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 Amazon Inspector 掃描 Windows EC2 執行個體
<a name="windows-scanning"></a>

 Amazon Inspector 會自動探索所有支援的Windows執行個體，並將它們包含在連續掃描中，而不需要任何額外的動作。如需支援哪些執行個體的詳細資訊，請參閱 [Amazon Inspector 支援的作業系統和程式設計語言](https://docs.aws.amazon.com/inspector/latest/user/supported.html)。Amazon Inspector 會定期執行Windows掃描。 Windows執行個體會在探索時掃描，然後每 6 小時掃描一次。不過，您可以在第一次[掃描後調整預設掃描間隔](https://docs.aws.amazon.com/inspector/latest/user/windows-scanning.html#windows-scan-schedule)。

 啟用 Amazon EC2 掃描時，Amazon Inspector 會為您的Windows資源建立下列 SSM 關聯：`InspectorDistributor-do-not-delete`、 `InspectorInventoryCollection-do-not-delete`和 `InvokeInspectorSsmPlugin-do-not-delete`。若要在您的Windows執行個體上安裝 Amazon Inspector SSM 外掛程式，`InspectorDistributor-do-not-delete`SSM 關聯會使用 [`AWS-ConfigureAWSPackage` SSM 文件](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html)和 [`AmazonInspector2-InspectorSsmPlugin` SSM Distributor 套件](https://docs.aws.amazon.com/systems-manager/latest/userguide/distributor.html)。如需詳細資訊，請參閱[適用於 的 Amazon Inspector SSM 外掛程式Windows](https://docs.aws.amazon.com/inspector/latest/user/deep-inspection.html#inspector/latest/user/deep-inspection.html)。為了收集執行個體資料並產生 Amazon Inspector 調查結果，`InvokeInspectorSsmPlugin-do-not-delete`SSM 關聯會每隔 6 小時執行 Amazon Inspector SSM 外掛程式。不過，您可以使用 [Cron 或 Rate 表達式來自訂此設定](https://docs.aws.amazon.com/systems-manager/latest/userguide/reference-cron-and-rate-expressions.html)。

**注意**  
 Amazon Inspector 階段將開放漏洞和評估語言 (OVAL) 定義檔案更新為 S3 儲存貯體 `inspector2-oval-prod-{{your-AWS-Region}}`。Amazon S3 儲存貯體包含用於掃描的 OVAL 定義。不應修改這些 OVAL 定義。否則，Amazon Inspector 不會在新 CVEs發行時對其進行掃描。

## Windows 執行個體的 Amazon Inspector 掃描需求
<a name="windows-requirements"></a>

若要掃描Windows執行個體，Amazon Inspector 需要執行個體符合下列條件：
+ 執行個體是 SSM 受管執行個體。如需設定執行個體進行掃描的指示，請參閱 [設定 SSM 代理程式](scanning-ec2.md#configure-ssm)。
+ 執行個體作業系統是支援的Windows作業系統之一。如需支援作業系統的完整清單，請參閱 [Amazon EC2 執行個體狀態值支援的作業系統：Amazon EC2 掃描](supported.md#supported-os-ec2)。
+ 執行個體已安裝 Amazon Inspector SSM 外掛程式。Amazon Inspector 會在發現受管執行個體時自動安裝 Amazon Inspector SSM 外掛程式。如需外掛程式的詳細資訊，請參閱下一個主題。

**注意**  
如果您的主機是在沒有傳出網際網路存取的 Amazon VPC 中執行，Windows掃描需要您的主機能夠存取區域 Amazon S3 端點。若要了解如何設定 Amazon S3 Amazon VPC 端點，請參閱《*Amazon Virtual Private Cloud 使用者指南*》中的[建立閘道端點](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html#create-gateway-endpoint-s3)。如果您的 Amazon VPC 端點政策限制對外部 S3 儲存貯體的存取，您必須特別允許存取 中 Amazon Inspector 維護的儲存貯體 AWS 區域 ，該儲存貯體存放用於評估執行個體的 OVAL 定義。此儲存貯體的格式如下：`inspector2-oval-prod-{{REGION}}`。

## 設定Windows執行個體掃描的自訂排程
<a name="windows-scan-schedule"></a>

您可以使用 SSM 為`InvokeInspectorSsmPlugin-do-not-delete`關聯設定 Cron 表達式或 Rate 表達式，來自訂 Windows Amazon EC2 執行個體掃描之間的時間。如需詳細資訊，請參閱*AWS Systems Manager 《 使用者指南*》中的[參考：Systems Manager 的 Cron 和 Rate 表達](https://docs.aws.amazon.com/systems-manager/latest/userguide/reference-cron-and-rate-expressions.html)式，或使用下列指示。

從下列程式碼範例中選取，使用速率表達式或 Cron 表達式，將Windows執行個體的掃描節奏從預設的 6 小時變更為 12 小時。

下列範例需要您將 **AssociationId** 用於名為 的關聯`InvokeInspectorSsmPlugin-do-not-delete`。您可以執行下列 AWS CLI 命令來擷取 **AssociationId**：

```
$ aws ssm list-associations --association-filter-list "key=AssociationName,value=InvokeInspectorSsmPlugin-do-not-delete" --region {{us-east-1}}
```

**注意**  
**AssociationId** 是區域性的，因此您需要先擷取每個 的唯一 ID AWS 區域。然後，您可以執行 命令來變更要為Windows執行個體設定自訂掃描排程的每個區域中的掃描節奏。

------
#### [ Example rate expression ]

```
$ aws ssm update-association \
--association-id "{{YourAssociationId}}" \
--association-name "InvokeInspectorSsmPlugin-do-not-delete" \
--schedule-expression "rate(12 hours)"
```

------
#### [ Example cron expression ]

```
$ aws ssm update-association \
--association-id "{{YourAssociationId}}" \
--association-name "InvokeInspectorSsmPlugin-do-not-delete" \
--schedule-expression "cron(0 0/12 * * ? *)"
```

------