Sustainability on AWS
Tags: aws, finops, communitybuilders, sustainability
Published: 2023-12-11 21:20:10

Sustainability is the new topic on AWS. While it has a lot in common with [FinOps](https://www.finops.org/introduction/what-is-finops/), it adds emphasis to different areas.

Traditional FinOps focuses on the most cost-efficient uses of your resources, utilizing Reserved Instances to prepay specific instance types for 3 years, which in return AWS gives up to a 50% discount on the price. The newer Savings Plan allows you to allocate a minimum amount of Compute & Memory Hours. You can combine EC2 with containers running on Fargate.

Many FinOps companies focus on optimizing this process by analyzing your usage and using scale to get more discounts.

For sustainability, although most FinOps rules apply, money is not the primary driver. In FinOps, you don't spend $1000 in time to save $10/month, while for sustainability, a re-architecture can be a valid outcome.

## "Do I really need..."

Sustainability starts with this question; ask yourself or your team:

- Do I really need this?
- Do I really need this large instance?
- Do I really need to use this Intel-based compute, or can I use modern architectures?
- Do I really need my dev environment running for 24/7?
- Do I really need this service, or can I use serverless?
- Do I really need this data?
- Do I really need to run my application in this region, or is there a more sustainable region?
- ...

### ... Unused

The quickest way to save money and reduce your footprint is to remove all unnecessary resources. You can use AWS Trusted Advisor or AWS Config to help you identify unused resources.

### ... Instance

Using smaller instances can reduce your footprint (and cost). [AutoScaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html) can add more compute when you need it without any manual intervention. Check the CPU usage of your instance; if it is < 50%, this can be a candidate for downscaling.

### ... Intel vs. Arm

Most DevOps will use the Intel instances as standard (or maybe the AMD). But AWS has been developing its own CPUs together with ARM, called Graviton. Graviton3 was released at Re:Invent 2023 and promises a 25% increase in performance, 67% lower workload carbon intensity, and a 20% lower price than comparable Intel-based servers.

You can't run your Intel-based binaries on it, but most (open-source) software does support it. Apple Mac models M1/M2/M3 are also based on ARM; the support after the initial start is so good that few notice the difference.

Besides EC2, AWS supports Graviton-based services for:

- Elasticache
- Aurora
- RDS
- OpenSearch
- EMR
- EKS
- MemoryDB
- Fargate

And lastly, Lambda; almost all [runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) support ARM. Switching is easy; just try it out and see the difference.

[AWS Graviton Resources](https://aws.amazon.com/ec2/graviton/resources) [Graviton3 Savings](https://newsroom.arm.com/aws-graviton-decarbonize-compute)

### ... Offhours

Most non-prod environments are not used after work hours. Running them only 5x10 hours instead of 7x24 is a 70% cost reduction.

You can use autoscaling, custom lambdas, but for a large environment, [CloudCustodian](https://cloudcustodian.io/docs/aws/examples/offhours.html#offhours) offers a fine-grained set of policies to automatically turn off instances, databases, etc. You can define tags to apply the schedule or opt-out.

And if you need a machine, it's easy to start it manually or create a lambda with a function URL that starts a stack for you.

### ... Serverless

Serverless is great for event-driven architecture. A container built with Spring Boot and listens on an SQS queue can work perfectly. But if you get fewer than a message a minute, a lambda is a great alternative. The great thing about (most) serverless services is that they don't cost anything when not used. There is no need for scale down/cost optimizing.

### ... Regions

_We are determined to be inventive and relentless, as we work to make the cloud the cleanest and most energy-efficient way to run all of your infrastructure and your business._ Adam Selipsky, CEO, AWS

Not all regions are yet on 100% renewable energy; the following are as of 2022.

- U.S. East (Northern Virginia)
- GovCloud (U.S. East)
- U.S. East (Ohio)
- U.S. West (Oregon)
- GovCloud (U.S. West)
- U.S. West (Northern California)
- Canada (Central)
- Europe (Ireland)
- Europe (Frankfurt)
- Europe (London)
- Europe (Milan)
- Europe (Paris)
- Europe (Stockholm)
- Europe (Spain)
- Europe (Zurich)
- Asia-Pacific (Mumbai)
- Asia-Pacific (Hyderabad)

If your region is not here, check the latest updates from AWS. But if you want to reduce your carbon footprint, a change can be required.

[AWS Sustainability](https://sustainability.aboutamazon.com/products-services/the-cloud?energyType=true#renewable-energy)

### ... Data

Know your requirements for data, backup, and logs. Utilize [Lifecycle](https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html) policies to archive or delete after a fixed time.

[S3](https://aws.amazon.com/s3/storage-classes/)/[EFS](https://docs.aws.amazon.com/efs/latest/ug/availability-durability.html) are offering different Tiers; select the right tier that fits your requirements, but be sustainable. Logs don't need the 11 9s service of the standard S3 Tier.

### ... Others

Take a critical look at your architecture; something that was state-of-the-art 2 years ago can be done differently with sustainability in mind.

Rust is a compiled language that excels in super-fast execution. If your process runs faster, it uses less CPU/memory and thereby reduces your footprint. Many internal services of AWS are rewritten in Rust to add more security and speed.

## Well-Architected Sustainability Workshop

Sustainability is the 6th pillar of the Well-Architected Framework. To get some more insight behind the questions, there is a [workshop](https://catalog.workshops.aws/well-architected-sustainability/en-US). This workshop contains some labs to practice with Graviton but also on how to build dashboards to get insights.

## Carbon Footprint Tools

The AWS [tools](https://aws.amazon.com/aws-cost-management/aws-customer-carbon-footprint-tool/) to give insight into the footprint are still very basic. Currently, it gives the result with a 3-month delay. At Re:Invent, I heard some rumors that might change, but there is no announcement yet.

There are many commercial products, but I want to highlight the open-source [Cloud Carbon Footprint](https://www.cloudcarbonfootprint.org/); it's a multicloud tool that calculates the CO2 usages based on the cloud billing.

## Conclusion

Sustainability is as important for some companies as designing for Performance, Reliability, Security, Cost Control, and Operational Excellence. With the new EU laws targeting companies starting with the large public ones, sustainability will be a boardroom topic.

Reporting your cloud footprint will be as important as reporting your cloud cost. But there will be legal requirements to reduce your footprint.

Sustainability is the saving future for all of us.


_ps: No ChatGPT was used writing this post_