Skip to content

Commit 32fef17

Browse files
committed
addressing comments
1 parent f1215bb commit 32fef17

File tree

2 files changed

+43
-19
lines changed

2 files changed

+43
-19
lines changed

content/well-architected-framework/docs/docs/define-and-automate-processes/automate/cicd.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ In this section of Automate your workflows, you learned how to implement CI/CD p
3131

3232
Visit the following documents to learn more about the automation workflow:
3333

34-
- [Automate testing](/well-architected-framework/define-and-automate-processes/automate/testing) - Implement automated testing in your CI/CD pipeline
35-
- [Automate deployments](/well-architected-framework/define-and-automate-processes/automate/deployments) - Deploy applications through your CI/CD pipeline
36-
- [Running Terraform in automation](/terraform/tutorials/automation/automate-terraform)
34+
- [Automate testing](/well-architected-framework/define-and-automate-processes/automate/testing) in your CI/CD pipelines
35+
- [Automate application deployments](/well-architected-framework/define-and-automate-processes/automate/deployments through your CI/CD pipeline
36+
- Learn how to orchestrate [Terraform runs](/terraform/tutorials/automation/automate-terraform) to ensure consistency between runs.

content/well-architected-framework/docs/docs/optimize-systems/lifecycle-management/decommission-infrastructure.mdx

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ When you decommission unused resources, you gain the following benefits:
1515

1616
To successfully decommission resources, you need to create a well-defined plan that includes dependency analysis, stakeholder communication, and a gradual removal process. Depending on how your infrastructure implementation is done, either manually or automatically, you may need to adjust your decommissioning approach.
1717

18-
## Find resources to decommission
19-
20-
Before you begin decommissioning resources, you need to identify which resources exist in your environment and determine which ones are candidates for removal. This discovery phase helps you avoid accidentally removing resources that are still in use and ensures you target the right components for decommissioning.
21-
22-
Start by creating an inventory of your infrastructure. Most cloud providers offer resource tagging and billing reports that help identify unused or underutilized resources. Pay particular attention to active resources created for temporary purposes, like testing or proof-of-concepts.
23-
24-
Terraform tracks all infrastructure it manages with state files. You can use the `terraform state list` to see all managed resources and `terraform show` to examine their current configurations. This list of resources will help you identify which resources are still in use and which ones you can decommission.
25-
26-
## Create a communication plan
27-
28-
Your plan should outline how you will inform stakeholders about the decommissioning process, including timelines and potential impacts. Effective communication prevents surprises and ensures all affected teams can prepare for the changes.
29-
30-
Start by identifying all stakeholders who might be affected by the decommissioning, including development teams, operations staff, end users, and business owners. Create a notification timeline that provides adequate warning. Your communications should explain what resources you are removing, when the decommissioning will occur, and what actions stakeholders need to take.
31-
3218
## Create a dependency plan
3319

3420
Your plan should analyze which services, applications, or other resources rely on the components you plan to remove. Your plan will lower the risk of unexpected outages by identifying and addressing dependencies before decommissioning.
@@ -49,7 +35,24 @@ You need to install Graphviz on your system to use the `terraform graph` command
4935

5036
HashiCorp resources:
5137

52-
- [Terraform Graph Command](/terraform/docs/cli/commands/graph)
38+
- [Terraform graph command](/terraform/docs/cli/commands/graph)
39+
40+
## Find resources to decommission
41+
42+
Before you begin decommissioning resources, you need to identify which resources exist in your environment and determine which ones are candidates for removal. This discovery phase helps you avoid accidentally removing resources that are still in use and ensures you target the right components for decommissioning.
43+
44+
Start by creating an inventory of your infrastructure. Most cloud providers offer resource tagging and billing reports that help identify unused or underutilized resources. Pay particular attention to active resources created for temporary purposes, like testing or proof-of-concepts.
45+
46+
Terraform tracks all infrastructure it manages with state files. You can use the `terraform state list` to see all managed resources and `terraform show` to examine their current configurations. This list of resources will help you identify which resources are still in use and which ones you can decommission.
47+
48+
If you're using HCP Terraform, you can use the [workspace explorer](/terraform/cloud-docs/workspaces/explorer) feature to gain visibility into the resources your organization manages with Terraform. The explorer provides a visual representation of your infrastructure, making it easier to identify resources that you no longer need.
49+
50+
51+
## Create a communication plan
52+
53+
Your plan should outline how you will inform stakeholders about the decommissioning process, including timelines and potential impacts. Effective communication prevents surprises and ensures all affected teams can prepare for the changes.
54+
55+
Start by identifying all stakeholders who might be affected by the decommissioning, including development teams, operations staff, end users, and business owners. Create a notification timeline that provides adequate warning. Your communications should explain what resources you are removing, when the decommissioning will occur, and what actions stakeholders need to take.
5356

5457
## Create backups
5558

@@ -72,6 +75,27 @@ resource "aws_instance" "example" {
7275
}
7376
```
7477

78+
You can also use Terraform to create [AWS EBS snapshots](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ebs_snapshot) before decommissioning instances. The following example creates an EBS snapshot of the root volume of an EC2 instance:
79+
80+
```hcl
81+
resource "aws_ebs_volume" "example" {
82+
availability_zone = "us-west-2a"
83+
size = 40
84+
85+
tags = {
86+
Name = "HelloWorld"
87+
}
88+
}
89+
90+
resource "aws_ebs_snapshot" "example_snapshot" {
91+
volume_id = aws_ebs_volume.example.id
92+
93+
tags = {
94+
Name = "HelloWorld_snap"
95+
}
96+
}
97+
```
98+
7599
## Gradually remove resources
76100

77101
Implement a phased approach to removing resources instead of doing it all at once. Start by redirecting traffic away from the resource, and monitor user traffic to ensure you don't negatively impact users.
@@ -87,7 +111,7 @@ resource "aws_instance" "example" {
87111
}
88112
89113
lifecycle {
90-
prevent_destroy = true
114+
prevent_destroy = true
91115
}
92116
```
93117

0 commit comments

Comments
 (0)