

# 基礎設施保護
<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) 攻擊和常見入侵程式，例如 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 可讓您定義橫跨 AWS 區域的網路拓撲，使用您所設定的私有 IPv4 位址範圍，或 AWS 選取的 IPv6 位址範圍。您應該對傳入和傳出流量採用深度防禦方法的多個控制，包括使用安全群組 (狀態檢測防火牆)、網路 ACL、子網路和路由表。在 VPC 內，您可以在可用區域中建立子網路。每個子網都有一個關聯的路由表，定義路由規則，以管理子網路內流量所經過的路徑。您可以透過讓路由前往連接到 VPC 的網際網路或 NAT 閘道，或透過另一個 VPC 來定義網際網路可路由子網路。 

 當執行個體、Amazon Relational Database Service (Amazon RDS) 資料庫或其他服務在 VPC 內啟動時，每個網路介面都有自己的安全群組。此防火牆位於作業系統層之外，可用來定義允許傳入和傳出流量的規則。您還可以定義安全群組之間的關係。例如，資料庫層安全群組內的執行個體，藉由參照套用至所涉及執行個體的安全群組，僅接受來自應用程式層內執行個體的流量。除非您使用非 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 應用程式防火牆 (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 站點對站點 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>
+  針對以網頁為基礎的流量進行自動保護：AWS 提供的解決方案使用 AWS CloudFormation 自動部署一組 AWS WAF 規則，專門用於篩選常見網頁式攻擊。使用者可從預先設定的保護功能中進行選擇，以定義 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 組態並找出潛在的意外存取，您可以使用 [VPC Network Access Analyzer](https://docs.aws.amazon.com/vpc/latest/network-access-analyzer/what-is-vaa.html)。您可以指定您的網路存取要求，並識別未符合它們的潛在網路路徑。對於透過 HTTP 通訊協定進行交易的元件，Web 應用程式防火牆可協助防止常見的攻擊。 [AWS WAF](https://aws.amazon.com/waf) 是一種 Web 應用程式防火牆，可讓您監控和封鎖符合可設定規則的 HTTP 請求；這些請求會轉送到 Amazon API Gateway API、Amazon CloudFront 或 Application Load Balancer。若要開始使用 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 Organizations 管理 AWS WAF、AWS Shield Advanced 保護和 Amazon VPC 安全群組，您可以使用 AWS Firewall Manager。它可讓您集中設定和管理所有帳戶和應用程式的防火牆規則，使得共同規則的擴展強制執行更為輕鬆。它也可讓您使用 [AWS Shield Advanced](https://docs.aws.amazon.com/waf/latest/developerguide/ddos-responding.html)或可自動封鎖對 Web 應用程式不必要請求的 [解決方案](https://aws.amazon.com/solutions/aws-waf-security-automations/) ，快速地回應攻擊。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) 規格，供規則用來協助保護您的工作負載。 

 **若未建立此最佳實務，暴露的風險等級為：** 低 

## 實作指引
<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) 執行個體、Amazon Machine Image (AMI) 和許多其他運算資源。對於 Amazon EC2 執行個體，AWS Systems Manager 修補程式管理員可將管理執行個體在安全相關與其他類型方面的更新修補過程自動化。您可以使用修補程式管理員為作業系統和應用程式套用修補程式。(在 Windows Server 上，應用程式支援僅限於 Microsoft 應用程式的更新。) 您可以使用修補程式管理員，在 Windows 執行個體上安裝 Service Pack，並在 Linux 執行個體上執行次要版本升級。您可以按作業系統類型修補 Amazon EC2 執行個體機群或內部部署伺服器和虛擬機器 (VM)。這包括支援的 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) 型工作負載) 或程式碼中的外部軟體模組 (適用於所有工作負載)。對於常見的作業系統和伺服器軟體，您可以找到許多強化和安全組態指南。例如，您可以從 [Center for Internet Security](https://www.cisecurity.org/) 開始並反覆。

 在 Amazon EC2 中，您可以建立自己的 Amazon Machine Image (AMI)，並已對其進行修補和強化，以協助您符合組織的特定安全要求。您在 AMI 上套用的修補程式和其他安全控制，在建立它們的時間點有效—它們不是動態的，除非您在啟動後進行修改，例如，使用 AWS Systems Manager 進行此修改。

 您可以使用 EC2 Image Builder 簡化建置安全 AMI 的程序。EC2 Image Builder 會大幅地減少建立和維護黃金映像所需的工作量，而不會編寫和維護自動化。當軟體更新可用時，Image Builder 會自動產生新映像，而無需用戶手動啟動映像構置。EC2 Image Builder 可讓您在生產環境中使用您的映像，搭配 AWS 提供的測試和您自己的測試之前，輕鬆地驗證這些映像的功能和安全性。您也可以套用 AWS 提供的安全設定，以進一步保護您的映像，來符合內部安全準則。例，您可以使用 AWS 提供的範本，產生符合安全技術實作指南 (STIG) 標準的映像。 

 使用第三方靜態程式碼分析工具，您可以識別常見的安全問題，例如未檢查的函數輸入界限，以及適用的常見漏洞和披露 (CVE)。您可以使用 [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，但還需要其他方法來測試應用程式層級的工作負載。 [Fuzzing](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 修補程式管理員可將管理執行個體在安全相關與其他類型方面的更新修補過程自動化。您可以使用修補程式管理員為作業系統和應用程式套用修補程式。
  +  [AWS Systems Manager Patch Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-patch.html) 
  +  [使用 AWS Systems Manager 自動化進行集中式多帳戶和多區域修補](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 Patch Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-patch.html) 
+  [使用 AWS Systems Manager 自動化進行集中式多帳戶和多區域修補](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) (程序手冊) 和 [執行命令](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/) 