Skip to content
v2.274.0

DeploymentProps 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 ​

The Rest API to deploy.
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string#
A description of the purpose of the API Gateway deployment.

Default: No description.

retainDeploymentsbooleanretain_deploymentsboolretainDeploymentsBooleanRetainDeploymentsboolRetainDeployments*bool= 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

stageNamestringstage_namestrstageNameStringStageNamestringStageName*string#
The name of the stage the API Gateway deployment deploys to.

Default: No stage name. If the stageName property is set but a stage with the corresponding name does not exist, a new stage resource will be created with the provided stage name.