Skip to content

update_workflow

update_workflow(
    workflow_arn: WorkflowArn,
    definition_s3_location: DefinitionS3Location,
    role_arn: RoleARN,
    *,
    config_overrides: Optional[MWAAServerlessClientConfig] = None,
    code: Optional[Code] = None,
    description: Optional[DescriptionString] = None,
    logging_configuration: Optional[LoggingConfiguration] = None,
    engine_version: Optional[EngineVersion] = None,
    network_configuration: Optional[NetworkConfiguration] = None,
    trigger_mode: Optional[GenericString] = None,
) -> UpdateWorkflowResponse

Updates an existing workflow with new configuration settings. This operation allows you to modify the workflow definition, role, and other settings. When you update a workflow, Amazon Managed Workflows for Apache Airflow Serverless automatically creates a new version with the updated configuration and disables scheduling on all previous versions to ensure only one version is actively scheduled at a time. The update operation maintains workflow history while providing a clean transition to the new configuration.

Parameters:

  • workflow_arn (WorkflowArn) –

    The Amazon Resource Name (ARN) of the workflow you want to update.

  • definition_s3_location (DefinitionS3Location) –

    The Amazon S3 location where the updated workflow definition file is stored.

  • code (Optional[Code], default: None ) –

    The location of code artifacts in Amazon S3 for the updated workflow. The service copies the code from this location at the time of the request.

  • role_arn (RoleARN) –

    The Amazon Resource Name (ARN) of the IAM role that Amazon Managed Workflows for Apache Airflow Serverless assumes when it executes the updated workflow.

  • description (Optional[DescriptionString], default: None ) –

    An updated description for the workflow.

  • logging_configuration (Optional[LoggingConfiguration], default: None ) –

    Updated logging configuration for the workflow.

  • engine_version (Optional[EngineVersion], default: None ) –

    The version of the Amazon Managed Workflows for Apache Airflow Serverless engine that you want to use for the updated workflow.

  • network_configuration (Optional[NetworkConfiguration], default: None ) –

    Updated network configuration for the workflow execution environment.

  • trigger_mode (Optional[GenericString], default: None ) –

    The trigger mode for the workflow execution.

Raises:

  • AccessDeniedException –

    You do not have sufficient permission to perform this action.

  • ConflictException –

    You cannot create a resource that already exists, or the resource is in a state that prevents the requested operation.

  • InternalServerException –

    An unexpected server-side error occurred during request processing.

  • OperationTimeoutException –

    The operation timed out.

  • ResourceNotFoundException –

    The specified resource was not found. You can only access or modify a resource that already exists.

  • ServiceQuotaExceededException –

    The request exceeds the service quota for Amazon Managed Workflows for Apache Airflow Serverless resources. This can occur when you attempt to create more workflows than allowed, exceed concurrent workflow run limits, or surpass task execution limits. Amazon Managed Workflows for Apache Airflow Serverless implements admission control using DynamoDB-based counters to manage resource utilization across the multi-tenant environment. Contact Amazon Web Services Support to request quota increases if you need higher limits for your use case.

  • ThrottlingException –

    The request was denied because too many requests were made in a short period, exceeding the service rate limits. Amazon Managed Workflows for Apache Airflow Serverless implements throttling controls to ensure fair resource allocation across all customers in the multi-tenant environment. This helps maintain service stability and performance. If you encounter throttling, implement exponential backoff and retry logic in your applications, or consider distributing your API calls over a longer time period.

  • ValidationException –

    The specified request parameters are invalid, missing, or inconsistent with Amazon Managed Workflows for Apache Airflow Serverless service requirements. This can occur when workflow definitions contain unsupported operators, when required IAM permissions are missing, when S3 locations are inaccessible, or when network configurations are invalid. The service validates workflow definitions, execution roles, and resource configurations to ensure compatibility with the managed Airflow environment and security requirements.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_mwaa_serverless/_services/mwaa_serverless.py
def update_workflow(
    self,
    workflow_arn: "capo_mwaa_serverless.types.workflow_arn.WorkflowArn",
    definition_s3_location: "capo_mwaa_serverless.types.definition_s3_location.DefinitionS3Location",
    role_arn: "capo_mwaa_serverless.types.role_arn.RoleARN",
    *,
    config_overrides: Optional[MWAAServerlessClientConfig] = None,
    code: Optional["capo_mwaa_serverless.types.code.Code"] = None,
    description: Optional[
        "capo_mwaa_serverless.types.description_string.DescriptionString"
    ] = None,
    logging_configuration: Optional[
        "capo_mwaa_serverless.types.logging_configuration.LoggingConfiguration"
    ] = None,
    engine_version: Optional[
        "capo_mwaa_serverless.types.engine_version.EngineVersion"
    ] = None,
    network_configuration: Optional[
        "capo_mwaa_serverless.types.network_configuration.NetworkConfiguration"
    ] = None,
    trigger_mode: Optional[
        "capo_mwaa_serverless.types.generic_string.GenericString"
    ] = None,
) -> "capo_mwaa_serverless.types.update_workflow_response.UpdateWorkflowResponse":
    """<p>Updates an existing workflow with new configuration settings. This operation allows you to modify the workflow definition, role, and other settings. When you update a workflow, Amazon Managed Workflows for Apache Airflow Serverless automatically creates a new version with the updated configuration and disables scheduling on all previous versions to ensure only one version is actively scheduled at a time. The update operation maintains workflow history while providing a clean transition to the new configuration.</p>

    Args:
        workflow_arn: <p>The Amazon Resource Name (ARN) of the workflow you want to update.</p>
        definition_s3_location: <p>The Amazon S3 location where the updated workflow definition file is stored.</p>
        code: <p>The location of code artifacts in Amazon S3 for the updated workflow. The service copies the code from this location at the time of the request.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that Amazon Managed Workflows for Apache Airflow Serverless assumes when it executes the updated workflow.</p>
        description: <p>An updated description for the workflow.</p>
        logging_configuration: <p>Updated logging configuration for the workflow.</p>
        engine_version: <p>The version of the Amazon Managed Workflows for Apache Airflow Serverless engine that you want to use for the updated workflow.</p>
        network_configuration: <p>Updated network configuration for the workflow execution environment.</p>
        trigger_mode: <p>The trigger mode for the workflow execution.</p>

    Raises:
        capo_mwaa_serverless.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permission to perform this action.</p>
        capo_mwaa_serverless.errors.conflict_exception.ConflictException: <p>You cannot create a resource that already exists, or the resource is in a state that prevents the requested operation.</p>
        capo_mwaa_serverless.errors.internal_server_exception.InternalServerException: <p>An unexpected server-side error occurred during request processing.</p>
        capo_mwaa_serverless.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_mwaa_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. You can only access or modify a resource that already exists.</p>
        capo_mwaa_serverless.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request exceeds the service quota for Amazon Managed Workflows for Apache Airflow Serverless resources. This can occur when you attempt to create more workflows than allowed, exceed concurrent workflow run limits, or surpass task execution limits. Amazon Managed Workflows for Apache Airflow Serverless implements admission control using DynamoDB-based counters to manage resource utilization across the multi-tenant environment. Contact Amazon Web Services Support to request quota increases if you need higher limits for your use case.</p>
        capo_mwaa_serverless.errors.throttling_exception.ThrottlingException: <p>The request was denied because too many requests were made in a short period, exceeding the service rate limits. Amazon Managed Workflows for Apache Airflow Serverless implements throttling controls to ensure fair resource allocation across all customers in the multi-tenant environment. This helps maintain service stability and performance. If you encounter throttling, implement exponential backoff and retry logic in your applications, or consider distributing your API calls over a longer time period.</p>
        capo_mwaa_serverless.errors.validation_exception.ValidationException: <p>The specified request parameters are invalid, missing, or inconsistent with Amazon Managed Workflows for Apache Airflow Serverless service requirements. This can occur when workflow definitions contain unsupported operators, when required IAM permissions are missing, when S3 locations are inaccessible, or when network configurations are invalid. The service validates workflow definitions, execution roles, and resource configurations to ensure compatibility with the managed Airflow environment and security requirements.</p>
        capo_mwaa_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_mwaa_serverless.types.update_workflow_request.UpdateWorkflowRequest]",
    ) -> OperationResponse[
        "capo_mwaa_serverless.types.update_workflow_response.UpdateWorkflowResponse"
    ]:
        import capo_mwaa_serverless._operations.amazon_mwaa_serverless.update_workflow

        output, http_response = (
            capo_mwaa_serverless._operations.amazon_mwaa_serverless.update_workflow.update_workflow(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateWorkflow")
    )
    input_: capo_mwaa_serverless.types.update_workflow_request.UpdateWorkflowRequest = {
        "workflow_arn": workflow_arn,
        "definition_s3_location": definition_s3_location,
        "role_arn": role_arn,
    }
    if code is not None:
        input_["code"] = code
    if description is not None:
        input_["description"] = description
    if logging_configuration is not None:
        input_["logging_configuration"] = logging_configuration
    if engine_version is not None:
        input_["engine_version"] = engine_version
    if network_configuration is not None:
        input_["network_configuration"] = network_configuration
    if trigger_mode is not None:
        input_["trigger_mode"] = trigger_mode

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output