In API Gateway, when a stage variable is used as part of an HTTP integration URL, which of the following are correct ways of defining a "subdomain" and the "path"? (Select TWO)
Click on the arrows to vote for the correct answer
A. B. C. D. E. F.Correct Answers: B and C.
A stage variable can be used as part of the HTTP integration URL in the following cases:
A full URI without protocol.
A full domain.
A subdomain.
A path.
A query string.
options B and C display the stage variable as a path & sub-domain.
For more information on Staging variables, refer to the following URL-
https://docs.aws.amazon.com/apigateway/latest/developerguide/aws-api-gateway-stage-variables-reference.htmlAPI Gateway provides a feature called stage variables that allow you to pass configuration settings to your API's resources and methods. Stage variables are name-value pairs that can be associated with a specific deployment stage of an API.
When a stage variable is used as part of an HTTP integration URL in API Gateway, it can be used to define a "subdomain" and the "path". The subdomain can be specified as a value of the stage variable, while the path can be defined either as a constant string or as another stage variable.
Let's go through each answer option to see which ones correctly define a subdomain and a path using stage variables:
A. http://example.com/${<variable_name>}/prod
This option defines the path as a constant string "/prod", but the subdomain is not defined correctly. The placeholder "${<variable_name>}" is used incorrectly, as it is not surrounded by "stageVariables." to indicate that it should be replaced by the value of the stage variable.
B. http://example.com/${stageVariables.<variable_name>}/prod
This option correctly defines the path as a constant string "/prod" and the subdomain as the value of the stage variable named "<variable_name>". The stage variable is referred to using the syntax "${stageVariables.<variable_name>}".
C. http://${stageVariables.<variable_name>}.example.com/dev/operation
This option correctly defines the subdomain as the value of the stage variable named "<variable_name>". The path is defined as a constant string "/dev/operation".
D. http://${stageVariables}.example.com/dev/operation
This option tries to use the entire set of stage variables as the subdomain, which is not valid. The subdomain must be defined as the value of a specific stage variable, using the syntax "${stageVariables.<variable_name>}".
E. http://${<variable_name>}.example.com/dev/operation
This option tries to use the placeholder "${<variable_name>}" to define the subdomain, but this is incorrect. The correct syntax is "${stageVariables.<variable_name>}".
F. http://example.com/${stageVariables}/prod
This option tries to use the entire set of stage variables as the path, which is not valid. The path must be defined as a constant string or as another stage variable, using the syntax "${stageVariables.<variable_name>}".
Therefore, the correct options that define a subdomain and a path using stage variables are B and C.