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

Ability to list all resources by ARN #15

Open
klauern opened this issue Sep 14, 2020 · 4 comments
Open

Ability to list all resources by ARN #15

klauern opened this issue Sep 14, 2020 · 4 comments

Comments

@klauern
Copy link

klauern commented Sep 14, 2020

I've been doing some more exploratory work to discover all of our resources and perform some tagging efforts. The Resource Groups Tagging API supports a TagResources call that allows you to apply tags en masse with a list of ARNs.

https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_TagResources.html

I was hoping to use this tool to list all the resources, apply some tags to them, and then do other automation around those tags. However, it doesn't appear that there's a standard way to return the ARN for the resource that you are listing. I would like to be able to return ARN's for all of these resource types, so I can pass that in to downstream tools.

@jckuester
Copy link
Owner

Hi @klauern,

sorry, for answering so late.

You could try

awsls "*" -a arn

to output the ARN attribute for all resources that have one (otherwise the output is N/A). Note that the first 5 attribute columns in the output are always the same: TYPE ID PROFILE REGION CREATED, and the 6th attribute is then the ARN.

You could then pipe the output then through some tools like awk to get just the ARNs. Did you try something like this?

@jckuester
Copy link
Owner

Hi @klauern again,

I added JSON output support in v0.10.0. This simplifies to just returning the ARN; what you can do now is

awsls <resource_type> -a arn --json | jq '.[] | .arn'

Does this help?

@anovero123
Copy link

May i ask what the status of this request is?

The job stuck with unavailable service:
awsls "*" --profiles=zzh --regions=us-east-1 -a arn --json | jq '.[] | .arn'

Error aws_globalaccelerator_accelerator: operation error Global Accelerator: ListAccelerators, exceeded maximum number of attempts, 3, https response error StatusCode: 0, RequestID: , request send failed, Post "https://globalaccelerator.us-east-1.amazonaws.com/": Service Unavailable

@christonog
Copy link

christonog commented Jan 5, 2022

I also ran into @anovero123's issue just now. Running in debug mode shows:

   • start listing resources   profile= region=us-east-1 type=aws_globalaccelerator_accelerator
Error aws_globalaccelerator_accelerator: operation error Global Accelerator: ListAccelerators, exceeded maximum number of attempts, 3, https response error StatusCode: 0, RequestID: , request send failed, Post "https://globalaccelerator.us-east-1.amazonaws.com/": dial tcp: lookup globalaccelerator.us-east-1.amazonaws.com on [2605:a601:a6dc:7400::1]:53: no such host
   • start listing resources   profile= region=us-east-1 type=aws_glue_crawler
   • start listing resources   profile= region=us-east-1 type=aws_glue_dev_endpoint

Seems to hang at the aws_glue_dev_endpoint resource listing.

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

4 participants