Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a "stage" in the context of Amazon API Gateway?

What is a "stage" in the context of Amazon API Gateway? What is it's purpose and how to create one?

Is there any relation to "staging" in the production/staging/development convention?

like image 884
american-ninja-warrior Avatar asked Dec 16 '17 18:12

american-ninja-warrior


People also ask

What is stage name API gateway?

An API stage is a logical reference to a lifecycle state of your API (for example, dev , prod , beta , or v2 ). API stages are identified by their API ID and stage name, and they're included in the URL you use to invoke the API.

How do I add a stage variable to API gateway?

To declare stage variables using the API Gateway consoleCreate an API, create a GET method on the API's root resource, if you have not already done so. Set the HTTP Endpoint URL value as " http://${stageVariables.url} ", and then choose Save. Choose Deploy API. Choose New Stage and enter " beta " for Stage name.

What is the function of Amazon API gateway?

Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. APIs act as the "front door" for applications to access data, business logic, or functionality from your backend services.


2 Answers

Although you can use Stages as part of a different stages in your pipeline or environments this goes against AWS best practice for managing environments.

If you want a development environment, then create a development user/account and deploy using that. Likewise other environments like Production or Pre-Production.

I also wouldn't want to use Stages for versioning my APIs. (As versioning REST APIs is a huge anti-pattern)

Which does then beg the question about what Stages actually are in AWS gateways used for? Whenever i've used them I've out a sensible placeholder there.

like image 86
tommyk Avatar answered Sep 20 '22 10:09

tommyk


I would consider API Gateway stages as different stages in your pipeline or different environments of your stack for the same application. You can have as many stages as you want. In a simple stack, we can think of 3 stages: dev, qa and prod. Few things which you can do with stages:

  1. You will have different URL's for each stage. like https://api-gateway-domain/dev/... , https://api-gateway-domain/qa/..,https://api-gateway-domain/prod/... Basically the URL would be https://api-gateway-domain/<stage_name>/...
  2. You can go with custom domain names to associate with each stage.
  3. You can associate different usage plans for each stage.
  4. You will mostly have at least 1 stage variable to define your stage uniquely. This could be an Elastic Beanstalk URL which is different for each environment. Through stage variables, you will be calling different backend URL's for each stage.
  5. You can deploy different versions of API Gateway configurations for that application to different stages.
like image 30
Avichal Badaya Avatar answered Sep 19 '22 10:09

Avichal Badaya