

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# CloudFormation
<a name="automation-ref-cfn"></a>

 AWS Systems Manager 自动化为用户提供了预定义的运行手册。 AWS CloudFormation有关运行手册的更多信息，请参阅[使用运行手册](https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-documents.html)。有关如何查看运行手册内容的信息，请参阅 [查看运行手册内容](automation-runbook-reference.md#view-automation-json)。

**Topics**
+ [`AWS-DeleteCloudFormationStack`](automation-aws-deletecloudformationstack.md)
+ [`AWS-EnableCloudFormationSNSNotification`](AWS-EnableCloudFormationStackSNSNotification.md)
+ [`AWS-RunCfnLint`](automation-aws-runcfnlint.md)
+ [`AWSSupport-TroubleshootCFNCustomResource`](automation-awssupport-TroubleshootCFNCustomResource.md)
+ [`AWS-UpdateCloudFormationStack`](automation-aws-updatecloudformationstack.md)

# `AWS-DeleteCloudFormationStack`
<a name="automation-aws-deletecloudformationstack"></a>

 **描述** 

删除 CloudFormation 堆栈。

 [运行此自动化（控制台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-DeleteCloudFormationStack) 

**文档类型**

自动化

**所有者**

Amazon

**平台**

Linux、macOS、Windows

**参数**
+ AutomationAssumeRole

  类型：字符串

  描述：（可选）允许 Systems Manager Automation 代表您执行操作 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称（ARN）。如果未指定角色，Systems Manager Automation 将使用启动此运行手册的用户的权限。
+ StackNameOrId

  类型：字符串

  描述：（必填）要删除的 CloudFormation 堆栈的名称或唯一 ID

# `AWS-EnableCloudFormationSNSNotification`
<a name="AWS-EnableCloudFormationStackSNSNotification"></a>

 **描述** 

 `AWS-EnableCloudFormationSNSNotification`运行手册为您指定的 () 堆栈启用亚马逊简单通知服务 (Amazon SNS) Simple Notification Service 通知。 AWS CloudFormation CloudFormation

 [运行此自动化（控制台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-EnableCloudFormationStackSNSNotification) 

**文档类型**

自动化

**所有者**

Amazon

**平台**

Linux，macOS, Windows

**参数**
+ AutomationAssumeRole

  类型：字符串

  描述：（可选）允许 Systems Manager Automation 代表您执行操作 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称（ARN）。如果未指定角色，Systems Manager Automation 将使用启动此运行手册的用户的权限。
+ StackArn

  类型：字符串

  描述：（必填）您要为其启用 Amazon SNS 通知的 CloudFormation 堆栈的 ARN 或名称。
+ NotificationArn

  类型：字符串

  描述：（必填）您要与堆栈关联的 Amazon SNS 主题的 ARN。 CloudFormation 

**所需的 IAM 权限**

`AutomationAssumeRole` 参数需要执行以下操作才能成功使用运行手册。
+ ssm：GetAutomationExecution
+ ssm：StartAutomationExecution
+ 云层：DescribeStacks
+ 云层：UpdateStack
+ kms:Decrypt
+ kms: GenerateDataKey
+ sns:Publish
+ sqs: GetQueueAttributes

 **文档步骤** 
+ CheckCfnSnsLimits (`aws:executeScript`)-验证尚未与您指定的堆栈关联的 Amazon SNS 主题的最大数量。 CloudFormation 
+ EnableCfnSnsNotification (`aws:executeAwsApi`)-为堆栈启用 Amazon SNS 通知。 CloudFormation 
+ VerificationCfnSnsNotification (`aws:executeScript`)-验证是否已为堆栈启用 Amazon SNS 通知。 CloudFormation 

 **输出** 

CheckCfnSnsLimits。 NotificationArnList -接收堆栈 ARNs 的 Amazon SNS 通知的 CloudFormation 人员名单。

VerificationCfnSnsNotification。 VerifySnsTopicsResponse -来自 API 操作的响应，确认已为堆栈启用 Amazon SNS 通知。 CloudFormation 

# `AWS-RunCfnLint`
<a name="automation-aws-runcfnlint"></a>

 **描述** 

 本运行手册使用 [AWS CloudFormation Linter](https://github.com/aws-cloudformation/cfn-python-lint) (`cfn-python-lint`) 根据资源规范验证 YAML 和 JSON 模板。 CloudFormation `AWS-RunCfnLint` 运行手册执行其他检查，例如确保为资源属性输入了有效的值。如果验证失败，`RunCfnLintAgainstTemplate` 步骤将失败，并且在错误消息中提供 linter 工具的输出。此运行手册使用 cfn-lint v0.24.4。

 [运行此自动化（控制台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-RunCfnLint) 

**文档类型**

自动化

**所有者**

Amazon

**平台**

Linux，macOS, Windows

**参数**
+ AutomationAssumeRole

  类型：字符串

  描述：（可选）允许 Systems Manager Automation 代表您执行操作 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称（ARN）。如果未指定角色，Systems Manager Automation 将使用启动此运行手册的用户的权限。
+ ConfigureRuleFlag

  类型：字符串

   描述：（可选）要传递给 `--configure-rule` 参数的规则的配置选项。

  示例：E2001:strict=false,E3012:strict=false。
+ FormatFlag

  类型：字符串

   描述：（可选）传递给 `--format` 参数以指定输出格式的值。

  有效值：Default \$1 quiet \$1 parseable \$1 json

  默认：Default
+ IgnoreChecksFlag

  类型：字符串

  描述：（可选） IDs 要传递给--ignore-checks 参数的规则。不会检查这些规则。

  示例：E1001,E1003,W7001
+ IncludeChecksFlag

  类型：字符串

   描述：（可选） IDs 要传递给`--include-checks`参数的规则。将检查这些规则。

  示例：E1001,E1003,W7001
+ InfoFlag

  类型：字符串

   描述：（可选）`--info` 参数的选项。包括启用有关模板处理的其他日志记录信息的选项。

  默认：false
+ TemplateFileName

  类型：字符串

  描述：S3 存储桶中的模板文件的名称或键。
+ 模板3 BucketName

  类型：字符串

  描述：包含 Packer 模板的 S3 存储桶的名称。
+ RegionsFlag

  类型：字符串

   描述：（可选）要传递给 for `--regions` 参数的值，用于对照指定测试模板 AWS 区域。

  示例：us-east-1,us-west-1

 **文档步骤** 

 RunCfnLintAgainstTemplate — 针对指定的 CloudFormation 模板运行该`cfn-python-lint`工具。

 **输出** 

 RunCfnLintAgainstTemplate.output — 工具中的标准输出。`cfn-python-lint`

# `AWSSupport-TroubleshootCFNCustomResource`
<a name="automation-awssupport-TroubleshootCFNCustomResource"></a>

 **描述** 

 `AWSSupport-TroubleshootCFNCustomResource` 运行手册可帮助诊断 AWS CloudFormation 堆栈在创建、更新或删除自定义资源时失败的原因。运行手册将检查用于自定义资源的服务令牌以及返回的错误消息。在查看自定义资源的详细信息之后，运行手册的输出会解释该自定义资源的堆栈行为和故障排除步骤。

 [运行此自动化（控制台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWSSupport-TroubleshootCFNCustomResource) 

**文档类型**

自动化

**所有者**

Amazon

**平台**

Linux，macOS, Windows

**参数**
+ AutomationAssumeRole

  类型：字符串

  描述：（可选）允许 Systems Manager Automation 代表您执行操作 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称（ARN）。如果未指定角色，Systems Manager Automation 将使用启动此运行手册的用户的权限。
+ StackName

  类型：字符串

  描述：（必填）自定义资源失败的 CloudFormation 堆栈的名称。

**所需的 IAM 权限**

`AutomationAssumeRole` 参数需要执行以下操作才能成功使用运行手册。
+  `cloudformation:DescribeStacks` 
+  `cloudformation:DescribeStackEvents` 
+  `cloudformation:ListStackResources` 
+  `ec2:DescribeRouteTables` 
+  `ec2:DescribeNatGateways` 
+  `ec2:DescribeSecurityGroups` 
+  `ec2:DescribeVpcs` 
+  `ec2:DescribeVpcEndpoints` 
+  `ec2:DescribeSubnets` 
+  `logs:FilterLogEvents` 

 **文档步骤** 
+  `validateCloudFormationStack`-验证 CloudFormation 堆栈是否存在于同一个 AWS 账户 和 AWS 区域中。
+  `checkCustomResource`-分析 CloudFormation 堆栈，检查失败的自定义资源，并输出有关如何对失败的自定义资源进行故障排除的信息。

# `AWS-UpdateCloudFormationStack`
<a name="automation-aws-updatecloudformationstack"></a>

 **描述** 

使用存储在 Amazon S3 存储桶中的 CloudFormation 模板更新 AWS CloudFormation 堆栈。

 [运行此自动化（控制台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-UpdateCloudFormationStack) 

**文档类型**

自动化

**所有者**

Amazon

**平台**

Linux、macOS、Windows

**参数**
+ AutomationAssumeRole

  类型：字符串

  描述：（可选）允许 Systems Manager Automation 代表您执行操作 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称（ARN）。如果未指定角色，Systems Manager Automation 将使用启动此运行手册的用户的权限。
+ LambdaAssumeRole

  类型：字符串

  说明：（必需）Lambda 担任角色的 ARN
+ StackNameOrId

  类型：字符串

  描述：（必填）待更新的 CloudFormation 堆栈的名称或唯一 ID
+ TemplateUrl

  类型：字符串

   描述：（必填）包含更新 CloudFormation 模板的 S3 存储桶位置（例如 `https://s3.amazonaws.com/amzn-s3-demo-bucket2/updated.template)` 