:doc:`Batch <../../batch>` / Client / create_service_environment

**************************
create_service_environment
**************************



.. py:method:: Batch.Client.create_service_environment(**kwargs)

  

  Creates a service environment for running service jobs. Service environments define capacity limits for specific service types such as SageMaker Training jobs.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/CreateServiceEnvironment>`_  


  **Request Syntax**
  ::

    response = client.create_service_environment(
        serviceEnvironmentName='string',
        serviceEnvironmentType='SAGEMAKER_TRAINING',
        state='ENABLED'|'DISABLED',
        capacityLimits=[
            {
                'maxCapacity': 123,
                'capacityUnit': 'string'
            },
        ],
        tags={
            'string': 'string'
        }
    )
    
  :type serviceEnvironmentName: string
  :param serviceEnvironmentName: **[REQUIRED]** 

    The name for the service environment. It can be up to 128 characters long and can contain letters, numbers, hyphens (-), and underscores (_).

    

  
  :type serviceEnvironmentType: string
  :param serviceEnvironmentType: **[REQUIRED]** 

    The type of service environment. For SageMaker Training jobs, specify ``SAGEMAKER_TRAINING``.

    

  
  :type state: string
  :param state: 

    The state of the service environment. Valid values are ``ENABLED`` and ``DISABLED``. The default value is ``ENABLED``.

    

  
  :type capacityLimits: list
  :param capacityLimits: **[REQUIRED]** 

    The capacity limits for the service environment. The number of instances a job consumes is the total number of instances requested in the submit training job request resource configuration.

    

  
    - *(dict) --* 

      Defines the capacity limit for a service environment. This structure specifies the maximum amount of resources that can be used by service jobs in the environment.

      

    
      - **maxCapacity** *(integer) --* 

        The maximum capacity available for the service environment. This value represents the maximum amount of resources that can be allocated to service jobs.

         

        For example, ``maxCapacity=50``, ``capacityUnit=NUM_INSTANCES``. This indicates that the maximum number of instances that can be run on this service environment is 50. You could then run 5 SageMaker Training jobs that each use 10 instances. However, if you submit another job that requires 10 instances, it will wait in the queue.

        

      
      - **capacityUnit** *(string) --* 

        The unit of measure for the capacity limit. This defines how the maxCapacity value should be interpreted. For ``SAGEMAKER_TRAINING`` jobs, use ``NUM_INSTANCES``.

        

      
    

  :type tags: dict
  :param tags: 

    The tags that you apply to the service environment to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see `Tagging your Batch resources <https://docs.aws.amazon.com/batch/latest/userguide/using-tags.html>`__.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'serviceEnvironmentName': 'string',
          'serviceEnvironmentArn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **serviceEnvironmentName** *(string) --* 

        The name of the service environment.

        
      

      - **serviceEnvironmentArn** *(string) --* 

        The Amazon Resource Name (ARN) of the service environment.

        
  
  **Exceptions**
  
  *   :py:class:`Batch.Client.exceptions.ClientException`

  
  *   :py:class:`Batch.Client.exceptions.ServerException`

  