Answers: <p>Example in AWS cli that should work to get the ASG name</p>
  
  <pre><code>a=curl 'http://169.254.169.254/latest/meta-data/instance-id'; aws autoscaling describe-auto-scaling-instances --instance-ids $a --query 'AutoScalingInstances[*].AutoScalingGroupName'
  </code></pre>
  
Answers: CC BY-SA 3.0
Answers: 2017-11-01T09:24:26.993Z
Answers: Provided this is sent from the same instance as the service is running at. What about an external script that needs to figure out this information?
Answers: Evgeny Zislis
Answers: CC BY-SA 3.0
Answers: 2017-10-31T13:21:17.900Z
Answers: 2017-10-31T13:21:17.900Z
Answers: Vorsprung
Answers: <p>Here I ran for ap-south-1 region-</p>
  
  <p>a=<code>curl 'http://169.254.169.254/latest/meta-data/instance-id'c ; 
    aws autoscaling describe-auto-scaling-instances --instance-ids $a --query 'AutoScalingInstances[0].AutoScalingGroupName' --region ap-south-1</code></p>
  
Answers: CC BY-SA 4.0
Answers: 2020-03-02T12:16:58.230Z
Answers: 2020-03-02T16:51:32.613Z
Answers: 2020-03-02T16:51:32.613Z
Answers: user19994
Body: <p>We are looking to inspect the ASG EC2 CloudWatch metrics such as CPU and Memory, since it includes an aggregate of all the ASG instances.</p>
  
  <p>Given that we know the ECS cluster, or the ECS service name. Which API calls would be needed to figure out the name of the Auto Scaling Group and its CloudWatch metrics?</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-07-03T08:31:53.907Z
Comments: Isn't the ASG tagged with the ECS cluster name ? (or it's name derived)
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-07-03T14:03:49.333Z
Comments: Not necessarily, the only thing that actually couples the ASG to ECS is the configuration file for `ecs-agent` located on each instance.
Comments: Evgeny Zislis
Comments: CC BY-SA 3.0
Comments: 2017-07-03T14:10:38.563Z
Comments: Just done a quick test, but my ASG has a tag  `aws:cloudformation:stack-name` wich is valued with `EC2ContainerService-<my-cluster-name>`. Did I miss a point ?
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-07-03T14:22:32.873Z
Comments: Someone wrote that tag explicitly in your CloudFormation template. A good idea, I'll adopt it. But it's it there by default.
Comments: Evgeny Zislis
Comments: CC BY-SA 3.0
Comments: 2017-07-03T14:42:44.237Z
Comments: I just followed the AWS console wizard to create a sample cluster to test out of curiosity :)
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-07-03T14:44:09.740Z
Comments: And as far as I can tell, every cloudformation stack get this `aws:cloudformation:stack-name` tag automatically.
Comments: Tensibai
Tags: <amazon-ec2><amazon-cloudwatch><amazon-ecs>
Title: What is the best way to find the Auto Scaling Group of an ECS cluster?
UserDisplayName: Evgeny Zislis
ThreadText: # What is the best way to find the Auto Scaling Group of an ECS cluster?
  
  (Asked by: username_0 on 2017-07-02)
  
  We are looking to inspect the ASG EC2 CloudWatch metrics such as CPU and Memory, since it includes an aggregate of all the ASG instances.
  
  Given that we know the ECS cluster, or the ECS service name. Which API calls would be needed to figure out the name of the Auto Scaling Group and its CloudWatch metrics?
  
  **Tags:** amazon-ec2, amazon-cloudwatch, amazon-ecs
  
  > **Comments:**
  > **username_1**: Isn't the ASG tagged with the ECS cluster name ? (or it's name derived)  
  > **username_0**: Not necessarily, the only thing that actually couples the ASG to ECS is the configuration file for `ecs-agent` located on each instance.  
  > **username_1**: Just done a quick test, but my ASG has a tag  `aws:cloudformation:stack-name` wich is valued with `EC2ContainerService-<my-cluster-name>`. Did I miss a point ?  
  > **username_0**: Someone wrote that tag explicitly in your CloudFormation template. A good idea, I'll adopt it. But it's it there by default.  
  > **username_1**: I just followed the AWS console wizard to create a sample cluster to test out of curiosity :)  
  > **username_1**: And as far as I can tell, every cloudformation stack get this `aws:cloudformation:stack-name` tag automatically.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-10-31. Score: 2
  
  Example in AWS cli that should work to get the ASG name
  
  ```
  a=curl 'http://169.254.169.254/latest/meta-data/instance-id'; aws autoscaling describe-auto-scaling-instances --instance-ids $a --query 'AutoScalingInstances[*].AutoScalingGroupName'
  
  ```
  
  > **Comments:**
  > **username_0**: Provided this is sent from the same instance as the service is running at. What about an external script that needs to figure out this information?  
  
  ---
  
  ### Answer by username_3 on 2020-03-02. Score: 0
  
  Here I ran for ap-south-1 region-
  
  a=`curl 'http://169.254.169.254/latest/meta-data/instance-id'c ;
  aws autoscaling describe-auto-scaling-instances --instance-ids $a --query 'AutoScalingInstances[0].AutoScalingGroupName' --region ap-south-1`
  
  
  ---
  
  