Destroy HC AWS

Destroys a HyperShift HostedCluster and its associated AWS infrastructure resources.

538|560|Updated Jan 18, 2021
One-click install
npx skills add https://github.com/openshift/hypershift --skill destroy-hc-aws
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Destroy HC AWS
Source: https://github.com/openshift/hypershift/tree/main/.claude/skills/dev/destroy-hc-aws
Command: npx skills add https://github.com/openshift/hypershift --skill destroy-hc-aws

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tearing down a HyperShift HostedCluster on AWS involves removing many cloud resources (VPCs, subnets, NAT gateways, IAM roles, Route53 zones, OIDC providers), and manual cleanup is error-prone and often leaves orphaned resources that incur costs.

Core Features & Use Cases

  • Full Cluster Teardown: Runs hypershift destroy cluster aws to delete the HostedCluster, NodePools, HostedControlPlane namespace, and all AWS infrastructure.
  • Comprehensive AWS Cleanup: Removes VPCs, subnets, NAT and internet gateways, route tables, security groups, DHCP options, Route53 private hosted zones, OIDC providers, IAM roles, VPC endpoints, and Elastic IPs.
  • Orphaned Cluster Recovery: Provides a force-removal path for stuck HostedClusters by removing the cleanup-cloud-resources annotation.
  • Use Case: After finishing an end-to-end test run, destroy the test HostedCluster my-test-cluster in the clusters namespace so no AWS resources keep billing.

Quick Start

Ask the assistant to destroy the HostedCluster named my-test-cluster in the clusters namespace on AWS using the configured management kubeconfig and AWS credentials.

Frequently Asked Questions about Destroy HC AWS

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I destroy a HyperShift HostedCluster on AWS?

Run `./bin/hypershift destroy cluster aws --name <CLUSTER_NAME> --namespace <NAMESPACE> --aws-creds $AWS_CREDENTIALS --region $AWS_REGION` with KUBECONFIG pointing to the management cluster. Source your AWS credentials first so the CLI can delete cloud resources.

What AWS resources does hypershift destroy cluster remove?

It removes the HostedCluster and NodePools, the HostedControlPlane namespace, VPCs and subnets, NAT and internet gateways, route tables, security groups, DHCP options, Route53 private hosted zones, the OIDC provider, IAM roles and instance profiles, VPC endpoints, and Elastic IPs.

How do I force delete a stuck HostedCluster?

Remove the cleanup-cloud-resources annotation with `kubectl annotate hostedcluster <NAME> -n <NAMESPACE> hypershift.openshift.io/cleanup-cloud-resources-` to skip cloud cleanup. You can then manually delete any remaining AWS resources.

Why does HostedCluster deletion hang on NAT gateways or VPC dependencies?

NAT gateways take time to delete and VPCs cannot be removed until dependent subnets and gateways are gone. The destroy command retries automatically until all dependencies are deleted, so waiting usually resolves it.

What prerequisites are needed before destroying a HostedCluster?

You need sourced AWS credentials, a KUBECONFIG pointing to the management cluster, and the built hypershift binary at ./bin/hypershift. The environment file dev/claude-env.sh provides the relevant variables.