

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

# `AWS-PatchInstanceWithRollback`
<a name="automation-aws-patchinstancewithrollback"></a>

**Description**

使 EC2 執行個體符合適用的修補程式基準。在失敗時復原根磁碟區。

[執行此自動化 （主控台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-PatchInstanceWithRollback)

**文件類型**

 自動化

**擁有者**

Amazon

**平台**

Linux、macOS、 Windows

**參數**
+ AutomationAssumeRole

  類型：字串

  描述：（選用） 允許 Systems Manager Automation 代表您執行動作的 (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN)。如果未指定角色，Systems Manager Automation 會使用啟動此 Runbook 的使用者許可。
+ InstanceId

  類型：字串

  描述：(必要) 套用修補程式基準的 EC2 InstanceId。
+ LambdaAssumeRole

  類型：字串

  描述：(選用) 角色的 ARN，允許由自動化建立的 Lambda 代您執行動作。如果未指定，則會建立暫時性角色來執行 Lambda 函數。
+ ReportS3Bucket

  類型：字串

  描述：（選用） 程序期間產生的合規報告的 Amazon S3 儲存貯體目的地。

**文件步驟**


****  

| 步驟號碼 | 步驟名稱 | 自動化動作 | 
| --- | --- | --- | 
| 1 | createDocumentStack | `aws:createStack` | 
| 2 | IdentifyRootVolume | `aws:invokeLambdaFunction` | 
| 3 | PrePatchSnapshot | `aws:executeAutomation` | 
| 4 | installMissingUpdates | `aws:runCommand` | 
| 5 | SleepThruInstallation | `aws:invokeLambdaFunction` | 
| 6 | CheckCompliance | `aws:invokeLambdaFunction` | 
| 7 | SaveComplianceReportToS3 | `aws:invokeLambdaFunction` | 
| 8 | ReportSuccessOrFailure | `aws:invokeLambdaFunction` | 
| 9 | RestoreFromSnapshot | `aws:invokeLambdaFunction` | 
| 10 | DeleteSnapshot | `aws:invokeLambdaFunction` | 
| 11 | deleteCloudFormationTemplate | `aws:deleteStack` | 

**輸出**

IdentifyRootVolume.Payload

PrePatchSnapshot.Output

SaveComplianceReportToS3.Payload

RestoreFromSnapshot.Payload

CheckCompliance.Payload