aws-cdk-lib.aws_apigateway.DeploymentProps

interface DeploymentProps

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

Example

// production stage
const prdLogGroup = new logs.LogGroup(this, "PrdLogs");
const api = new apigateway.RestApi(this, 'books', {
  deployOptions: {
    accessLogDestination: new apigateway.LogGroupLogDestination(prdLogGroup),
    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

NameTypeDescription
apiIRestApiThe Rest API to deploy.
description?stringA description of the purpose of the API Gateway deployment.
retainDeployments?booleanWhen an API Gateway model is updated, a new deployment will automatically be created.

api

Type: IRestApi

The Rest API to deploy.


description?

Type: string (optional, default: No description.)

A description of the purpose of the API Gateway deployment.


retainDeployments?

Type: boolean (optional, default: false)

When an API Gateway model is updated, a new deployment will automatically be created.

If this is true, the old API Gateway Deployment resource will not be deleted. This will allow manually reverting back to a previous deployment in case for example