3

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?

  • Isn't the ASG tagged with the ECS cluster name ? (or it's name derived) – Tensibai Jul 3 '17 at 8:31
  • Not necessarily, the only thing that actually couples the ASG to ECS is the configuration file for ecs-agent located on each instance. – Evgeny Jul 3 '17 at 14:03
  • 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 ? – Tensibai Jul 3 '17 at 14:10
  • Someone wrote that tag explicitly in your CloudFormation template. A good idea, I'll adopt it. But it's it there by default. – Evgeny Jul 3 '17 at 14:22
  • I just followed the AWS console wizard to create a sample cluster to test out of curiosity :) – Tensibai Jul 3 '17 at 14:42
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'
  • 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? – Evgeny Nov 1 '17 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.