# DeploymentProps

Extends: DeploymentProps
Used as props by: Deployment

- Source: [`aws-apigateway/lib/deployment.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts#L17)
- Type last changed: v2.140.0 · 2 May 2024

## 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

- `api`: [IRestApi](/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IRestApi.html) (required) — The Rest API to deploy.

- `description`: string — A description of the purpose of the API Gateway deployment.

  **Default:** No description.

- `retainDeployments`: boolean = 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

- `stageName`: 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.
