Skip to content

create_environment

create_environment(
    app_name: AppName,
    environment_name: EnvironmentName,
    environment_role_arn: EnvironmentRoleArn,
    *,
    config_overrides: Optional[AmplifyGen3ClientConfig] = None,
    environment_role_permission_mode: Optional[EnvironmentRolePermissionMode] = None,
    source_config: Optional[EnvironmentSourceConfigRequest] = None,
    gradual_rollout_config: Optional[GradualRolloutConfig] = None,
    tags: Optional[TagMap] = None,
    web: Optional[EnvironmentWebConfigRequest] = None,
    network_config: Optional[EnvironmentNetworkConfigRequest] = None,
    backend: Optional[EnvironmentBackendConfigRequest] = None,
) -> CreateEnvironmentResponse

Creates an environment for a Gen 3 app.

Parameters:

Raises:

Source code in docs_src/capo_amplifygen3/_services/amplify_gen3.py
def create_environment(
    self,
    app_name: "capo_amplifygen3.types.app_name.AppName",
    environment_name: "capo_amplifygen3.types.environment_name.EnvironmentName",
    environment_role_arn: "capo_amplifygen3.types.environment_role_arn.EnvironmentRoleArn",
    *,
    config_overrides: Optional[AmplifyGen3ClientConfig] = None,
    environment_role_permission_mode: Optional[
        "capo_amplifygen3.types.environment_role_permission_mode.EnvironmentRolePermissionMode"
    ] = None,
    source_config: Optional[
        "capo_amplifygen3.types.environment_source_config_request.EnvironmentSourceConfigRequest"
    ] = None,
    gradual_rollout_config: Optional[
        "capo_amplifygen3.types.gradual_rollout_config.GradualRolloutConfig"
    ] = None,
    tags: Optional["capo_amplifygen3.types.tag_map.TagMap"] = None,
    web: Optional[
        "capo_amplifygen3.types.environment_web_config_request.EnvironmentWebConfigRequest"
    ] = None,
    network_config: Optional[
        "capo_amplifygen3.types.environment_network_config_request.EnvironmentNetworkConfigRequest"
    ] = None,
    backend: Optional[
        "capo_amplifygen3.types.environment_backend_config_request.EnvironmentBackendConfigRequest"
    ] = None,
) -> "capo_amplifygen3.types.create_environment_response.CreateEnvironmentResponse":
    """<p>Creates an environment for a Gen 3 app.</p>

    Args:
        app_name: <p>The name of the app.</p>
        environment_name: <p>The name of the environment.</p>
        environment_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role for the environment.</p>
        environment_role_permission_mode: <p>The permission mode for the environment's IAM role.</p>
        source_config: <p>The source configuration for the environment.</p>
        gradual_rollout_config: <p>The gradual rollout settings for the environment.</p>
        tags: <p>The tags to apply to the resource.</p>
        web: <p>The web hosting settings for the environment.</p>
        network_config: <p>The VPC network configuration for the environment.</p>
        backend: <p>The backend settings for the environment. You can specify this only when the app has a backend. If you omit this, the default authentication settings and the plan's default database settings are used.</p>

    Raises:
        capo_amplifygen3.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_amplifygen3.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        capo_amplifygen3.errors.internal_server_exception.InternalServerException: <p>An internal error occurred. Retry the request.</p>
        capo_amplifygen3.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_amplifygen3.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota for your account.</p>
        capo_amplifygen3.errors.throttling_exception.ThrottlingException: <p>The request was denied because the request rate exceeds the allowed limit.</p>
        capo_amplifygen3.errors.validation_exception.ValidationException: <p>The request contains invalid parameters or is otherwise malformed.</p>
        capo_amplifygen3.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_amplifygen3.types.create_environment_request.CreateEnvironmentRequest]",
    ) -> OperationResponse[
        "capo_amplifygen3.types.create_environment_response.CreateEnvironmentResponse"
    ]:
        import capo_amplifygen3._operations.omega.create_environment

        output, http_response = (
            capo_amplifygen3._operations.omega.create_environment.create_environment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEnvironment")
    )
    input_: capo_amplifygen3.types.create_environment_request.CreateEnvironmentRequest = {
        "app_name": app_name,
        "environment_name": environment_name,
        "environment_role_arn": environment_role_arn,
    }
    if environment_role_permission_mode is not None:
        input_["environment_role_permission_mode"] = (
            environment_role_permission_mode
        )
    if source_config is not None:
        input_["source_config"] = source_config
    if gradual_rollout_config is not None:
        input_["gradual_rollout_config"] = gradual_rollout_config
    if tags is not None:
        input_["tags"] = tags
    if web is not None:
        input_["web"] = web
    if network_config is not None:
        input_["network_config"] = network_config
    if backend is not None:
        input_["backend"] = backend

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