

# REL01-BP06 确保当前配额与最大使用量之间存在足够的差距来应对失效转移
<a name="rel_manage_service_limits_suff_buffer_limits"></a>

本文介绍了如何在资源配额和使用量之间保留一定空间，以及这如何让组织受益。使用完资源后，该资源的使用量配额可能会继续计入该资源。这可能导致资源出现故障或无法访问。确认配额涵盖无法访问的资源及其替换资源的重叠部分，避免资源出现故障。在计算此差距时，应考虑网络故障、可用区故障或区域故障等应用场景。

 **期望结果：**在当前服务阈值内可以覆盖资源或资源可访问性方面的或大或小的故障。在资源规划中已考虑到可用区故障、网络故障或甚至是区域故障。

 **常见反模式：**
+  根据当前需求设置服务配额，而不考虑失效转移场景。
+  在计算服务的峰值配额时不考虑静态稳定性原则。
+  在计算每个区域所需的总配额时，不考虑可能无法访问资源的情况。
+  不考虑某些服务的 AWS 服务故障隔离边界及其可能的异常使用模式。

 **建立此最佳实践的好处：**当服务中断事件影响应用程序可用性时，使用云实施相关策略，以便从这些事件中恢复。此类策略通常包括创建额外资源来替换无法访问的资源，在不耗尽服务限制的情况下应对失效转移条件。

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

## 实施指导
<a name="implementation-guidance"></a>

 在评估配额限制时，考虑因性能下降可能导致的失效转移情况。考虑以下失效转移情况：
+  VPC 中断或无法访问。
+  子网无法访问。
+  可用区性能下降，影响资源的可访问性。
+  系统阻止或更改了网络路由或入口点和出口点。
+  区域性能下降，影响资源的可访问性。
+  区域或可用区出现故障，影响资源子集。

 因为业务影响可能会有很大差异，每种情况的失效转移决策都是独特的。在决定对应用程序或服务进行失效转移之前，请先考虑失效转移位置的资源容量规划和资源配额。

 在检查每项服务的配额时，要考虑到高于正常水平的活动峰值。这些峰值可能与因网络或权限而无法访问但仍处于活动状态的资源有关。未终止的活动资源将计入服务配额限制。

 **实施步骤** 
+  在服务配额与最高使用量之间保留一定空间，以便应对失效转移或失去可访问性。
+  确定服务配额。要考虑典型的部署模式、可用性要求和使用量增长情况。
+  根据需要请求提高配额。预计配额提高请求需要等待的一段时间。
+  确定可靠性要求（也称为“X 个 9”）。
+  了解潜在的故障情况，例如组件、可用区或区域缺失。
+  确定部署方法（例如金丝雀部署、蓝绿部署、红黑部署或滚动部署）。
+  在当前配额限制中包含适当的缓冲区。例如设置 15% 的缓冲区。
+  在适当情况下包括静态稳定性（可用区和区域）的计算。
+  预计使用量增长情况并监控使用量趋势。
+  考虑静态稳定性对最关键工作负载的影响。评测所有区域和可用区中适应静态稳定系统的资源。
+  考虑使用按需容量预留，以便在发生任何失效转移之前安排容量。对于关键的业务计划来说，这是一种值得实施的有用策略，可以在失效转移期间获得正确数量和类型的资源，从而降低潜在的风险。

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

 **相关最佳实践：**
+  [REL01-BP01 了解服务配额和约束](rel_manage_service_limits_aware_quotas_and_constraints.md) 
+  [REL01-BP02 跨多个账户和区域管理服务配额](rel_manage_service_limits_limits_considered.md) 
+  [REL01-BP03 通过架构适应固定服务配额和约束](rel_manage_service_limits_aware_fixed_limits.md) 
+  [REL01-BP04 监控和管理配额](rel_manage_service_limits_monitor_manage_limits.md) 
+  [REL01-BP05 自动管理配额](rel_manage_service_limits_automated_monitor_limits.md) 
+  [REL03-BP01 选择如何划分工作负载](rel_service_architecture_monolith_soa_microservice.md) 
+  [REL10-BP01 将工作负载部署到多个位置](rel_fault_isolation_multiaz_region_system.md) 
+  [REL11-BP01 监控工作负载的所有组件以检测故障](rel_withstand_component_failures_monitoring_health.md) 
+  [REL11-BP03 自动修复所有层](rel_withstand_component_failures_auto_healing_system.md) 
+  [REL12-BP04 使用混沌工程测试韧性](rel_testing_resiliency_failure_injection_resiliency.md) 

 **相关文档：**
+ [AWS Well-Archited Framework 的可靠性支柱：可用性](https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/availability.html)
+  [AWS Service Quotas (formerly referred to as service limits)](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html) 
+  [AWS Trusted Advisor Best Practice Checks](https://aws.amazon.com/premiumsupport/technology/trusted-advisor/best-practice-checklist/)（参见“Service limits”小节） 
+  [AWS Answers 上的 AWS Limit Monitor](https://aws.amazon.com/answers/account-management/limit-monitor/) 
+  [Amazon EC2 Service Limits](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html) 
+  [What is Service Quotas?](https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html)
+ [How to Request Quota Increase](https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html)
+ [Service endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html)
+  [Service Quotas User Guide](https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html) 
+ [适用于 AWS 的配额监控程序](https://aws.amazon.com/solutions/implementations/quota-monitor/)
+ [AWS Fault Isolation Boundaries](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/abstract-and-introduction.html)
+ [Availability with redundancy](https://docs.aws.amazon.com/whitepapers/latest/availability-and-beyond-improving-resilience/availability-with-redundancy.html)
+ [AWS 数据解决方案](https://aws.amazon.com/data/)
+ [什么是持续集成？](https://aws.amazon.com/devops/continuous-integration/)
+ [什么是持续交付？](https://aws.amazon.com/devops/continuous-delivery/)
+ [APN 合作伙伴：可帮助进行配置管理的合作伙伴](https://partners.amazonaws.com/search/partners?keyword=Configuration+Management&ref=wellarchitected)
+ [Managing the account lifecycle in account-per-tenant SaaS environments on AWS](https://aws.amazon.com/blogs/mt/managing-the-account-lifecycle-in-account-per-tenant-saas-environments-on-aws/)
+ [Managing and monitoring API throttling in your workloads](https://aws.amazon.com/blogs/mt/managing-monitoring-api-throttling-in-workloads/)
+ [View AWS Trusted Advisor recommendations at scale with AWS Organizations](https://aws.amazon.com/blogs/mt/organizational-view-for-trusted-advisor/)
+ [Automating Service Limit Increases and Enterprise Support with AWS Control Tower](https://aws.amazon.com/blogs/mt/automating-service-limit-increases-enterprise-support-aws-control-tower/)
+ [ Actions, resources, and condition keys for Service Quotas](https://docs.aws.amazon.com/service-authorization/latest/reference/list_servicequotas.html)

 **相关视频：**
+  [AWS Live re:Inforce 2019 - Service Quotas](https://youtu.be/O9R5dWgtrVo) 
+ [View and Manage Quotas for AWS Services Using Service Quotas](https://www.youtube.com/watch?v=ZTwfIIf35Wc)
+ [AWS IAM Quotas Demo](https://www.youtube.com/watch?v=srJ4jr6M9YQ)
+ [AWS re:Invent 2018: Close Loops and Opening Minds: How to Take Control of Systems, Big and Small](https://www.youtube.com/watch?v=O8xLxNje30M)

 **相关工具：**
+ [AWS CodeDeploy](https://aws.amazon.com/codedeploy/)
+ [AWS CloudTrail](https://aws.amazon.com/cloudtrail/)
+ [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/)
+ [Amazon EventBridge](https://aws.amazon.com/eventbridge/)
+ [Amazon DevOps Guru](https://aws.amazon.com/devops-guru/)
+ [AWS Config](https://aws.amazon.com/config/)
+ [AWS Trusted Advisor](https://aws.amazon.com/premiumsupport/technology/trusted-advisor/)
+ [AWS CDK](https://aws.amazon.com/cdk/)
+ [AWS Systems Manager](https://aws.amazon.com/systems-manager/)
+ [AWS Marketplace](https://aws.amazon.com/marketplace/search/results?searchTerms=CMDB)