sudipt dabral
sudipt dabral

Reputation: 1485

Create stage variable input in API Gateway (REST API) using CDK

I have created API Gateway using CDK and wanting to create a input for Stage Variables while sending request from API Gateway, I referenced the docs related to stage variables but could not find something that would help me in achieving this.

I am able to create predefined stage variables which are coming under stage variables tab but not being able to set them while creating request because they should be created runtime as per our need.

            api = new RestApi(this, props.apiName, {
                deployOptions: {
                    stageName: 'alpha',
                    variables: {
                      'name': 'value'
                    }
            });

Refernced Docs :-

enter image description here

Upvotes: 0

Views: 1221

Answers (1)

gshpychka
gshpychka

Reputation: 11601

This is not possible. Stage variables are for configuring a stage, and can only be set during the creation (or modification) of a stage, not on a per-request basis.

Refer to the documentation for details.

Depending on your use-case, you might find that regular request parameters suit your needs.

Upvotes: 1

Related Questions