

# 基础设施保护
<a name="a-infrastructure-protection"></a>

**Topics**
+ [SEC 5  如何保护您的网络资源？](w2aac19b7c11b5.md)
+ [SEC 6  如何保护计算资源？](w2aac19b7c11b7.md)

# SEC 5  如何保护您的网络资源？
<a name="w2aac19b7c11b5"></a>

任何以某种形式连接至网络的工作负载（互联网或私有网络）都需要多层防御，以帮助防御基于外部和内部网络的威胁。

**Topics**
+ [SEC05-BP01 创建网络层](sec_network_protection_create_layers.md)
+ [SEC05-BP02 控制所有层的流量](sec_network_protection_layered.md)
+ [SEC05-BP03 自动执行网络防护](sec_network_protection_auto_protect.md)
+ [SEC05-BP04 实施检查和保护](sec_network_protection_inspection.md)

# SEC05-BP01 创建网络层
<a name="sec_network_protection_create_layers"></a>

 将具有相同可访问性需求的组件分组为若干层。例如，应将虚拟私有云（VPC）中无需进行互联网访问的数据库集群，放在无法向/从互联网路由的子网中。在不使用 VPC 操作的无服务器工作负载中，使用微服务进行类似的分层和隔离可实现相同目的。 

具有相同可访问性要求的组件（例如 Amazon Elastic Compute Cloud（Amazon EC2）实例、Amazon Relational Database Service（Amazon RDS）数据库集群和 AWS Lambda 函数）可细分为由子网构成的层。例如，应将 VPC 中无需进行互联网访问的 Amazon RDS 数据库集群放在无法向/从互联网路由的子网中。此分层控制方法可减轻单层错误配置的影响，这种错误可能允许意外访问。对于 Lambda，您可以在 VPC 中运行您的函数，以充分利用基于 VPC 的控制。

对于可能包含数千个 VPC、AWS 账户和本地网络的网络连接，您应使用 [AWS Transit Gateway](http://aws.amazon.com/transit-gateway)。它充当一个枢纽，以控制如何在类似于辐条的所有互联网络之间路由流量。Amazon Virtual Private Cloud 与 AWS Transit Gateway 之间的流量保留在 AWS 私有网络中，可减少外部威胁媒介，例如分布式拒绝服务（DDoS，Distributed Denial of Service）攻击和常见漏洞（SQL 注入、跨站点脚本、跨站点请求伪造或滥用损坏的身份验证代码等等）。AWS Transit Gateway 区域间对等连接也会对区域间流量加密，而且不会出现任何单点故障或带宽瓶颈。

 **未建立这种最佳实践的情况下暴露的风险等级：** 高 

## 实施指导
<a name="implementation-guidance"></a>
+  在 VPC 中创建子网：为每层创建子网（在包含多个可用区的组中）并关联路由表以控制路由。 
  +  [VPC 和子网 ](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html)
  +  [路由表 ](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html)

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS Firewall Manager](https://docs.aws.amazon.com/waf/latest/developerguide/fms-chapter.html) 
+ [ Amazon Inspector ](https://aws.amazon.com/inspector)
+  [Amazon VPC 安全性](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Security.html) 
+  [开始使用 AWS WAF](https://docs.aws.amazon.com/waf/latest/developerguide/getting-started.html) 

 **相关视频：** 
+  [用于各种 VPC 的 AWS Transit Gateway 参考架构 ](https://youtu.be/9Nikqn_02Oc)
+  [使用 Amazon CloudFront、AWS WAF 和 AWS Shield 提供应用程序加速和保护](https://youtu.be/0xlwLEccRe0) 

 **相关示例：** 
+  [实验室：自动部署 VPC](https://www.wellarchitectedlabs.com/Security/200_Automated_Deployment_of_VPC/README.html) 

# SEC05-BP02 控制所有层的流量
<a name="sec_network_protection_layered"></a>

  当构建您的网络拓扑时，您应检查每个组件的连接要求。例如，某个组件是否需要互联网可访问性（入站和出站）、连接到 VPC 的能力、边缘服务和外部数据中心。 

 使用 VPC，您可以使用您设置的私有 IPv4 地址范围或者 AWS 选择的 IPv6 地址范围来定义跨 AWS 区域的网络拓扑。对于入站和出站流量，您应采用深度防御方法应用多种控制，包括使用安全组（状态检测防火墙）、网络 ACL、子网和路由表。在 VPC 中，您可以在可用区中创建子网。每个子网都可以拥有一个关联的路由表，此表定义了用于管理流量在子网内所采用路径的路由规则。您可以将要连接到互联网或 NAT 网关的路由连接到 VPC 或使其经过另一个 VPC，以定义互联网可路由子网。 

 当在 VPC 内启动某个实例、Amazon Relational Database Service（Amazon RDS）数据库或其他服务时，它的每个网络接口都有自己的安全组。此防火墙位于操作系统层之外，可用于定义允许入站和出站流量的规则。您还可以定义安全组之间的关系。例如，通过参考对相关的实例应用的安全组，数据库层安全组中的实例仅接受来自应用程序层内实例的流量。除非您在使用非 TCP 协议，否则不必在以下情况下允许互联网直接访问 Amazon Elastic Compute Cloud（Amazon EC2）实例（甚至使用安全组禁止使用的端口）：没有负载均衡器或 [CloudFront](https://aws.amazon.com/cloudfront)。这样有助于防止通过操作系统或应用程序问题进行意外访问。您还可以为子网附加网络 ACL，它将用作无状态防火墙。您应配置网络 ACL 以缩小各层之间允许的流量范围，但请注意，您需要定义入站和出站规则。 

 一些 AWS 服务要求组件访问互联网进行 API 调用，其目标是 [AWS API 端点](https://docs.aws.amazon.com/general/latest/gr/rande.html) 所在的位置。另外一些 AWS 服务使用 [VPC 端点](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints.html) ，这些端点位于您的 Amazon VPC 中。很多 AWS 服务（包括 Amazon S3 和 Amazon DynamoDB）都支持 VPC 端点，并且已在 [AWS PrivateLink](https://aws.amazon.com/privatelink/)中广泛使用此技术。我们建议您使用此方法来访问 AWS 服务、第三方服务以及安全地托管在其他 VPC 中您自己的服务。AWS PrivateLink 上的所有网络流量保持在 AWS 骨干网中，永远不会通过互联网。连接只能由服务的使用方启动，不能由服务的提供方启动。为外部服务访问使用 AWS PrivateLink 让您可以创建没有互联网访问的气隙 VPC，帮助您保护 VPC 免受外部威胁因素的影响。第三方服务可以使用 AWS PrivateLink 允许其客户通过私有 IP 地址，从其 VPC 连接到服务。对于需要出站连接到互联网的 VPC 资产，可以让它们通过 AWS 托管的 NAT 网关、仅出站的互联网网关或者您创建并管理的 Web 代理进行仅出站（单向）连接。

 **未建立这种最佳实践的情况下暴露的风险等级：** 高 

## 实施指导
<a name="implementation-guidance"></a>
+  控制 VPC 中的网络流量：实施 VPC 最佳实践来控制流量。 
  +  [Amazon VPC 安全性](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Security.html) 
  +  [VPC 端点](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints.html) 
  +  [Amazon VPC 安全组](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) 
  +  [网络 ACL](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html) 
+  控制边缘站点的流量：实施边缘服务（例如 Amazon CloudFront），以提供一层额外的保护和其他功能。
  +  [Amazon CloudFront 使用案例](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/IntroductionUseCases.html) 
  +  [AWS Global Accelerator](https://docs.aws.amazon.com/global-accelerator/latest/dg/what-is-global-accelerator.html) 
  +  [AWS Web Application Firewall（AWS WAF）](https://docs.aws.amazon.com/waf/latest/developerguide/waf-section.html) 
  +  [Amazon Route 53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html) 
  +  [Amazon VPC 传入路由](https://aws.amazon.com/about-aws/whats-new/2019/12/amazon-vpc-ingress-routing-insert-virtual-appliances-forwarding-path-vpc-traffic/) 
+  控制私有网络流量：实施保护工作负载专有流量的服务。
  +  [Amazon VPC 对等连接](https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) 
  +  [Amazon VPC 端点服务（AWS PrivateLink）](https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-service.html) 
  +  [Amazon VPC Transit Gateway](https://docs.aws.amazon.com/vpc/latest/tgw/what-is-transit-gateway.html) 
  +  [AWS Direct Connect](https://docs.aws.amazon.com/directconnect/latest/UserGuide/Welcome.html) 
  +  [AWS Site-to-Site VPN](https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html) 
  +  [AWS Client VPN](https://docs.aws.amazon.com/vpn/latest/clientvpn-user/user-getting-started.html) 
  +  [Amazon S3 接入点](https://docs.aws.amazon.com/AmazonS3/latest/dev/access-points.html) 

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS Firewall Manager](https://docs.aws.amazon.com/waf/latest/developerguide/fms-section.html) 
+  [Amazon Inspector](https://aws.amazon.com/inspector) 
+  [开始使用 AWS WAF](https://docs.aws.amazon.com/waf/latest/developerguide/getting-started.html) 

 **相关视频：** 
+  [用于各种 VPC 的 AWS Transit Gateway 参考架构](https://youtu.be/9Nikqn_02Oc) 
+  [使用 Amazon CloudFront、AWS WAF 和 AWS Shield 提供应用程序加速和保护 ](https://youtu.be/0xlwLEccRe0)

 **相关示例：** 
+  [实验室：自动部署 VPC](https://www.wellarchitectedlabs.com/Security/200_Automated_Deployment_of_VPC/README.html) 

# SEC05-BP03 自动执行网络防护
<a name="sec_network_protection_auto_protect"></a>

 自动运行保护机制，以提供基于威胁情报和异常检测的自我防御网络。例如可应对最新的威胁并减轻它们的影响的那些入侵检测和预防工具。您可以通过实施 Web 应用程序防火墙来实现自动化的网络保护，例如使用 AWS WAF Security Automations 解决方案（[https://github.com/awslabs/aws-waf-security-automations](https://github.com/awslabs/aws-waf-security-automations)）来自动拦截来自已知威胁媒介相关 IP 地址的请求。

 **未建立这种最佳实践的情况下暴露的风险等级：** 中 

## 实施指导
<a name="implementation-guidance"></a>
+  自动执行基于 Web 流量的保护：AWS 提供了使用 AWS CloudFormation 自动部署一组 AWS WAF 规则的解决方案，旨在筛选常见的基于 Web 的攻击。用户可以从预配置的保护功能中进行选择，这些功能定义 AWS WAF Web 访问控制列表（Web ACL）中包含的规则。
  +  [AWS WAF 安全自动化](https://aws.amazon.com/solutions/aws-waf-security-automations/) 
+  考虑使用 AWS Partner 解决方案：AWS 合作伙伴提供数百种业界领先的产品，这些产品与您的本地环境中的现有控制措施等效、相同或与之集成。这些产品对现有 AWS 服务起到补充作用，使您能够在云和本地部署环境中部署全面的安全架构，进而实现更无缝的体验。
  +  [基础设施安全性](https://aws.amazon.com/security/partner-solutions/#infrastructure_security) 

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS Firewall Manager](https://docs.aws.amazon.com/waf/latest/developerguide/fms-section.html) 
+  [Amazon Inspector](https://aws.amazon.com/inspector) 
+ [Amazon VPC 安全性](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Security.html)
+  [开始使用 AWS WAF](https://docs.aws.amazon.com/waf/latest/developerguide/getting-started.html) 

 **相关视频：** 
+  [用于各种 VPC 的 AWS Transit Gateway 参考架构](https://youtu.be/9Nikqn_02Oc) 
+  [使用 Amazon CloudFront、AWS WAF 和 AWS Shield 提供应用程序加速和保护 ](https://youtu.be/0xlwLEccRe0)

 **相关示例：** 
+  [实验室：自动部署 VPC](https://www.wellarchitectedlabs.com/Security/200_Automated_Deployment_of_VPC/README.html) 

# SEC05-BP04 实施检查和保护
<a name="sec_network_protection_inspection"></a>

 检查和筛选每层的流量。您可以使用 [VPC Network Access Analyzer](https://docs.aws.amazon.com/vpc/latest/network-access-analyzer/what-is-vaa.html)检测 VPC 配置中可能存在的意外访问。您可以指定网络访问需求，然后确定不能满足这些要求的潜在网络路径。对于通过基于 HTTP 的协议处理的组件，Web 应用程序防火墙可帮助防止常见的攻击。 [AWS WAF](https://aws.amazon.com/waf) 是一个 Web 应用程序防火墙，可监控和拦截与转发到 Amazon API Gateway API、Amazon CloudFront 或 Application Load Balancer 的可配置规则匹配的 HTTP(s) 请求。要开始使用 AWS WAF，您可以将 [AWS 托管式规则](https://docs.aws.amazon.com/waf/latest/developerguide/getting-started.html#getting-started-wizard-add-rule-group) 与您自己的规则结合使用，也可以使用现有的 [合作伙伴集成](https://aws.amazon.com/waf/partners/)。 

 要管理 AWS WAF、AWS Shield Advanced 保护以及跨 AWS Organizations 的 Amazon VPC 安全组，您可以使用 AWS Firewall Manager。它允许您跨账户和应用程序集中配置和管理防火墙规则，从而更轻松地扩展常见规则的实施。通过使用 [AWS Shield Advanced](https://docs.aws.amazon.com/waf/latest/developerguide/ddos-responding.html)或 [能够自动拦截向](https://aws.amazon.com/solutions/aws-waf-security-automations/) 您的 Web 应用程序发送非必要请求的解决方案，它还使您能够快速响应攻击。Firewall Manager 也可以与 [AWS Network Firewall](https://aws.amazon.com/network-firewall/)结合使用。AWS Network Firewall 是一种托管服务，使用规则引擎为您提供对有状态和无状态网络流量的精细控制。它支持 [与 Suricata 兼容的](https://docs.aws.amazon.com/network-firewall/latest/developerguide/stateful-rule-groups-ips.html) 开源入侵防御系统（IPS，Intrusion Prevention System）规范，以便使用规则来保护您的工作负载。 

 **未建立这种最佳实践的情况下暴露的风险等级：** 低 

## 实施指导
<a name="implementation-guidance"></a>
+  配置 Amazon GuardDuty：GuardDuty 是一种威胁检测服务，可持续监控恶意活动和未经授权的行为，从而保护您的 AWS 账户 和工作负载。启用 GuardDuty 并配置自动化警报。 
  +  [Amazon GuardDuty](https://docs.aws.amazon.com/guardduty/latest/ug/what-is-guardduty.html) 
  +  [实验室：自动部署检测性控制](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_Detective_Controls/README.html) 
+  配置虚拟私有云（VPC）流日志：VPC 流日志功能使您能够进一步捕获有关传入和传出 VPC 中网络接口的 IP 流量信息。流日志数据可以发布到 Amazon CloudWatch Logs 和 Amazon Simple Storage Service（Amazon S3）。创建流日志后，您可以在选定目标中检索和查看其数据。
+  考虑使用 VPC 流量径向：流量镜像是一项 Amazon VPC 功能，您可以用它从 Amazon Elastic Compute Cloud（Amazon EC2）实例的弹性网络接口复制网络流量，然后将其发送到带外安全和监控设备，以进行内容检查、威胁监控和故障排除。
  +  [VPC 流量镜像](https://docs.aws.amazon.com/vpc/latest/mirroring/what-is-traffic-mirroring.html) 

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS Firewall Manager](https://docs.aws.amazon.com/waf/latest/developerguide/fms-section.html) 
+  [Amazon Inspector](https://aws.amazon.com/inspector) 
+  [Amazon VPC 安全性](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Security.html) 
+  [开始使用 AWS WAF](https://docs.aws.amazon.com/waf/latest/developerguide/getting-started.html) 

 **相关视频：** 
+  [用于各种 VPC 的 AWS Transit Gateway 参考架构](https://youtu.be/9Nikqn_02Oc) 
+  [使用 Amazon CloudFront、AWS WAF 和 AWS Shield 提供应用程序加速和保护](https://youtu.be/0xlwLEccRe0) 

 **相关示例：** 
+  [实验室：自动部署 VPC](https://www.wellarchitectedlabs.com/Security/200_Automated_Deployment_of_VPC/README.html) 

# SEC 6  如何保护计算资源？
<a name="w2aac19b7c11b7"></a>

工作负载内的计算资源需要采用多层防御，才有助于免受内部和外部威胁。计算资源包括 EC2 实例、容器、AWS Lambda 函数、数据库服务、IoT 设备等。

**Topics**
+ [SEC06-BP01 执行漏洞管理](sec_protect_compute_vulnerability_management.md)
+ [SEC06-BP02 缩小攻击面](sec_protect_compute_reduce_surface.md)
+ [SEC06-BP03 实施托管服务](sec_protect_compute_implement_managed_services.md)
+ [SEC06-BP04 自动保护计算](sec_protect_compute_auto_protection.md)
+ [SEC06-BP05 帮助人员远程执行操作](sec_protect_compute_actions_distance.md)
+ [SEC06-BP06 验证软件完整性](sec_protect_compute_validate_software_integrity.md)

# SEC06-BP01 执行漏洞管理
<a name="sec_protect_compute_vulnerability_management"></a>

 频繁扫描和修补您的代码、依赖项和基础设施中的漏洞，以帮助防御新的威胁。 

 从计算基础设施的配置开始，您可以使用 AWS CloudFormation 自动创建和更新资源。通过 CloudFormation，您可以使用 AWS 示例或者自行编写，创建以 YAML 或 JSON 格式编写的模板。这样您便可以创建默认安全的基础设施模板，通过 [CloudFormation Guard](https://aws.amazon.com/about-aws/whats-new/2020/10/aws-cloudformation-guard-an-open-source-cli-for-infrastructure-compliance-is-now-generally-available/)进行验证，从而节省时间并减少配置错误的风险。您可以使用持续交付来构建基础设施并部署应用程序，例如，使用 [AWS CodePipeline](https://docs.aws.amazon.com/codepipeline/latest/userguide/concepts-continuous-delivery-integration.html)来自动进行构建、测试和发布。

 您负责自己 AWS 资源的补丁管理，包括 Amazon Elastic Compute Cloud（Amazon EC2）实例、亚马逊云机器镜像（AMI）以及众多其他计算资源。对于 Amazon EC2 实例，AWS Systems Manager 使用安全相关的更新和其他类型的更新来自动执行修补托管实例的流程。您可以使用 Patch Manager 为操作系统和应用程序应用修补程序。（在 Windows Server 上，应用程序支持仅限于 Microsoft 应用程序的更新。） 您可以使用 Patch Manager 在 Windows 实例上安装服务包，以及在 Linux 实例上执行次要版本升级。您可以按操作系统类型修补 Amazon EC2 实例集或本地服务器和虚拟机队列。这包括 Windows Server、Amazon Linux、Amazon Linux 2、CentOS、Debian Server、Oracle Linux、Red Hat Enterprise Linux（RHEL）、SUSE Linux Enterprise Server（SLES）和 Ubuntu Server 的受支持版本。您可以扫描实例以单独查看缺失补丁的报告，也可以扫描并自动安装所有缺失的补丁。

 **未建立此最佳实践暴露的风险等级：** 高 

## 实施指导
<a name="implementation-guidance"></a>
+  配置 Amazon Inspector：Amazon Inspector 测试 Amazon Elastic Compute Cloud（Amazon EC2）实例的网络可访问性，以及在这些实例上运行应用程序的安全状态。Amazon Inspector 评估应用程序的风险、漏洞以及相较于最佳实践的偏差。 
  +  [什么是 Amazon Inspector？](https://docs.aws.amazon.com/inspector/latest/userguide/inspector_introduction.html) 
+  扫描源代码：扫描库和依赖项，以确定是否有漏洞。
  +  [Amazon CodeGuru](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/welcome.html) 
  +  [OWASP：源代码分析工具](https://owasp.org/www-community/Source_Code_Analysis_Tools) 

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS Systems Manager](https://aws.amazon.com/systems-manager/) 
+  [使用 Amazon EC2 Systems Manager 替换堡垒主机](https://aws.amazon.com/blogs/mt/replacing-a-bastion-host-with-amazon-ec2-systems-manager/) 
+  [AWS Lambda 安全性概述](https://pages.awscloud.com/rs/112-TZM-766/images/Overview-AWS-Lambda-Security.pdf) 

 **相关视频：** 
+  [在 Amazon EKS 上运行高安全性工作负载](https://youtu.be/OWRWDXszR-4) 
+  [保护无服务器和容器服务](https://youtu.be/kmSdyN9qiXY) 
+  [有关 Amazon EC2 实例元数据服务的安全最佳实践](https://youtu.be/2B5bhZzayjI) 

 **相关示例：** 
+  [实验室：自动部署 Web 应用程序防火墙](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_Web_Application_Firewall/README.html) 

# SEC06-BP02 缩小攻击面
<a name="sec_protect_compute_reduce_surface"></a>

 通过强化操作系统，并尽量减少所使用的组件、库和外部可用的服务，缩小暴露在意外访问下的危险。首先减少未使用的组件，无论它们是操作系统程序包、应用程序（适用于基于 Amazon Elastic Compute Cloud（Amazon EC2）的工作负载）还是您代码中的外部软件模块（适用于所有工作负载）。您可以找到许多面向常见的操作系统和服务器软件的强化和安全配置指南。例如，您可以从 [互联网安全中心](https://www.cisecurity.org/) 开始并进行迭代。

 在 Amazon EC2 中，您可以创建自己的亚马逊云机器镜像（AMI）并进行修补和强化，以帮助您满足企业的特定安全要求。您应用到 AMI 上的补丁和其他安全控制措施在其创建时生效，它们并非动态的，除非您在启动之后进行了修改，例如，使用 AWS Systems Manager 进行修改。

 您可以使用 EC2 Image Builder 简化构建安全 AMI 的过程。EC2 Image Builder 可大幅减少创建和维护黄金镜像所需的工作，无需编写和维护自动化过程。在有软件更新可用时，Image Builder 自动生成新的镜像，无需用户手动迭代镜像工作版本。通过 EC2 Image Builder，您可以使用 AWS 提供的测试和自己的测试，在将镜像部署到生产环境中之前轻松地验证镜像的功能和安全性。您还可以应用 AWS 提供的安全设置来进一步保护自己的镜像，满足内部安全标准。例如，您可以使用 AWS 提供的模板，生成符合安全技术实施指南（STIG，Security Technical Implementation Guide）标准的镜像。 

 使用第三方静态代码分析工具，您可以确定常见的安全问题，例如未检查的函数输入边界，以及适用的通用漏披露（CVE，Common Vulnerabilities and Exposures）。您可以对所支持的语言使用 [Amazon CodeGuru](https://aws.amazon.com/codeguru/) 。您还可以使用第三方依赖关系检查工具，确定代码链接的库是否是最新版本、它们是否不含 CVE，并确保您拥有符合您软件政策要求的许可条件。

 使用 Amazon Inspector，您可以针对 CVE，对您的实例执行配置评估、根据安全基准执行评估以及实现缺陷通知自动化。Amazon Inspector 在生产实例或构建管道中运行，它会在发现结果时通知开发人员和工程师。您可以通过编程方式访问调查结果，并将您的团队引导至待办事项和错误跟踪系统。 [EC2 Image Builder](https://aws.amazon.com/image-builder/) 可通过自动化修补、AWS 提供的安全策略实施和其他自定义来维护服务器映像 (AMI)。当使用容器时，在您的构建管道中对您的映像存储库定期实施 [ECR 映像扫描](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) ，以便在您的容器中查找 CVE。

 尽管 Amazon Inspector 和其他工具能够有效地确定配置和存在的任何 CVE，但也需要使用其他方法在应用程序级别测试您的工作负载。 [模糊](https://owasp.org/www-community/Fuzzing) 是一种众所周知的查错方法，可自动将格式不正确的数据注入到您应用程序的输入字段和其他区域来查错。 

 **未建立此最佳实践暴露的风险等级：** 高 

## 实施指导
<a name="implementation-guidance"></a>
+  强化操作系统：配置操作系统以符合最佳实践。 
  +  [保护 Amazon Linux](https://www.cisecurity.org/benchmark/amazon_linux/) 
  +  [保护 Microsoft Windows Server](https://www.cisecurity.org/benchmark/microsoft_windows_server/) 
+  强化容器化资源：配置容器化资源以符合安全最佳实践。
+  实施 AWS Lambda 最佳实践。
  +  [AWS Lambda 最佳实践](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html) 

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS Systems Manager](https://aws.amazon.com/systems-manager/) 
+  [使用 Amazon EC2 Systems Manager 替换堡垒主机](https://aws.amazon.com/blogs/mt/replacing-a-bastion-host-with-amazon-ec2-systems-manager/) 
+  [AWS Lambda 安全性概述](https://pages.awscloud.com/rs/112-TZM-766/images/Overview-AWS-Lambda-Security.pdf) 

 **相关视频：** 
+  [在 Amazon EKS 上运行高安全性工作负载](https://youtu.be/OWRWDXszR-4) 
+  [保护无服务器和容器服务](https://youtu.be/kmSdyN9qiXY) 
+  [有关 Amazon EC2 实例元数据服务的安全最佳实践](https://youtu.be/2B5bhZzayjI) 

 **相关示例：** 
+  [实验室：自动部署 Web 应用程序防火墙](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_Web_Application_Firewall/README.html) 

# SEC06-BP03 实施托管服务
<a name="sec_protect_compute_implement_managed_services"></a>

 实施用于托管资源的服务，例如 Amazon Relational Database Service（Amazon RDS）、AWS Lambda 和 Amazon Elastic Container Service（Amazon ECS），以便在责任共担模式中减少安全维护任务。例如，Amazon RDS 可帮助您设置、操作和扩展关系数据库，并自动执行管理任务，例如硬件预置、数据库设置、修补和备份。这意味着您将有更多的空闲时间，因此可以专注于通过 AWS Well-Architected Framework 中所述的其他方法来保护您的应用程序。使用 Lambda，无需使用预置或托管服务器即可运行代码，因此您只需在代码级别专注于连接、调用和安全性，而不是基础设施或操作系统级别。 

 **未建立此最佳实践暴露的风险等级：** 中 

## 实施指导
<a name="implementation-guidance"></a>
+  探索可用的服务：探索、测试和实施管理资源的服务，例如 Amazon RDS、AWS Lambda 和 Amazon ECS。 

## 资源
<a name="resources"></a>

 **相关文档：** 
+ [AWS 网站 ](https://aws.amazon.com/)
+  [AWS Systems Manager](https://aws.amazon.com/systems-manager/) 
+  [使用 Amazon EC2 Systems Manager 替换堡垒主机](https://aws.amazon.com/blogs/mt/replacing-a-bastion-host-with-amazon-ec2-systems-manager/) 
+  [AWS Lambda 安全性概述](https://pages.awscloud.com/rs/112-TZM-766/images/Overview-AWS-Lambda-Security.pdf) 

 **相关视频：** 
+  [在 Amazon EKS 上运行高安全性工作负载](https://youtu.be/OWRWDXszR-4) 
+  [保护无服务器和容器服务](https://youtu.be/kmSdyN9qiXY) 
+  [有关 Amazon EC2 实例元数据服务的安全最佳实践](https://youtu.be/2B5bhZzayjI) 

 **相关示例：** 
+ [实验室：AWS Certificate Manager 请求公有证书 ](https://wellarchitectedlabs.com/security/200_labs/200_certificate_manager_request_public_certificate/)

# SEC06-BP04 自动保护计算
<a name="sec_protect_compute_auto_protection"></a>

 自动执行计算保护机制，包括管理漏洞、缩小攻击面和管理资源。此自动化将帮助您投入时间以保护工作负载的其他方面，并降低人为犯错的风险。 

 **未建立这种最佳实践的情况下暴露的风险等级：** 中 

## 实施指导
<a name="implementation-guidance"></a>
+  自动管理配置：使用配置管理服务或工具自动实施安全配置并对其进行验证。 
  +  [AWS Systems Manager](https://aws.amazon.com/systems-manager/) 
  +  [AWS CloudFormation](https://aws.amazon.com/cloudformation/) 
  +  [实验室：自动部署 VPC](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_VPC/README.html) 
  +  [实验室：自动部署 EC2 Web 应用程序](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_EC2_Web_Application/README.html) 
+  自动修补 Amazon Elastic Compute Cloud（Amazon EC2）实例：AWS Systems Manager Patch Manager 使用安全相关的更新和其他类型的更新来自动执行修补托管实例的流程。您可以使用 Patch Manager 为操作系统和应用程序应用修补程序。
  +  [AWS Systems Manager 补丁管理器](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-patch.html) 
  +  [使用 AWS Systems Manager Automation 集中完成多账户和多区域的修补](https://https://aws.amazon.com/blogs/mt/centralized-multi-account-and-multi-region-patching-with-aws-systems-manager-automation/) 
+  实施入侵检测和预防：实施入侵检测和预防工具，以监控并停止实例上的恶意活动。 
+  考虑使用 AWS Partner 解决方案：AWS 合作伙伴提供数百种业界领先的产品，这些产品与您的本地环境中的现有控制措施等效、相同或与之集成。这些产品对现有 AWS 服务起到补充作用，使您能够在云和本地部署环境中部署全面的安全架构，进而实现更无缝的体验。 
  +  [基础设施安全性](https://aws.amazon.com/security/partner-solutions/#infrastructure_security) 

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS CloudFormation](https://aws.amazon.com/cloudformation/) 
+  [AWS Systems Manager](https://aws.amazon.com/systems-manager/) 
+  [AWS Systems Manager 补丁管理器](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-patch.html) 
+  [使用 AWS Systems Manager Automation 集中完成多账户和多区域的修补](https://aws.amazon.com/blogs/mt/centralized-multi-account-and-multi-region-patching-with-aws-systems-manager-automation/) 
+  [基础设施安全性](https://aws.amazon.com/security/partner-solutions/#infrastructure_security) 
+  [使用 Amazon EC2 Systems Manager 替换堡垒主机](https://aws.amazon.com/blogs/mt/replacing-a-bastion-host-with-amazon-ec2-systems-manager/) 
+  [AWS Lambda 安全性概述](https://pages.awscloud.com/rs/112-TZM-766/images/Overview-AWS-Lambda-Security.pdf) 

 **相关视频：** 
+  [在 Amazon EKS 上运行高安全性工作负载](https://youtu.be/OWRWDXszR-4) 
+  [保护无服务器和容器服务](https://youtu.be/kmSdyN9qiXY) 
+  [有关 Amazon EC2 实例元数据服务的安全最佳实践](https://youtu.be/2B5bhZzayjI) 

 **相关示例：** 
+  [实验室：自动部署 Web 应用程序防火墙](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_Web_Application_Firewall/README.html) 
+  [实验室：自动部署 EC2 Web 应用程序](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_EC2_Web_Application/README.html) 

# SEC06-BP05 帮助人员远程执行操作
<a name="sec_protect_compute_actions_distance"></a>

 移除交互式访问功能可降低人为错误的风险以及手动配置或管理的可能性。例如，通过更改管理工作流，使用基础设施即代码部署 Amazon Elastic Compute Cloud（Amazon EC2）实例，然后使用 AWS Systems Manager 等工具管理 Amazon EC2 实例，而不是允许直接访问或通过堡垒主机进行访问。AWS Systems Manager 可以使用 [自动化](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation.html) [工作流](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation.html)、[文档](https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-documents.html) （行动手册）和 [Run Command](https://docs.aws.amazon.com/systems-manager/latest/userguide/execute-remote-commands.html)等功能自动执行多种维护和部署任务。AWS CloudFormation 堆栈从管道进行构建，并能够自动执行您的基础设施部署和管理任务，而无需直接使用 AWS 管理控制台或 API。

 **未建立此最佳实践暴露的风险等级：** 低 

## 实施指导
<a name="implementation-guidance"></a>
+  替换控制台访问：用 AWS Systems Manager Run Command 替换实例的控制台访问（SSH 或 RDP），以自动管理任务。 
+  [AWS Systems Manager Run Command](https://docs.aws.amazon.com/systems-manager/latest/userguide/execute-remote-commands.html) 

## 资源
<a name="resources"></a>

 **相关文档：** 
+  [AWS Systems Manager](https://aws.amazon.com/systems-manager/) 
+  [AWS Systems Manager Run Command](https://docs.aws.amazon.com/systems-manager/latest/userguide/execute-remote-commands.html) 
+  [使用 Amazon EC2 Systems Manager 替换堡垒主机](https://aws.amazon.com/blogs/mt/replacing-a-bastion-host-with-amazon-ec2-systems-manager/) 
+  [AWS Lambda 安全性概述](https://pages.awscloud.com/rs/112-TZM-766/images/Overview-AWS-Lambda-Security.pdf) 

 **相关视频：** 
+  [在 Amazon EKS 上运行高安全性工作负载](https://youtu.be/OWRWDXszR-4) 
+  [保护无服务器和容器服务](https://youtu.be/kmSdyN9qiXY) 
+  [有关 Amazon EC2 实例元数据服务的安全最佳实践](https://youtu.be/2B5bhZzayjI) 

 **相关示例：** 
+  [实验室：自动部署 Web 应用程序防火墙](https://wellarchitectedlabs.com/Security/200_Automated_Deployment_of_Web_Application_Firewall/README.html) 

# SEC06-BP06 验证软件完整性
<a name="sec_protect_compute_validate_software_integrity"></a>

 实施一些机制（例如代码签名），以确保工作负载中使用的软件、代码和库来自可信的来源且未被篡改。例如，您应验证二进制文件和脚本的代码签名证书以确认作者，并确保证书自作者创建以来未被篡改。[AWS Signer](https://docs.aws.amazon.com/signer/latest/developerguide/Welcome.html) 通过集中管理代码签名生命周期，包括签名证书以及公有和私有密钥，帮助确保代码的可信度和完整性。您可以了解如何对 [AWS Lambda](https://aws.amazon.com/blogs/security/best-practices-and-advanced-patterns-for-lambda-code-signing/)使用代码签名的高级模式和最佳实践。此外，通过将您下载的软件的校验和与提供商提供的校验和进行对比，可帮助确保它未被篡改。

 **未建立这种最佳实践的情况下暴露的风险等级：** 低 

## 实施指导
<a name="implementation-guidance"></a>
+  调查机制：代码签名是一种可用来验证软件完整性的机制。 
  +  [NIST：代码签名的安全注意事项](https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.01262018.pdf) 

## 资源
<a name="resources"></a>

**相关文档：** 
+ [AWS Signer](https://docs.aws.amazon.com/signer/index.html)
+ [新增 – 代码签名，用于 AWS Lambda 的可信度和完整性控制措施](https://aws.amazon.com/blogs/aws/new-code-signing-a-trust-and-integrity-control-for-aws-lambda/) 