Skip to content
v2.278.0

StageOptions Struct ​

Options required to create a new stage.

Options that are common between HTTP and Websocket APIs.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';
import { aws_apigatewayv2 as interfaces_apigatewayv2 } from 'aws-cdk-lib/interfaces';

declare const accessLogSettings: apigatewayv2.IAccessLogSettings;
declare const domainNameRef: interfaces_apigatewayv2.IDomainNameRef;
const stageOptions: apigatewayv2.StageOptions = {
  accessLogSettings: accessLogSettings,
  autoDeploy: false,
  description: 'description',
  detailedMetricsEnabled: false,
  domainMapping: {
    domainName: domainNameRef,

    // the properties below are optional
    mappingKey: 'mappingKey',
  },
  stageVariables: {
    stageVariablesKey: 'stageVariables',
  },
  throttle: {
    burstLimit: 123,
    rateLimit: 123,
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigatewayv2 as apigatewayv2
from aws_cdk.interfaces import aws_apigatewayv2 as interfaces_apigatewayv2

# access_log_settings: apigatewayv2.IAccessLogSettings
# domain_name_ref: interfaces_apigatewayv2.IDomainNameRef

stage_options = apigatewayv2.StageOptions(
    access_log_settings=access_log_settings,
    auto_deploy=False,
    description="description",
    detailed_metrics_enabled=False,
    domain_mapping=apigatewayv2.DomainMappingOptions(
        domain_name=domain_name_ref,

        # the properties below are optional
        mapping_key="mappingKey"
    ),
    stage_variables={
        "stage_variables_key": "stageVariables"
    },
    throttle=apigatewayv2.ThrottleSettings(
        burst_limit=123,
        rate_limit=123
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigatewayv2.*;
import software.amazon.awscdk.interfaces.apigatewayv2.*;

IAccessLogSettings accessLogSettings;
IDomainNameRef domainNameRef;

StageOptions stageOptions = StageOptions.builder()
        .accessLogSettings(accessLogSettings)
        .autoDeploy(false)
        .description("description")
        .detailedMetricsEnabled(false)
        .domainMapping(DomainMappingOptions.builder()
                .domainName(domainNameRef)

                // the properties below are optional
                .mappingKey("mappingKey")
                .build())
        .stageVariables(Map.of(
                "stageVariablesKey", "stageVariables"))
        .throttle(ThrottleSettings.builder()
                .burstLimit(123)
                .rateLimit(123)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Apigatewayv2;
using Amazon.CDK.Interfaces.Apigatewayv2;

IAccessLogSettings accessLogSettings;
IDomainNameRef domainNameRef;

var stageOptions = new StageOptions {
    AccessLogSettings = accessLogSettings,
    AutoDeploy = false,
    Description = "description",
    DetailedMetricsEnabled = false,
    DomainMapping = new DomainMappingOptions {
        DomainName = domainNameRef,

        // the properties below are optional
        MappingKey = "mappingKey"
    },
    StageVariables = new Dictionary<string, string> {
        { "stageVariablesKey", "stageVariables" }
    },
    Throttle = new ThrottleSettings {
        BurstLimit = 123,
        RateLimit = 123
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var accessLogSettings IAccessLogSettings
var domainNameRef IDomainNameRef

stageOptions := &StageOptions{
	AccessLogSettings: accessLogSettings,
	AutoDeploy: jsii.Boolean(false),
	Description: jsii.String("description"),
	DetailedMetricsEnabled: jsii.Boolean(false),
	DomainMapping: &DomainMappingOptions{
		DomainName: domainNameRef,

		// the properties below are optional
		MappingKey: jsii.String("mappingKey"),
	},
	StageVariables: map[string]*string{
		"stageVariablesKey": jsii.String("stageVariables"),
	},
	Throttle: &ThrottleSettings{
		BurstLimit: jsii.Number(123),
		RateLimit: jsii.Number(123),
	},
}

Properties ​

accessLogSettingsoptionalIAccessLogSettingsaccess_log_settingsoptionalIAccessLogSettingsaccessLogSettingsoptionalIAccessLogSettingsAccessLogSettingsoptionalIAccessLogSettingsAccessLogSettingsoptionalIAccessLogSettings #
Settings for access logging.

Default: No access logging

autoDeployoptionalbooleanauto_deployoptionalboolautoDeployoptionalBooleanAutoDeployoptionalboolAutoDeployoptional*bool = false #
Whether updates to an API automatically trigger a new deployment.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
The description for the API stage.

Default: no description

detailedMetricsEnabledoptionalbooleandetailed_metrics_enabledoptionalbooldetailedMetricsEnabledoptionalBooleanDetailedMetricsEnabledoptionalboolDetailedMetricsEnabledoptional*bool = false #
Specifies whether detailed metrics are enabled.
domainMappingoptionalDomainMappingOptionsdomain_mappingoptionalDomainMappingOptionsdomainMappingoptionalDomainMappingOptionsDomainMappingoptionalDomainMappingOptionsDomainMappingoptionalDomainMappingOptions #
The options for custom domain and api mapping.

Default: no custom domain and api mapping configuration

stageVariablesoptional{ [key: string]: string }stage_variablesoptionaltyping.Mapping[str, str]stageVariablesoptionalMap<String, String>StageVariablesoptionalIDictionary<string, string>StageVariablesoptional*map[string]*string #
Stage variables for the stage. These are key-value pairs that you can define and use in your API routes.

Default: No stage variables

notes

The allowed characters for variable names and the required pattern for variable values are specified here: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-apigateway-stage.html#cfn-apigateway-stage-variables

throttleoptionalThrottleSettingsthrottleoptionalThrottleSettingsthrottleoptionalThrottleSettingsThrottleoptionalThrottleSettingsThrottleoptionalThrottleSettings #
Throttle settings for the routes of this stage.

Default: no throttling configuration