How can I find the arn of an api gateway stage?
Asked Answered
S

2

34

I am trying to use awscli to add tags to my api gateway stage https://docs.aws.amazon.com/cli/latest/reference/apigateway/tag-resource.html

I am required to supply the --resource-arn for the stage, however I am unable to ascertain this value.

I have tried using both awscli and the console to determine this value, but have been unable to find what the arn for the api gateway stage is. I have also tried guessing based off arn pattern/formats.

How can I determine this value, or alternatively what is the format for this arn?

Spirelet answered 30/1, 2018 at 5:3 Comment(1)
Have you checked out this page? docs.aws.amazon.com/general/latest/gr/…Eke
S
43

I finally found the format for an api gateway stage at aws docs for set up tags via the API Gateway REST API.

The format for the ARN is arn:aws:apigateway:{region}::/restapis/{rest_api_id}/stages/{stage_name}

Spirelet answered 30/1, 2018 at 23:29 Comment(7)
An edit was put to refer to docs.aws.amazon.com/general/latest/gr/… I had already look at this page and it lacks the detail that I needed to determine the ARNSpirelet
Just had to figure this out, this is the only place I can find with the actual answer. I see nothing in AWS docs explaining why you need the /restapis and /stages strings in the ARN, plus you must leave out the account ID. A life saver...Trawick
I actually found that it worked with the account id.Perkoff
docs.aws.amazon.com/apigateway/latest/developerguide/… Only API Gate way specific ARN formatsZolly
the AWS docs are frustratingly unclear at times :<Fleer
New info with help on this: aws.amazon.com/blogs/devops/…Augustina
Every other service I use has a templated page with a header section giving many details always including the ARN with a little copy icon that you can click to copy the ARN to the clipboard. But API Gateway? No, we're special. We're different. We're better.Kleenex
G
1

At the very bottom there are samples for different APIGW artifacts, last one is stage.

arn:aws:apigateway:region::/restapis/api-id/stages/stage-name

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-create-and-manage-api.html

Getraer answered 5/2, 2019 at 17:35 Comment(1)
That link now redirects to the developer guide welcome page. Possibly this link may be the kind of content that was intended and is more useful now at any rate: docs.aws.amazon.com/apigateway/latest/developerguide/…Kleenex

© 2022 - 2025 — McMap. All rights reserved.