Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS API Get Any Resource By ARN

I have a bunch AWS resource ARNs. I can easily write a switch/case statement on the namespace of the ARN and call the appropriate describeXYZ method on the correct AWS API class to get the resource details. But is there a way of taking any arbitrary ARN and getting a description for it? Something like aws.describeResource({arn:myArn}, callback)?

like image 620
Jeff Avatar asked Sep 15 '16 13:09

Jeff


People also ask

How do I get resource Arn AWS?

To get an ARN from the AWS Management Console, navigate to the resource you want an ARN for, and view the details for that resource. For example, you can get the ARN for a DB instance from the Configuration tab of the DB instance details, as shown following.

Does API gateway have Arn?

The following tables list the Amazon Resource Names (ARNs) for API Gateway resources. To learn more about using ARNs in AWS Identity and Access Management policies, see How Amazon API Gateway works with IAM and Control access to an API with IAM permissions.

How do I search AWS resources?

Sign in to the AWS Management Console and open the AWS Config console at https://console.aws.amazon.com/config/ . On the Resource inventory page, specify the search options for the resources that you want to look up: Resource category – Choose all resource categories or narrow results to only AWS Resources.


1 Answers

I don't know what description exactly you are looking for, I don't know of the existence of such service. However, the ARN itself includes some information that could or could not be helpful to you, if you parse it, you could get at least:

  • Service
  • Region
  • Account ID
  • Type of Resource
  • Resource Name

For example

arn:aws:iot:us-west-2:27401367543654:policy/MyApplicationDefaultPolicy
         ^      ^          ^           ^                ^
         |      |          |           |                |
      Service Region   AccountID  ResourceType     ResourceName

Sorry if this is not enough, is the best I can think of right now.

From here you can get a more detailed description: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-arns

arn:partition:service:region:account-id:resource
arn:partition:service:region:account-id:resourcetype/resource
arn:partition:service:region:account-id:resourcetype:resource
like image 176
Max Hanglin Avatar answered Nov 08 '22 00:11

Max Hanglin