DeploymentProps

class aws_cdk.aws_apigateway.DeploymentProps(*, api, description=None, retain_deployments=None, stage_name=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

  • stage_name (Optional[str]) – 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.

ExampleMetadata:

infused

Example:

# production stage
prod_log_group = logs.LogGroup(self, "PrdLogs")
api = apigateway.RestApi(self, "books",
    deploy_options=apigateway.StageOptions(
        access_log_destination=apigateway.LogGroupLogDestination(prod_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.

description

A description of the purpose of the API Gateway deployment.

Default:
  • No description.

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

stage_name

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.