

# Sustainability pillar
<a name="sustainability-pillar"></a>

 The sustainability pillar focuses on environmental sustainability. 

 Sustainability in the cloud is a continuous effort focused primarily on energy reduction and efficiency across all components of a workload by achieving the maximum benefit from the resources provisioned and minimizing the total resources required. This effort can include: 
+  The initial selection of an efficient programming language. 
+  The adoption of modern algorithms. 
+  The use of efficient data storage techniques. 
+  The deployment of correctly sized and efficient compute infrastructure. 
+  The minimization of requirements for high-powered end-user hardware. 

# Best practices
<a name="best-practices-5"></a>

The sustainability pillar focuses on environmental impacts, especially energy consumption and efficiency, since they are important levers for architects to inform direct action to reduce resource usage. You can find prescriptive guidance on implementation in the [Sustainability Pillar whitepaper](https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/sustainability-pillar.html?ref=wellarchitected-wp).

**Topics**
+ [Region selection](region-selection.md)
+ [User behavior patterns](user-behavior-patterns.md)
+ [Software and architecture patterns](software-and-architecture-patterns.md)
+ [Data patterns](data-patterns.md)
+ [Hardware patterns](hardware-patterns.md)
+ [Development and deployment process](development-and-deployment-process.md)

# Region selection
<a name="region-selection"></a>

The Region selection best practice focuses on where you will implement your workloads based on both your business requirements and sustainability goals. There are no sustainability practices unique to the container build process for Region selection. Refer to the [Region selection](https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/region-selection.html) best practice from the sustainability pillar of the Well-Architected Framework for more information.

# User behavior patterns
<a name="user-behavior-patterns"></a>

 There are no sustainability practices unique to the container build process for user behavior patterns. Refer to the [user behavior patterns](https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/user-behavior-patterns.html) best practice from the sustainability pillar of the Well-Architected Framework for more information. 

# Software and architecture patterns
<a name="software-and-architecture-patterns"></a>


| CONTAINER\$1BUILD\$1SUSTAINABILITY\$101: How do you design your containerized application in a way that reduces the use of the underlying resources? | 
| --- | 
|   | 

 When designing containerized application, you should keep your build manifests up-to-date and aligned with your application needs. A containerized application image starts from a Dockerfile. The Dockerfile includes all commands required to include the configuration and dependencies for the containerized application. If there are some dependencies that are no longer required, removing them from the Dockerfile can: 
+  Reduce the time that it takes to build the container image. This affects host resource consumption by the build process. 
+  Reduce the container image size and therefore reduce the time it takes for this image to be pulled to an instance. This affects host resources usage for running and storing the container images. 

# Data patterns
<a name="data-patterns"></a>

 There are no sustainability practices unique to the container build process for the data patterns best practice, see the [data patterns](https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/data-patterns.html) best practice from the sustainability pillar of the Well-Architected Framework for more information. 

# Hardware patterns
<a name="hardware-patterns"></a>


| CONTAINER\$1BUILD\$1SUSTAINABILITY\$102: How do you support your containerized application to run on energy-efficient hardware? | 
| --- | 
|   | 

 To be able to [use instance types with the least environmental impact](https://docs.aws.amazon.com/wellarchitected/latest/sustainability-pillar/use-instance-types-with-the-least-impact.html) (from the Sustainability Pillar whitepaper), you have to ensure your containerized application is able to run on a variety of instance types and architectures. This can be done by creating images that support multi-architecture as described in the [Cost Optimization Pillar whitepaper ](https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html). For example, you can use a build service that supports multi-architecture build servers and combine them to a multi-architecture image using the CI pipeline (see Graviton workshop as an [example](https://graviton2-workshop.workshop.aws/en/amazoncontainers.html) of using AWS CodeBuild, and AWS CodePipeline alongside Graviton and Amazon EKS). You can also use tools that generate multi-architecture images from a single Dockerfile, such as [Docker Buildx.](https://docs.docker.com/desktop/multi-arch/) 

# Development and deployment process
<a name="development-and-deployment-process"></a>

 Look for opportunities to reduce your sustainability impact by making changes to your development, test, and deployment practices.  


| CONTAINER\$1BUILD\$1SUSTAINABILITY\$103: How do you design your build tooling and services to improve efficiency of the underlying resources? | 
| --- | 
|   | 

 **Use dynamically created build servers for building your containerized workload** 

 Using dynamically created build servers (such as [AWS CodeBuild](https://aws.amazon.com/codebuild/)), ensures that while building your containerized images, the needed infrastructure is being provisioned when the build process starts, and being terminated as soon as the build process ends. 

 **Use pre-defined or built runtimes to reduce your build time, and reuse needed dependencies for the build process ** 

 When building different types of containerized applications, using common and standardized runtimes for the build process reduces the operational management of creating and maintaining custom images. Also, by using the specific type of runtime for your build server, it verifies that no common dependency is being downloaded and configured as part of the build process. All relevant dependencies are being incorporated into the different runtimes of your build servers, and are being used many times by different build processes for different applications. An example of [multiple build runtimes](https://docs.aws.amazon.com/codebuild/latest/userguide/runtime-versions.html) can be found in the AWS CodeBuild documentation. 

 **Update your parent and base image regularly** 

 Update your base and parent images to the latest versions, as sometimes there is a performance improvement that is introduced in newer versions. These improvements are translated into a sustainability improvement as it affects the resource consumption of the underlying infrastructure, and as a result improves the overall efficiency. 

 **Delete unused or obsolete container images** 

 As described in the [Cost Optimization Pillar whitepaper](https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html), create mechanisms to verify that unused or obsolete container images are deleted. This can be achieved, for example, by registry [lifecycle policies](https://docs.aws.amazon.com/AmazonECR/latest/userguide/lifecycle_policy_examples.html), as exists in [Amazon ECR.](https://aws.amazon.com/ecr/) 

# Resources
<a name="resources-5"></a>

 This section provides companion material for the Container Build Lens with respect to the sustainability pillar. 

**Blogs and documentation**

 General sustainability documentation: 
+  [Ask an Expert - Sustainability](https://aws.amazon.com/blogs/architecture/ask-an-expert-sustainability/) 
+  [AWS Sustainability](https://aws.amazon.com/sustainability/) 

 AWS sustainable documentation: 
+  [Understand resiliency patterns and trade-offs to architect efficiently in the cloud](https://aws.amazon.com/blogs/architecture/understand-resiliency-patterns-and-trade-offs-to-architect-efficiently-in-the-cloud/) 
+  [Optimizing your AWS infrastructure for sustainability, part I: Compute](https://aws.amazon.com/blogs/architecture/optimizing-your-aws-infrastructure-for-sustainability-part-i-compute/) 
+  [Automated cleanup of unused images in Amazon ECR](https://aws.amazon.com/blogs/compute/automated-cleanup-of-unused-images-in-amazon-ecr/) 

**Videos**
+  [AWS re:Invent 2021 - Architecting for sustainability](https://www.youtube.com/watch?v=3-Zq2W1-odU) 
+  [AWS re:Invent 2021 - Behind the Scenes: AWS and sustainability\$1 AWS Events](https://www.youtube.com/watch?v=sTurbjuHV6o) 

**Training materials**

 [Graviton workshop](https://graviton2-workshop.workshop.aws/en/amazoncontainers.html) 