Skip to content
v2.274.0

StageProps Struct ​

Example ​

ts
// production stage
const prodLogGroup = new logs.LogGroup(this, "PrdLogs");
const api = new apigateway.RestApi(this, 'books', {
  deployOptions: {
    accessLogDestination: new apigateway.LogGroupLogDestination(prodLogGroup),
    accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields(),
  },
});
const deployment = new apigateway.Deployment(this, 'Deployment', {api});

// development stage
const devLogGroup = new logs.LogGroup(this, "DevLogs");
new apigateway.Stage(this, 'dev', {
  deployment,
  accessLogDestination: new apigateway.LogGroupLogDestination(devLogGroup),
  accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields({
    caller: false,
    httpMethod: true,
    ip: true,
    protocol: true,
    requestTime: true,
    resourcePath: true,
    responseLength: true,
    status: true,
    user: true,
  }),
});

Properties ​

accessLogDestinationoptionalIAccessLogDestinationaccess_log_destinationoptionalIAccessLogDestinationaccessLogDestinationoptionalIAccessLogDestinationAccessLogDestinationoptionalIAccessLogDestinationAccessLogDestinationoptionalIAccessLogDestination#
The CloudWatch Logs log group or Firehose delivery stream where to write access logs.

Default: No destination

accessLogFormatoptionalAccessLogFormataccess_log_formatoptionalAccessLogFormataccessLogFormatoptionalAccessLogFormatAccessLogFormatoptionalAccessLogFormatAccessLogFormatoptionalAccessLogFormat#
A single line format of access logs of data, as specified by selected $content variables.

Default: Common Log Format

The format must include either AccessLogFormat.contextRequestId() or AccessLogFormat.contextExtendedRequestId().

cacheClusterEnabledoptionalbooleancache_cluster_enabledoptionalboolcacheClusterEnabledoptionalBooleanCacheClusterEnabledoptionalboolCacheClusterEnabledoptional*bool#
Indicates whether cache clustering is enabled for the stage.

Default: Disabled for the stage.

cacheClusterSizeoptionalstringcache_cluster_sizeoptionalstrcacheClusterSizeoptionalStringCacheClusterSizeoptionalstringCacheClusterSizeoptional*string= 0.5#
The stage's cache cluster size.
cacheDataEncryptedoptionalbooleancache_data_encryptedoptionalboolcacheDataEncryptedoptionalBooleanCacheDataEncryptedoptionalboolCacheDataEncryptedoptional*bool= false#
Indicates whether the cached responses are encrypted.
cacheTtloptionalDurationcache_ttloptionalDurationcacheTtloptionalDurationCacheTtloptionalDurationCacheTtloptionalDuration= Duration.minutes(5)#
Specifies the time to live (TTL), in seconds, for cached responses.

The higher the TTL, the longer the response will be cached.

cachingEnabledoptionalbooleancaching_enabledoptionalboolcachingEnabledoptionalBooleanCachingEnabledoptionalboolCachingEnabledoptional*bool#
Specifies whether responses should be cached and returned for requests.

Default: Caching is Disabled.

A cache cluster must be enabled on the stage for responses to be cached.

clientCertificateIdoptionalstringclient_certificate_idoptionalstrclientCertificateIdoptionalStringClientCertificateIdoptionalstringClientCertificateIdoptional*string= None.#
The identifier of the client certificate that API Gateway uses to call your integration endpoints in the stage.
dataTraceEnabledoptionalbooleandata_trace_enabledoptionalbooldataTraceEnabledoptionalBooleanDataTraceEnabledoptionalboolDataTraceEnabledoptional*bool= false#
Specifies whether data trace logging is enabled for this method.

When enabled, API gateway will log the full API requests and responses. This can be useful to troubleshoot APIs, but can result in logging sensitive data. We recommend that you don't enable this feature for production APIs.

deploymentDeploymentdeploymentDeploymentdeploymentDeploymentDeploymentDeploymentDeploymentDeploymentrequired#
The deployment that this stage points to [disable-awslint:ref-via-interface].
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
A description of the purpose of the stage.

Default: No description.

documentationVersionoptionalstringdocumentation_versionoptionalstrdocumentationVersionoptionalStringDocumentationVersionoptionalstringDocumentationVersionoptional*string#
The version identifier of the API documentation snapshot.

Default: No documentation version.

loggingLeveloptionalMethodLoggingLevellogging_leveloptionalMethodLoggingLevelloggingLeveloptionalMethodLoggingLevelLoggingLeveloptionalMethodLoggingLevelLoggingLeveloptionalMethodLoggingLevel= Off#
Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs.
methodOptionsoptional{ [key: string]: MethodDeploymentOptions }method_optionsoptionaltyping.Mapping[str, MethodDeploymentOptions]methodOptionsoptionalMap<String, MethodDeploymentOptions>MethodOptionsoptionalIDictionary<string, MethodDeploymentOptions>MethodOptionsoptional*map[string]MethodDeploymentOptions#
Method deployment options for specific resources/methods.

Default: Common options will be used.

These will override common options defined in StageOptions#methodOptions.

metricsEnabledoptionalbooleanmetrics_enabledoptionalboolmetricsEnabledoptionalBooleanMetricsEnabledoptionalboolMetricsEnabledoptional*bool= false#
Specifies whether Amazon CloudWatch metrics are enabled for this method.
stageNameoptionalstringstage_nameoptionalstrstageNameoptionalStringStageNameoptionalstringStageNameoptional*string= "prod"#
The name of the stage, which API Gateway uses as the first path segment in the invoked Uniform Resource Identifier (URI).
throttlingBurstLimitoptionalnumberthrottling_burst_limitoptionalint | floatthrottlingBurstLimitoptionalNumberThrottlingBurstLimitoptionaldoubleThrottlingBurstLimitoptional*float64#
Specifies the throttling burst limit.

Default: No additional restriction.

The total rate of all requests in your AWS account is limited to 5,000 requests.

throttlingRateLimitoptionalnumberthrottling_rate_limitoptionalint | floatthrottlingRateLimitoptionalNumberThrottlingRateLimitoptionaldoubleThrottlingRateLimitoptional*float64#
Specifies the throttling rate limit.

Default: No additional restriction.

The total rate of all requests in your AWS account is limited to 10,000 requests per second (rps).

tracingEnabledoptionalbooleantracing_enabledoptionalbooltracingEnabledoptionalBooleanTracingEnabledoptionalboolTracingEnabledoptional*bool= false#
Specifies whether Amazon X-Ray tracing is enabled for this method.
variablesoptional{ [key: string]: string }variablesoptionaltyping.Mapping[str, str]variablesoptionalMap<String, String>VariablesoptionalIDictionary<string, string>Variablesoptional*map[string]*string#
A map that defines the stage variables.

Default: No stage variables.

Variable names must consist of alphanumeric characters, and the values must match the following regular expression: [A-Za-z0-9-._~:/?#&=,]+.