

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

# AWS Shield
<a name="automation-ref-shd"></a>

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

**Topics**
+ [`AWSPremiumSupport-DDoSResiliencyAssessment`](automation-aws-ddosresiliencyassessment.md)

# `AWSPremiumSupport-DDoSResiliencyAssessment`
<a name="automation-aws-ddosresiliencyassessment"></a>

 **描述** 

 AWS Systems Manager 自动化运行手册可帮助您根据 AWS Shield Advanced 保护措施检查 DDo S 漏洞和资源配置。`AWSPremiumSupport-DDoSResiliencyAssessment` AWS 账户它为易受分布式拒绝服务 (DDoS) 攻击的资源提供配置设置报告。它用于收集、分析和评估以下资源：Amazon Route 53、Amazon 负载均衡器、Amazon CloudFront 分配 AWS Global Accelerator 和 AWS Elastic， IPs 用于根据推荐的 AWS Shield Advanced 保护最佳实践进行配置设置。最终配置报告将以 HTML 文件形式在您选择的 Amazon S3 存储桶中提供。

 **如何工作？** 

本运行手册包含一系列检查，用于检查允许公开访问的各种类型的资源，以及它们是否按照 [AWS DDoS 最佳实践白皮](https://docs.aws.amazon.com//pdfs/whitepapers/latest/aws-best-practices-ddos-resiliency/aws-best-practices-ddos-resiliency.pdf)书中的建议配置了保护措施。运行手册将执行以下操作：
+ 检查订阅 AWS Shield Advanced 是否已启用。
+ 如果已启用，它会查找是否有任何受 Shield Advanced 保护资源。
+ 它会在 AWS 账户 中查找所有全球和区域资源，并检查这些资源是否受到 Shield 保护。
+ 它需要用于评估的资源类型参数、Amazon S3 存储桶名称和 Amazon S3 存储桶 AWS 账户 ID (S3BucketOwner)。
+ 它以 HTML 报告的形式返回调查发现，该报告存储在提供的 Amazon S3 存储桶中。

输入参数 `AssessmentType` 决定是否对所有资源进行检查。默认情况下，运行手册会检查是否有所有类型的资源。如果只选择了 `GlobalResources` 或 `RegionalResources` 参数，运行手册将仅对选定资源类型执行检查。

**重要**  
访问`AWSPremiumSupport-*`运行手册需要订阅 Business \$1 Support、Enterprise Support 或统一运营订阅。有关更多信息，请参阅[比较 AWS 支持 计划](https://aws.amazon.com/premiumsupport/plans/)。
此运行手册需要 `ACTIVE`[AWS Shield Advanced 订阅。](https://docs.aws.amazon.com/waf/latest/developerguide/enable-ddos-prem.html)

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

**文档类型**

自动化

**所有者**

Amazon

**平台**

Linux、macOS、Windows

**参数**
+ AutomationAssumeRole

  类型：字符串

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

  类型：字符串

  描述：（可选）确定 DDo S 弹性评估要评估的资源类型。默认情况下，运行手册将评估全局和区域资源。对于区域资源，运行手册描述了所有应用程序 (ALB) 和网络 (NLB) 负载均衡器，以及您的 AWS 账户/区域的所有 Auto Scaling 组。

  有效值：`['Global Resources', 'Regional Resources', 'Global and Regional Resources']`

  默认：全球和区域资源
+ S3 BucketName

  类型：`AWS::S3::Bucket::Name`

  描述：（必需）要将报告上传到的 Amazon S3 存储桶名称。

  允许的模式：`^[0-9a-z][a-z0-9\-\.]{3,63}$`
+ S3 BucketOwnerAccount

  类型：字符串

  描述：（可选）拥有 Amazon S3 存储桶的。 AWS 账户 如果 Amazon S3 存储桶属于不同的存储桶，请指定此参数 AWS 账户，否则您可以将此参数留空。

  允许的模式：`^$|^[0-9]{12,13}$`
+ S3 BucketOwnerRoleArn

  类型：`AWS::IAM::Role::Arn`

  描述：（可选）具有描述 Amazon S3 存储桶和 AWS 账户 阻止公有访问配置的权限的 IAM 角色的 ARN（如果存储桶位于其他存储桶中）。 AWS 账户如果未指定此参数，运行手册将使用 `AutomationAssumeRole` 或启动此运行手册的 IAM 用户（如果 `AutomationAssumeRole` 未指定）。请参阅运行手册描述中的“所需权限”部分。

  允许的模式：`^$|^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):iam::[0-9]{12,13}:role/.*$`
+ S3 BucketPrefix

  类型：字符串

  描述：（可选）Amazon S3 内用于存储结果的路径的前缀。

  允许的模式：`^[a-zA-Z0-9][-./a-zA-Z0-9]{0,255}$|^$`

**所需的 IAM 权限**

`AutomationAssumeRole` 参数需要执行以下操作才能成功使用运行手册。
+ `autoscaling:DescribeAutoScalingGroups`
+ `cloudfront:ListDistributions`
+ `ec2:DescribeAddresses`
+ `ec2:DescribeNetworkAcls`
+ `ec2:DescribeInstances`
+ `elasticloadbalancing:DescribeLoadBalancers`
+ `elasticloadbalancing:DescribeTargetGroups`
+ `globalaccelerator:ListAccelerators`
+ `iam:GetRole`
+ `iam:ListAttachedRolePolicies`
+ `route53:ListHostedZones`
+ `route53:GetHealthCheck`
+ `shield:ListProtections`
+ `shield:GetSubscriptionState`
+ `shield:DescribeSubscription`
+ `shield:DescribeEmergencyContactSettings`
+ `shield:DescribeDRTAccess`
+ `waf:GetWebACL`
+ `waf:GetRateBasedRule`
+ `wafv2:GetWebACL`
+ `wafv2:GetWebACLForResource`
+ `waf-regional:GetWebACLForResource`
+ `waf-regional:GetWebACL`
+ `s3:ListBucket`
+ `s3:GetBucketAcl`
+ `s3:GetBucketLocation`
+ `s3:GetBucketPublicAccessBlock`
+ `s3:GetBucketPolicyStatus`
+ `s3:GetBucketEncryption`
+ `s3:GetAccountPublicAccessBlock`
+ `s3:PutObject`

 **自动化承担角色的 IAM policy 示例** 

------
#### [ JSON ]

****  

```
                {
                        "Version":"2012-10-17",		 	 	 
                        "Statement": [
                            {
                                "Action": [
                                    "s3:ListBucket",
                                    "s3:GetBucketAcl",
                                    "s3:GetAccountPublicAccessBlock"
                                ],
                                "Resource": "*",
                                "Effect": "Allow"
                            },
                            {
                                "Action": [
                                    "s3:ListBucket",
                                    "s3:GetBucketAcl",
                                    "s3:GetBucketLocation",
                                    "s3:GetBucketPublicAccessBlock",
                                    "s3:GetBucketPolicyStatus",
                                    "s3:GetEncryptionConfiguration"
                                ],
                                "Resource": "arn:aws:s3:::<bucket-name>",
                                "Effect": "Allow"
                            },
                            {
                                "Action": [
                                    "s3:PutObject"
                                ],
                                "Resource": "arn:aws:s3:::<bucket-name>/*",
                                "Effect": "Allow"
                            },
                            {
                                "Action": [
                                    "autoscaling:DescribeAutoScalingGroups",
                                    "cloudfront:ListDistributions",
                                    "ec2:DescribeInstances",
                                    "ec2:DescribeAddresses",
                                    "ec2:DescribeNetworkAcls",
                                    "elasticloadbalancing:DescribeLoadBalancers",
                                    "elasticloadbalancing:DescribeTargetGroups",
                                    "globalaccelerator:ListAccelerators",
                                    "iam:GetRole",
                                    "iam:ListAttachedRolePolicies",
                                    "route53:ListHostedZones",
                                    "route53:GetHealthCheck",
                                    "shield:ListProtections",
                                    "shield:GetSubscriptionState",
                                    "shield:DescribeSubscription",
                                    "shield:DescribeEmergencyContactSettings",
                                    "shield:DescribeDRTAccess",
                                    "waf:GetWebACL",
                                    "waf:GetRateBasedRule",
                                    "wafv2:GetWebACL",
                                    "wafv2:GetWebACLForResource",
                                    "waf-regional:GetWebACLForResource",
                                    "waf-regional:GetWebACL"
                                ],
                                "Resource": "*",
                                "Effect": "Allow"
                            },
                            {
                                "Action": "iam:PassRole",
                                "Resource": "arn:aws:iam::111122223333:role/automation-assume-role-name",
                                "Effect": "Allow"
                            }
                        ]
                    }
```

------

 **说明** 

1. 导航到 AWS Systems Manager 控制台[AWSPremiumSupport-DDoSResiliencyAssessment](https://console.aws.amazon.com/systems-manager/automation/execute/AWSPremiumSupport-DDoSResiliencyAssessment)中的。

1. 选择 **Execute automation**（执行自动化）

1. 要输入参数，请输入内容：
   + **AutomationAssumeRole（可选）：**

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

     确定要为 DDo S 弹性评估评估的资源类型。默认情况下，运行手册会评价全球和区域资源。
   + **S3BucketName（必填）：**

     要将评估报告保存为 HTML 格式的 Amazon S3 存储桶的名称。
   + **S3BucketOwner（可选）：**

     用于所有权验证的 Amazon S3 存储桶的 AWS 账户 ID。如果报告需要发布到跨账户 Amazon S3 存储桶，则需要提供 AWS 账户 ID；如果 Amazon S3 存储桶与自动启动 AWS 账户 相同，则为可选。
   + **S3BucketPrefix（可选）：**

     Amazon S3 内用于存储结果的路径的前缀。  
![\[Input parameters form for AWS Systems Manager Automation with fields for role, resources, and S3 bucket settings.\]](http://docs.aws.amazon.com/zh_cn/systems-manager-automation-runbooks/latest/userguide/images/premsupport-ddos-resiliency-assessment_input_parameters.png)

1. 选择**执行**。

1. 自动化启动。

1. 文档将执行以下步骤：
   + **CheckShieldAdvancedState:**

     验证是否已订阅 AWS Shield Advanced 以及运行手册是否有权访问 Amazon S3 存储桶。 AWS 账户 
   + **S3BucketSecurityChecks：**

     检查 “S3BucketName” 中指定的 Amazon S3 存储桶是否允许匿名或公开读取或写入访问权限，该存储桶是否启用了静态加密，以及 “S3BucketOwner” 中提供的 AWS 账户 ID 是否是 Amazon S3 存储桶的所有者。
   + **BranchOnShieldAdvancedStatus:**

     分支机构根据 AWS Shield Advanced 订阅状态 and/or Amazon S3 存储桶所有权状态记录步骤。
   + **ShieldAdvancedConfigurationReview:**

     审查 Shield Advanced 配置以确保存在最低限度的必要详情。例如： AWS Shield 响应小组 (SRT) 团队的 IAM 访问权限、联系人列表详细信息和 SRT 主动参与状态。
   + **ListShieldAdvancedProtections:**

     列出受 Shield 保护的资源，并为每个服务创建一组受保护的资源。
   + **BranchOnResourceTypeAndCount:**

     根据资源类型参数的值和受 Shield 保护的全球资源的数量对文档步骤进行分支。
   + **ReviewGlobalResources:**

     查看 Shield Advanced 受保护的全球资源，例如 Route 53 托管区域、 CloudFront 分布和全球加速器。
   + **BranchOnResourceType:**

     根据资源类型选择对文档记录进行分支（如果是全球、区域或两者）。
   + **ReviewRegionalResources:**

     查看 Shield Advanced 受保护的区域资源，例如应用程序负载均衡器、网络负载均衡器、经典负载均衡器、亚马逊弹性计算云 (Amazon EC2) 实例（弹性）。 IPs
   + **SendReportToS3：**

     将 DDo S 评估报告的详细信息上传到 Amazon S3 存储桶。

1. 完成后，将在 Amazon S3 存储桶中提供评估报告 HTML 文件的 URI：

   **运行手册成功执行后该报告的 S3 控制台链接和 Amazon S3 URI**  
![\[Execution status showing successful completion with 9 steps executed and no failures.\]](http://docs.aws.amazon.com/zh_cn/systems-manager-automation-runbooks/latest/userguide/images/premsupport-ddos-resiliency-assessment_outputs.png)

 **参考** 

Systems Manager Automation
+ [运行此自动化（控制台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWSPremiumSupport-DDoSResiliencyAssessment)
+ [运行自动化](https://docs.aws.amazon.com//systems-manager/latest/userguide/automation-working-executing.html)
+ [设置自动化](https://docs.aws.amazon.com//systems-manager/latest/userguide/automation-setup.html)
+ [支持自动化工作流登录页面](https://aws.amazon.com/premiumsupport/technology/saw/)

AWS 服务文档
+ [AWS Shield Advanced](https://docs.aws.amazon.com//waf/latest/developerguide/ddos-advanced-summary.html)