Skip to content

create_backend_environment

create_backend_environment(
    app_id: AppId,
    environment_name: EnvironmentName,
    *,
    config_overrides: Optional[AmplifyClientConfig] = None,
    stack_name: Optional[StackName] = None,
    deployment_artifacts: Optional[DeploymentArtifacts] = None,
) -> CreateBackendEnvironmentResult

Creates a new backend environment for an Amplify app.

This API is available only to Amplify Gen 1 applications where the backend is created using Amplify Studio or the Amplify command line interface (CLI). This API isn’t available to Amplify Gen 2 applications. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.

Parameters:

  • app_id (AppId) –

    The unique ID for an Amplify app.

  • environment_name (EnvironmentName) –

    The name for the backend environment.

  • stack_name (Optional[StackName], default: None ) –

    The AWS CloudFormation stack name of a backend environment.

  • deployment_artifacts (Optional[DeploymentArtifacts], default: None ) –

    The name of deployment artifacts.

Raises:

Source code in docs_src/capo_amplify/_services/amplify.py
def create_backend_environment(
    self,
    app_id: "capo_amplify.types.app_id.AppId",
    environment_name: "capo_amplify.types.environment_name.EnvironmentName",
    *,
    config_overrides: Optional[AmplifyClientConfig] = None,
    stack_name: Optional["capo_amplify.types.stack_name.StackName"] = None,
    deployment_artifacts: Optional[
        "capo_amplify.types.deployment_artifacts.DeploymentArtifacts"
    ] = None,
) -> "capo_amplify.types.create_backend_environment_result.CreateBackendEnvironmentResult":
    """<p>Creates a new backend environment for an Amplify app. </p> <p>This API is available only to Amplify Gen 1 applications where the backend is created using Amplify Studio or the Amplify command line interface (CLI). This API isn’t available to Amplify Gen 2 applications. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.</p>

    Args:
        app_id: <p>The unique ID for an Amplify app. </p>
        environment_name: <p>The name for the backend environment. </p>
        stack_name: <p>The AWS CloudFormation stack name of a backend environment. </p>
        deployment_artifacts: <p>The name of deployment artifacts. </p>

    Raises:
        capo_amplify.errors.bad_request_exception.BadRequestException: <p>A request contains unexpected data. </p>
        capo_amplify.errors.internal_failure_exception.InternalFailureException: <p>The service failed to perform an operation due to an internal issue. </p>
        capo_amplify.errors.limit_exceeded_exception.LimitExceededException: <p>A resource could not be created because service quotas were exceeded. </p>
        capo_amplify.errors.not_found_exception.NotFoundException: <p>An entity was not found during an operation. </p>
        capo_amplify.errors.unauthorized_exception.UnauthorizedException: <p>An operation failed due to a lack of access. </p>
        capo_amplify.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_amplify.types.create_backend_environment_request.CreateBackendEnvironmentRequest]",
    ) -> OperationResponse[
        "capo_amplify.types.create_backend_environment_result.CreateBackendEnvironmentResult"
    ]:
        import capo_amplify._operations.amplify.create_backend_environment

        output, http_response = (
            capo_amplify._operations.amplify.create_backend_environment.create_backend_environment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateBackendEnvironment")
    )
    input_: capo_amplify.types.create_backend_environment_request.CreateBackendEnvironmentRequest = {
        "app_id": app_id,
        "environment_name": environment_name,
    }
    if stack_name is not None:
        input_["stack_name"] = stack_name
    if deployment_artifacts is not None:
        input_["deployment_artifacts"] = deployment_artifacts

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