Optimize your workloads for Sustainability
Tags: aws, sustainability, architecture
Published: 2022-05-02 14:07:49

Sustainability means "meeting the needs of the present without compromising the ability of future generations to meet their needs," according to the Brundtland Commission. For cloud sustainability, it means addressing the long-term environmental, economic, and societal impact of your business activities. Last year at re:invent 2021 AWS introduced the new [Sustainability Pillar](https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/sustainability-pillar.html) for [AWS Well-Architected Framework](https://aws.amazon.com/architecture/well-architected/) and at the beginning of this year AWS introduced the [AWS Customer Carbon Footprint](https://aws.amazon.com/blogs/aws/new-customer-carbon-footprint-tool/) Tool. According to the energy transition plan, Amazon is on the path to powering its operations with 100% renewable energy by 2025. But environmental sustainability [is a shared responsibility](https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/the-shared-responsibility-model.html) between you and AWS. This means that AWS maintains the sustainability of the cloud by delivering efficient, shared infrastructure, and you should optimize your workload to efficiently use these resources.

In this post, I will use the design principles for sustainability in the cloud from the Sustainability Pillar of the Well-Architected Framework to explain how to design your workloads to maximize sustainability and minimize impact.

Design Principles:

*   Understand your impact.
*   Establish sustainability goals.
*   Maximize utilization.
*   Anticipate and adopt new, more efficient hardware and software offerings.
*   Use managed services.
*   Reduce the downstream impact of your cloud workloads.

### Understand your impact

Understand your workload’s environmental impact using metrics to see if you meet your sustainability goals:

*   [AWS Customer Carbon Footprint](https://aws.amazon.com/blogs/aws/new-customer-carbon-footprint-tool/) Tool
*   [AWS Compute Optimizer now offers resource efficiency metrics](https://aws.amazon.com/about-aws/whats-new/2021/11/aws-compute-optimizer-resource-efficiency-metrics/)
*   [RDS Utilization Metrics](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/monitoring-cloudwatch.html)

### **Establish sustainability goals**

Establishing short and long-term sustainability goals for your workload, such as reducing the computed resources required per transaction or improving the power efficiency of your compute workload, reducing the network data traveled per request. For example, even if you are not able to go serverless with your application in the first step, you can start to decouple parts of your workload and create small functions to get there in the long run. Other options would include containerizing your workloads or improving the energy efficiency of your compute load by moving to Graviton2-based instances and/or functions. There are multiple transformation guides for transitioning workloads to AWS Graviton2 ([EC2](https://github.com/aws/aws-graviton-getting-started/blob/main/transition-guide.md), [Lambda](https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-to-arm-based-aws-graviton2-processors/), [RDS & Aurora](https://aws.amazon.com/blogs/database/key-considerations-in-moving-to-graviton2-for-amazon-rds-and-amazon-aurora-databases/) ). [Here is also a nice list of AWS services where graviton processors are available](https://github.com/aws/aws-graviton-getting-started/blob/main/managed_services.md).

To reduce the network data traveled per request, I can recommend you to use a CDN. When requested, the static content is cached from the original server and delivers it to the user. This shortens the distance each packet has to travel. If you use CloudFront as your CDN, you should also [enable automatic compression](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html) - it will compress certain types of files and serve the compressed objects when viewers support them.

### **Maximize utilization**

Use tools like [AWS lambda power tuning](https://github.com/alexcasalboni/aws-lambda-power-tuning), and [AWS Compute Optimizer](https://aws.amazon.com/compute-optimizer/) to right-size your resources. In addition, you should use Auto Scaling to automatically scale up and down based on demand. To improve the overall resource efficiency and reduce idle capacity in the entire Cloud AWS, use [Amazon EC2 Spot Instances](https://aws.amazon.com/aws-cost-management/aws-cost-optimization/spot-instances/)**.** Spot Instances are unused EC2 capacity in AWS, this instance also gives you up to a 90% discount compared to On-Demand prices. If you are using EKS you should follow the [EKS Best Practices Guides](https://aws.github.io/aws-eks-best-practices/) - especially the Auto Scaling guide to improve the utilization of your nodes. Moreover, you should generally adopt a serverless, event-driven architecture to maximize overall resource utilization.

To improve the utilization of your AWS storage layer, you should analyze data access patterns to move the storage to different storage classes, with efficient long-term storage, you will optimize your storage footprint. To automatically move the data to another storage class or delete unused data, you can use lifecycle configurations. The following services can configure the lifecycle of your data:

*   [s3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html)
*   [EBS](https://docs.aws.amazon.com/de_de/AWSEC2/latest/UserGuide/snapshot-lifecycle.html)
*   [Backup](https://docs.aws.amazon.com/aws-backup/latest/devguide/API_Lifecycle.html)
*   [DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html)

### **Anticipate and adopt new, more efficient hardware and software offerings**

As already mentioned in the Establish sustainability goals section, you should always make sure to use the latest hardware generation such as Graviton processors, or when it comes to GPU usage you should use flexible graphics acceleration rather than dedicated GPU instances. The same counts for your software and its dependencies. Not only from the security aspect, you should always stay up to date or maybe change to a newer programming language that uses hardware resources even more efficiently.

### **Use managed services**

Use managed services, such as [Amazon MSK Serverless (GA since 28 April 2022)](https://aws.amazon.com/blogs/aws/amazon-msk-serverless-now-generally-available-no-more-capacity-planning-for-your-managed-kafka-clusters/), [Amazon Aurora Serverless v2](https://aws.amazon.com/rds/aurora/serverless/), or [Amazon SageMaker Serverless Inference](https://aws.amazon.com/about-aws/whats-new/2021/12/amazon-sagemaker-serverless-inference/?nc1=h_ls), to help distributing workloads while reducing the overall amount of infrastructure required. This also shifts the responsibility of sustainability optimization to AWS.

### **Reduce the downstream impact of your cloud workloads**

To reduce the amount of energy that is required to use your services always stay up to date with the evolution of hardware and software features like:

*   Use efficient programming languages like [Rust](https://aws.amazon.com/blogs/opensource/sustainability-with-rust/)
*   Use efficient processors to run your workloads like [Graviton](https://aws.amazon.com/ec2/graviton/) - the newest generation 3 will consume up to 60% less energy than the generation 2
*   Analyze the performance of your application using CloudWatch Logs Insights to find the performance guzzler

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jcfurqk28rstubwqc4zb.jpeg)

We at globaldatanet also want to contribute to making the world a little greener and better. Therefore, we have decided to work with Eden Reforestation Projects, one of the world's best reforestation partners, and from now on we will plant 1000 new trees every single month. If you want to learn more about that, have a look at our [sustainability](https://globaldatanet.com/sustainability) page.