Skip to content

create_deployment_config async

create_deployment_config(
    deployment_config_name: DeploymentConfigName,
    *,
    config_overrides: Optional[AsyncCodeDeployClientConfig] = None,
    minimum_healthy_hosts: Optional[MinimumHealthyHosts] = None,
    traffic_routing_config: Optional[TrafficRoutingConfig] = None,
    compute_platform: Optional[ComputePlatform] = None,
    zonal_config: Optional[ZonalConfig] = None,
) -> CreateDeploymentConfigOutput

Creates a deployment configuration.

Parameters:

  • deployment_config_name (DeploymentConfigName) –

    The name of the deployment configuration to create.

  • minimum_healthy_hosts (Optional[MinimumHealthyHosts], default: None ) –

    The minimum number of healthy instances that should be available at any time during the deployment. There are two parameters expected in the input: type and value.

    The type parameter takes either of the following values:

    • HOST_COUNT: The value parameter represents the minimum number of healthy instances as an absolute value.

    • FLEET_PERCENT: The value parameter represents the minimum number of healthy instances as a percentage of the total number of instances in the deployment. If you specify FLEET_PERCENT, at the start of the deployment, CodeDeploy converts the percentage to the equivalent number of instances and rounds up fractional instances.

    The value parameter takes an integer.

    For example, to set a minimum of 95% healthy instance, specify a type of FLEET_PERCENT and a value of 95.

  • traffic_routing_config (Optional[TrafficRoutingConfig], default: None ) –

    The configuration that specifies how the deployment traffic is routed.

  • compute_platform (Optional[ComputePlatform], default: None ) –

    The destination platform type for the deployment (Lambda, Server, or ECS).

  • zonal_config (Optional[ZonalConfig], default: None ) –

    Configure the ZonalConfig object if you want CodeDeploy to deploy your application to one Availability Zone at a time, within an Amazon Web Services Region.

    For more information about the zonal configuration feature, see zonal configuration in the CodeDeploy User Guide.

Raises:

Source code in docs_src/capo_codedeploy/_services/async_code_deploy.py
async def create_deployment_config(
    self,
    deployment_config_name: "capo_codedeploy.types.deployment_config_name.DeploymentConfigName",
    *,
    config_overrides: Optional[AsyncCodeDeployClientConfig] = None,
    minimum_healthy_hosts: Optional[
        "capo_codedeploy.types.minimum_healthy_hosts.MinimumHealthyHosts"
    ] = None,
    traffic_routing_config: Optional[
        "capo_codedeploy.types.traffic_routing_config.TrafficRoutingConfig"
    ] = None,
    compute_platform: Optional[
        "capo_codedeploy.types.compute_platform.ComputePlatform"
    ] = None,
    zonal_config: Optional["capo_codedeploy.types.zonal_config.ZonalConfig"] = None,
) -> "capo_codedeploy.types.create_deployment_config_output.CreateDeploymentConfigOutput":
    """<p> Creates a deployment configuration. </p>

    Args:
        deployment_config_name: <p>The name of the deployment configuration to create.</p>
        minimum_healthy_hosts: <p>The minimum number of healthy instances that should be available at any time during the deployment. There are two parameters expected in the input: type and value.</p> <p>The type parameter takes either of the following values:</p> <ul> <li> <p>HOST_COUNT: The value parameter represents the minimum number of healthy instances as an absolute value.</p> </li> <li> <p>FLEET_PERCENT: The value parameter represents the minimum number of healthy instances as a percentage of the total number of instances in the deployment. If you specify FLEET_PERCENT, at the start of the deployment, CodeDeploy converts the percentage to the equivalent number of instances and rounds up fractional instances.</p> </li> </ul> <p>The value parameter takes an integer.</p> <p>For example, to set a minimum of 95% healthy instance, specify a type of FLEET_PERCENT and a value of 95.</p>
        traffic_routing_config: <p>The configuration that specifies how the deployment traffic is routed.</p>
        compute_platform: <p>The destination platform type for the deployment (<code>Lambda</code>, <code>Server</code>, or <code>ECS</code>).</p>
        zonal_config: <p>Configure the <code>ZonalConfig</code> object if you want CodeDeploy to deploy your application to one <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-availability-zones">Availability Zone</a> at a time, within an Amazon Web Services Region.</p> <p>For more information about the zonal configuration feature, see <a href="https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations-create.html#zonal-config">zonal configuration</a> in the <i>CodeDeploy User Guide</i>.</p>

    Raises:
        capo_codedeploy.errors.deployment_config_already_exists_exception.DeploymentConfigAlreadyExistsException: <p>A deployment configuration with the specified name with the user or Amazon Web Services account already exists.</p>
        capo_codedeploy.errors.deployment_config_limit_exceeded_exception.DeploymentConfigLimitExceededException: <p>The deployment configurations limit was exceeded.</p>
        capo_codedeploy.errors.deployment_config_name_required_exception.DeploymentConfigNameRequiredException: <p>The deployment configuration name was not specified.</p>
        capo_codedeploy.errors.invalid_compute_platform_exception.InvalidComputePlatformException: <p>The computePlatform is invalid. The computePlatform should be <code>Lambda</code>, <code>Server</code>, or <code>ECS</code>.</p>
        capo_codedeploy.errors.invalid_deployment_config_name_exception.InvalidDeploymentConfigNameException: <p>The deployment configuration name was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_minimum_healthy_host_value_exception.InvalidMinimumHealthyHostValueException: <p>The minimum healthy instance value was specified in an invalid format.</p>
        capo_codedeploy.errors.invalid_traffic_routing_configuration_exception.InvalidTrafficRoutingConfigurationException: <p> The configuration that specifies how traffic is routed during a deployment is invalid.</p>
        capo_codedeploy.errors.invalid_zonal_deployment_configuration_exception.InvalidZonalDeploymentConfigurationException: <p>The <code>ZonalConfig</code> object is not valid.</p>
        capo_codedeploy.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codedeploy.types.create_deployment_config_input.CreateDeploymentConfigInput]",
    ) -> AsyncOperationResponse[
        "capo_codedeploy.types.create_deployment_config_output.CreateDeploymentConfigOutput"
    ]:
        import capo_codedeploy._operations.code_deploy_20141006.create_deployment_config

        (
            output,
            http_response,
        ) = await capo_codedeploy._operations.code_deploy_20141006.create_deployment_config.async_create_deployment_config(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDeploymentConfig")
    )
    input_: capo_codedeploy.types.create_deployment_config_input.CreateDeploymentConfigInput = {
        "deployment_config_name": deployment_config_name
    }
    if minimum_healthy_hosts is not None:
        input_["minimum_healthy_hosts"] = minimum_healthy_hosts
    if traffic_routing_config is not None:
        input_["traffic_routing_config"] = traffic_routing_config
    if compute_platform is not None:
        input_["compute_platform"] = compute_platform
    if zonal_config is not None:
        input_["zonal_config"] = zonal_config

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output