API Gateway Stage variables

  • Stage variables are name-value pairs that you can define as configuration attributes associated with a deployment stage of a REST API. They act like environment variables and can be used in your API setup and mapping templates.
  • For example, you can define a stage variable in a stage configuration, and then set its value as the URL string of an HTTP integration for a method in your REST API. Later, you can reference the URL string using the associated stage variable name from the API setup. This way, you can use the same API setup with a different endpoint at each stage by resetting the stage variable value to the corresponding URLs. You can also access stage variables in the mapping templates, or pass configuration parameters to your AWS Lambda or HTTP backend.
  • You can stage variable is defined as the name of the configuration attributes associated with the deployment phase of the REST API - value pairs. They are similar to the function of environment variables that can be used to set and API mapping templates.
  • For example, you can define a variable phase in stage configuration, and then for the REST API Method set its value to the integrated HTTP URL string. After that, you can use the API to set the stage associated with the variable name to reference the URL string. Thus, you can reset the stage variable value corresponding to the URL, using the same API set for different terminal node at each stage. In addition, you can access mapping stage variable template, or configure parameters passed to AWS Lambda or HTTP backend.
  • For more information about mapping templates, see the references to API Gateway mapping templates and access logging variables .

Guess you like

Origin www.cnblogs.com/cloudrivers/p/11617163.html
Recommended