DeploymentProps

class aws_cdk.aws_apigateway.DeploymentProps(*, api, description=None, retain_deployments=None)

Bases: object

Parameters
  • api (IRestApi) – The Rest API to deploy.

  • description (Optional[str]) – A description of the purpose of the API Gateway deployment. Default: - No description.

  • retain_deployments (Optional[bool]) – 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 Default: false

ExampleMetadata

infused

Example:

# production stage
prd_log_group = logs.LogGroup(self, "PrdLogs")
api = apigateway.RestApi(self, "books",
    deploy_options=apigateway.StageOptions(
        access_log_destination=apigateway.LogGroupLogDestination(prd_log_group),
        access_log_format=apigateway.AccessLogFormat.json_with_standard_fields()
    )
)
deployment = apigateway.Deployment(self, "Deployment", api=api)

# development stage
dev_log_group = logs.LogGroup(self, "DevLogs")
apigateway.Stage(self, "dev",
    deployment=deployment,
    access_log_destination=apigateway.LogGroupLogDestination(dev_log_group),
    access_log_format=apigateway.AccessLogFormat.json_with_standard_fields(
        caller=False,
        http_method=True,
        ip=True,
        protocol=True,
        request_time=True,
        resource_path=True,
        response_length=True,
        status=True,
        user=True
    )
)

Attributes

api

The Rest API to deploy.

Return type

IRestApi

description

A description of the purpose of the API Gateway deployment.

Default
  • No description.

Return type

Optional[str]

retain_deployments

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

Default

false

Return type

Optional[bool]