aws-cdk-lib.aws_apigateway.MethodDeploymentOptions

interface MethodDeploymentOptions

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.MethodDeploymentOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#MethodDeploymentOptions
Javasoftware.amazon.awscdk.services.apigateway.MethodDeploymentOptions
Pythonaws_cdk.aws_apigateway.MethodDeploymentOptions
TypeScript (source)aws-cdk-lib » aws_apigateway » MethodDeploymentOptions

Example

const api = new apigateway.RestApi(this, 'books');
const deployment = new apigateway.Deployment(this, 'my-deployment', { api });
const stage = new apigateway.Stage(this, 'my-stage', {
  deployment,
  methodOptions: {
    '/*/*': {  // This special path applies to all resource paths and all HTTP methods
      throttlingRateLimit: 100,
      throttlingBurstLimit: 200
    }
  }
});

Properties

NameTypeDescription
cacheDataEncrypted?booleanIndicates whether the cached responses are encrypted.
cacheTtl?DurationSpecifies the time to live (TTL), in seconds, for cached responses.
cachingEnabled?booleanSpecifies whether responses should be cached and returned for requests.
dataTraceEnabled?booleanSpecifies whether data trace logging is enabled for this method.
loggingLevel?MethodLoggingLevelSpecifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs.
metricsEnabled?booleanSpecifies whether Amazon CloudWatch metrics are enabled for this method.
throttlingBurstLimit?numberSpecifies the throttling burst limit.
throttlingRateLimit?numberSpecifies the throttling rate limit.

cacheDataEncrypted?

Type: boolean (optional, default: false)

Indicates whether the cached responses are encrypted.


cacheTtl?

Type: Duration (optional, default: 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.

See also: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html


cachingEnabled?

Type: boolean (optional, default: Caching is Disabled.)

Specifies whether responses should be cached and returned for requests.

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


dataTraceEnabled?

Type: boolean (optional, default: 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.


loggingLevel?

Type: MethodLoggingLevel (optional, default: Off)

Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs.


metricsEnabled?

Type: boolean (optional, default: false)

Specifies whether Amazon CloudWatch metrics are enabled for this method.


throttlingBurstLimit?

Type: number (optional, default: No additional restriction.)

Specifies the throttling burst limit.

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

See also: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html


throttlingRateLimit?

Type: number (optional, default: No additional restriction.)

Specifies the throttling rate limit.

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

See also: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html