Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX included] Getting group name didn't work for me #2

Open
slikk66 opened this issue Jan 13, 2016 · 0 comments
Open

[FIX included] Getting group name didn't work for me #2

slikk66 opened this issue Jan 13, 2016 · 0 comments

Comments

@slikk66
Copy link

slikk66 commented Jan 13, 2016

Even after adding IAM permission for:
Action('autoscaling', 'DescribeAutoScalingInstances'),

My "group" was coming back blank and was not submitting a metric for the ASG, only for the instance. In another part of my project, I got the ASG name of of the instance tags. I've re-written your _get_auto_scaling_group_name() method using the code from our project and now it's working.

Thanks!!

    def _get_auto_scaling_group_name(self, instance_id, region):

        conn = boto.ec2.connect_to_region(region)

        # figure out tags for current instance and pick out the ASG name
        self_filters = {
            'resource-type': 'instance',
            'resource-id': instance_id}

        tags = conn.get_all_tags(filters=self_filters)
        asg_tags = [
            tag
            for tag in tags if tag.name == u'aws:autoscaling:groupName']

        asg_name = None

        # if ASG tag found, return it
        if len(asg_tags) == 1:
            asg_name = asg_tags[0].value
            print "AsgFound: "+asg_name

        return asg_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant