COST04-BP04 Decommission resources automatically
Design your workload to gracefully handle resource termination as you identify and decommission non-critical resources, resources that are not required, or resources with low utilization.
Level of risk exposed if this best practice is not established: Low
Implementation guidance
Use automation to reduce or remove the associated costs of the decommissioning process.
Designing your workload to perform automated decommissioning will reduce the overall workload
costs during its lifetime. You can use AWS Auto Scaling
Modern applications
Implementation steps
-
Implement AWS Auto Scaling: For resources that are supported, configure them with AWS Auto Scaling
. AWS Auto Scaling can help you optimize your utilization and cost efficiencies when consuming AWS services. When demand drops, AWS Auto Scaling will automatically remove any excess resource capacity so you avoid overspending. -
Configure CloudWatch to terminate instances: Instances can be configured to terminate using CloudWatch alarms. Using the metrics from the decommissioning process, implement an alarm with an Amazon Elastic Compute Cloud action. Verify the operation in a non-production environment before rolling out.
-
Implement code within the workload: You can use the AWS SDK or AWS CLI to decommission workload resources. Implement code within the application that integrates with AWS and terminates or removes resources that are no longer used.
-
Use serverless services: Prioritize building serverless architectures
and event-driven architecture on AWS to build and run your applications. AWS offers multiple serverless technology services that inherently provide automatically optimized resource utilization and automated decommissioning (scale in and scale out). With serverless applications, resource utilization is automatically optimized and you never pay for over-provisioning.
Resources
Related documents:
Related examples: