Skip to content

create_environment

create_environment(
    application_id: Name,
    name: Name,
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
    description: Optional[Description] = None,
    monitors: Optional[MonitorList] = None,
    tags: Optional[TagMap] = None,
) -> Environment

Creates an environment. For each application, you define one or more environments. An environment is a deployment group of AppConfig targets, such as applications in a Beta or Production environment. You can also define environments for application subcomponents such as the Web, Mobile and Back-end components for your application. You can configure Amazon CloudWatch alarms for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls back the configuration.

Parameters:

  • application_id (Name) –

    The application ID.

  • name (Name) –

    A name for the environment.

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

    A description of the environment.

  • monitors (Optional[MonitorList], default: None ) –

    Amazon CloudWatch alarms to monitor during the deployment process.

  • tags (Optional[TagMap], default: None ) –

    Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.

Raises:

  • BadRequestException –

    The input fails to satisfy the constraints specified by an Amazon Web Services service.

  • InternalServerException –

    There was an internal failure in the AppConfig service.

  • ResourceNotFoundException –

    The requested resource could not be found.

  • ServiceQuotaExceededException –

    The number of one more AppConfig resources exceeds the maximum allowed. Verify that your environment doesn't exceed the following service quotas:

    Applications: 100 max

    To resolve this issue, you can delete one or more resources and try again. Or, you can request a quota increase. For more information about quotas and to request an increase, see Service quotas for AppConfig in the Amazon Web Services General Reference.

  • UnknownServiceError –

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

Examples:

To create an environment The following create-environment example creates an AWS AppConfig environment named Example-Environment using the application you created using create-application

>>> client.create_environment(application_id='339ohji', name='Example-Environment')
Source code in docs_src/capo_appconfig/_services/app_config.py
def create_environment(
    self,
    application_id: "capo_appconfig.types.name.Name",
    name: "capo_appconfig.types.name.Name",
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
    description: Optional["capo_appconfig.types.description.Description"] = None,
    monitors: Optional["capo_appconfig.types.monitor_list.MonitorList"] = None,
    tags: Optional["capo_appconfig.types.tag_map.TagMap"] = None,
) -> "capo_appconfig.types.environment.Environment":
    """<p>Creates an environment. For each application, you define one or more environments. An environment is a deployment group of AppConfig targets, such as applications in a <code>Beta</code> or <code>Production</code> environment. You can also define environments for application subcomponents such as the <code>Web</code>, <code>Mobile</code> and <code>Back-end</code> components for your application. You can configure Amazon CloudWatch alarms for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls back the configuration.</p>

    Args:
        application_id: <p>The application ID.</p>
        name: <p>A name for the environment.</p>
        description: <p>A description of the environment.</p>
        monitors: <p>Amazon CloudWatch alarms to monitor during the deployment process.</p>
        tags: <p>Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.</p>

    Raises:
        capo_appconfig.errors.bad_request_exception.BadRequestException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_appconfig.errors.internal_server_exception.InternalServerException: <p>There was an internal failure in the AppConfig service.</p>
        capo_appconfig.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_appconfig.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of one more AppConfig resources exceeds the maximum allowed. Verify that your environment doesn't exceed the following service quotas:</p> <p>Applications: 100 max</p> <p>To resolve this issue, you can delete one or more resources and try again. Or, you can request a quota increase. For more information about quotas and to request an increase, see <a href="https://docs.aws.amazon.com/general/latest/gr/appconfig.html#limits_appconfig">Service quotas for AppConfig</a> in the Amazon Web Services General Reference.</p>
        capo_appconfig.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create an environment
        The following create-environment example creates an AWS AppConfig environment named Example-Environment using the application you created using create-application

        >>> client.create_environment(application_id='339ohji', name='Example-Environment')
    """

    def _handler(
        req: "OperationRequest[capo_appconfig.types.create_environment_request.CreateEnvironmentRequest]",
    ) -> OperationResponse["capo_appconfig.types.environment.Environment"]:
        import capo_appconfig._operations.amazon_app_config.create_environment

        output, http_response = (
            capo_appconfig._operations.amazon_app_config.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_appconfig.types.create_environment_request.CreateEnvironmentRequest = {
        "application_id": application_id,
        "name": name,
    }
    if description is not None:
        input_["description"] = description
    if monitors is not None:
        input_["monitors"] = monitors
    if tags is not None:
        input_["tags"] = tags

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