Batch / Client / create_service_environment

create_service_environment

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

Request Syntax

response = client.create_service_environment(
    serviceEnvironmentName='string',
    serviceEnvironmentType='SAGEMAKER_TRAINING',
    state='ENABLED'|'DISABLED',
    capacityLimits=[
        {
            'maxCapacity': 123,
            'capacityUnit': 'string'
        },
    ],
    tags={
        'string': 'string'
    }
)
Parameters:
  • serviceEnvironmentName (string) –

    [REQUIRED]

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

  • serviceEnvironmentType (string) –

    [REQUIRED]

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

  • state (string) – The state of the service environment. Valid values are ENABLED and DISABLED. The default value is ENABLED.

  • capacityLimits (list) –

    [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 type and maximum quantity of resources that can be allocated to service jobs in a service environment.

      • maxCapacity (integer) –

        The maximum capacity available for the service environment. For a quota management enabled service environment, this value represents the maximum quantity of a particular resource type (specified by capacityUnit) that can be allocated to service jobs. For other service environments, this value represents the maximum quantity of all resources that can be allocated to service jobs.

        For example, if maxCapacity=50 and capacityUnit=NUM_INSTANCES, you can run up to 50 instances concurrently. If you run 5 SageMaker Training jobs that each use 10 instances, a subsequent job requiring 10 instances waits in the queue until capacity is available. In a quota management enabled service environment with capacityUnit=ml.m5.large, only ml.m5.large instances count against this limit, and jobs requiring other instance types wait until a matching capacity limit is configured.

      • capacityUnit (string) –

        The unit of measure for the capacity limit, which defines how maxCapacity is interpreted. For SAGEMAKER_TRAINING jobs in a quota management enabled service environment, specify the instance type (for example, ml.m5.large). Otherwise, use NUM_INSTANCES.

  • tags (dict) –

    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.

    • (string) –

      • (string) –

Return type:

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

  • Batch.Client.exceptions.ClientException

  • Batch.Client.exceptions.ServerException