Amazon Web Services (AWS) - Delete Target Groups using the AWS CLI

by
Jeremy Canfield |
Updated: July 20 2023
| Amazon Web Services (AWS) articles
An Elastic Load Balancer (ELB) is typically used to load balance requests across two (or more) different EC2 instances.
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
The aws elbv2 describe-target-groups command can be used to list the Target Groups that have been created. You will use the ARN (Amazon Resource Name) to delete the Target Group.
~]$ aws elbv2 describe-target-groups
{
"TargetGroups": [
{
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:713512344252:targetgroup/my-target-group/b12348d3a5abcd1d",
"TargetGroupName": "my-target-group",
"Protocol": "HTTP",
"Port": 80,
"VpcId": "vpc-0141234fa33abcd01",
"HealthCheckProtocol": "HTTP",
"HealthCheckPort": "traffic-port",
"HealthCheckEnabled": true,
"HealthCheckIntervalSeconds": 30,
"HealthCheckTimeoutSeconds": 5,
"HealthyThresholdCount": 5,
"UnhealthyThresholdCount": 2,
"HealthCheckPath": "/",
"Matcher": {
"HttpCode": "200"
},
"LoadBalancerArns": [],
"TargetType": "instance",
"ProtocolVersion": "HTTP1",
"IpAddressType": "ipv4"
}
]
}
The aws elbv2 delete-target-group command can be used to delete a target group using the ARN (Amazon Resource Name) of the Target Group.
aws elbv2 delete-target-group --target-group-arn arn:aws:elasticloadbalancing:us-east-1:713512344252:targetgroup/my-target-group/b12348d3a5abcd1d
Did you find this article helpful?
If so, consider buying me a coffee over at